From 311a0cff55e5837f9972fb43d65e06768babccc5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 10 Sep 2015 17:58:54 -0700 Subject: [PATCH 001/140] Added tests. --- .../stringLiteralTypesAsTags01.ts | 43 +++++++++++++++ .../stringLiteralTypesInUnionTypes01.ts | 21 ++++++++ .../stringLiteralTypesInUnionTypes02.ts | 21 ++++++++ .../stringLiteralTypesInUnionTypes03.ts | 21 ++++++++ .../stringLiteralTypesInUnionTypes04.ts | 38 +++++++++++++ ...ingLiteralTypesInVariableDeclarations01.ts | 19 +++++++ .../stringLiteralTypesOverloads01.ts | 53 +++++++++++++++++++ .../stringLiteralTypesOverloads02.ts | 51 ++++++++++++++++++ .../stringLiteralTypesTypePredicates01.ts | 25 +++++++++ 9 files changed, 292 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts new file mode 100644 index 00000000000..cea04f0818e --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts @@ -0,0 +1,43 @@ +// @declaration: true + +type Kind = "A" | "B" + +interface Entity { + kind: Kind; +} + +interface A extends Entity { + kind: "A"; + a: number; +} + +interface B extends Entity { + kind: "B"; + b: string; +} + +function hasKind(entity: Entity, kind: "A"): entity is A; +function hasKind(entity: Entity, kind: "B"): entity is B; +function hasKind(entity: Entity, kind: Kind): entity is Entity; +function hasKind(entity: Entity, kind: Kind): boolean { + return kind === is; +} + +let x: A = { + kind: "A", + a: 100, +} + +if (hasKind(x, "A")) { + let a = x; +} +else { + let b = x; +} + +if (!hasKind(x, "B")) { + let c = x; +} +else { + let d = x; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts new file mode 100644 index 00000000000..b8ed1b47dd4 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts @@ -0,0 +1,21 @@ +// @declaration: true + +type T = "foo" | "bar" | "baz"; + +var x: "foo" | "bar" | "baz" = "foo"; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts new file mode 100644 index 00000000000..2cc63ab4460 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts @@ -0,0 +1,21 @@ +// @declaration: true + +type T = string | "foo" | "bar" | "baz"; + +var x: "foo" | "bar" | "baz" | string = "foo"; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts new file mode 100644 index 00000000000..d5c6a38af79 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts @@ -0,0 +1,21 @@ +// @declaration: true + +type T = number | "foo" | "bar"; + +var x: "foo" | "bar" | number; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts new file mode 100644 index 00000000000..e9d062b0e5c --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts @@ -0,0 +1,38 @@ +// @declaration: true + +type T = "" | "foo"; + +let x: T = ""; +let y: T = "foo"; + +if (x === "") { + let a = x; +} + +if (x !== "") { + let b = x; +} + +if (x == "") { + let c = x; +} + +if (x != "") { + let d = x; +} + +if (x) { + let e = x; +} + +if (!x) { + let f = x; +} + +if (!!x) { + let g = x; +} + +if (!!!x) { + let h = x; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts new file mode 100644 index 00000000000..4f006387687 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts @@ -0,0 +1,19 @@ +// @declaration: true + +let a: ""; +var b: "foo"; +let c: "bar"; +const d: "baz"; + +a = ""; +b = "foo"; +c = "bar"; + +let e: "" = ""; +var f: "foo" = "foo"; +let g: "bar" = "bar"; +const h: "baz" = "baz"; + +e = ""; +f = "foo"; +g = "bar"; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts new file mode 100644 index 00000000000..d88167eaeff --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts @@ -0,0 +1,53 @@ +// @declaration: true + +type PrimitiveName = 'string' | 'number' | 'boolean'; + +function getFalsyPrimitive(x: "string"): string; +function getFalsyPrimitive(x: "number"): number; +function getFalsyPrimitive(x: "boolean"): boolean; +function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +function getFalsyPrimitive(x: "number" | "string"): number | string; +function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +function getFalsyPrimitive(x: PrimitiveName) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; +} + +namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); +} + +const string: "string" = "string" +const number: "number" = "number" +const boolean: "boolean" = "boolean" + +const stringOrNumber = string || number; +const stringOrBoolean = string || boolean; +const booleanOrNumber = number || boolean; +const stringOrBooleanOrNumber = stringOrBoolean || number; + +namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); +} + + diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts new file mode 100644 index 00000000000..5801aa50076 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts @@ -0,0 +1,51 @@ +// @declaration: true + +function getFalsyPrimitive(x: "string"): string; +function getFalsyPrimitive(x: "number"): number; +function getFalsyPrimitive(x: "boolean"): boolean; +function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +function getFalsyPrimitive(x: "number" | "string"): number | string; +function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +function getFalsyPrimitive(x: string) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; +} + +namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); +} + +const string: "string" = "string" +const number: "number" = "number" +const boolean: "boolean" = "boolean" + +const stringOrNumber = string || number; +const stringOrBoolean = string || boolean; +const booleanOrNumber = number || boolean; +const stringOrBooleanOrNumber = stringOrBoolean || number; + +namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); +} + + diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts new file mode 100644 index 00000000000..a78918c8122 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts @@ -0,0 +1,25 @@ +// @declaration: true + +type Kind = "A" | "B" + +function kindIs(kind: Kind, is: "A"): kind is "A"; +function kindIs(kind: Kind, is: "B"): kind is "B"; +function kindIs(kind: Kind, is: Kind): boolean { + return kind === is; +} + +var x: Kind = "A"; + +if (kindIs(x, "A")) { + let a = x; +} +else { + let b = x; +} + +if (!kindIs(x, "B")) { + let c = x; +} +else { + let d = x; +} \ No newline at end of file From 7d067890ce808fd57439d4cf9f6aec40d3e5c412 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 30 Sep 2015 14:46:33 -0700 Subject: [PATCH 002/140] naive change --- src/compiler/emitter.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index bec17b813cb..60864e411fc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -469,6 +469,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (!isExternalModuleOrDeclarationFile(sourceFile)) { emitSourceFile(sourceFile); } + else if (isExternalModule(sourceFile)) { + emitConcatenatedModule(sourceFile); + } }); } @@ -482,6 +485,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emit(sourceFile); } + function emitConcatenatedModule(sourceFile: SourceFile): void { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + moduleEmitDelegates[modulekind](sourceFile, 0); + } + function isUniqueName(name: string): boolean { return !resolver.hasGlobalName(name) && !hasProperty(currentSourceFile.identifiers, name) && From b6a57ea8afa8072a87a46ba3841ed82af1112004 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 1 Oct 2015 12:44:24 -0700 Subject: [PATCH 003/140] Concatenated module emit fixes up all included paths --- src/compiler/emitter.ts | 56 ++++++++++++++++++++++++++++++++------- src/compiler/program.ts | 6 +++++ src/compiler/utilities.ts | 32 ++++++++++++++++++++-- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 60864e411fc..df2687768fc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -448,7 +448,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi /** If removeComments is true, no leading-comments needed to be emitted **/ let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker; - let moduleEmitDelegates: Map<(node: SourceFile, startIndex: number) => void> = { + let moduleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = { [ModuleKind.ES6]: emitES6Module, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, @@ -456,6 +456,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi [ModuleKind.CommonJS]: emitCommonJSModule, }; + let bundleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = { + [ModuleKind.ES6]: () => {}, + [ModuleKind.AMD]: emitAMDModule, + [ModuleKind.System]: emitSystemModule, + [ModuleKind.UMD]: emitUMDModule, + [ModuleKind.CommonJS]: () => {}, + }; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -465,6 +473,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitSourceFile(root); } else { + forEach(host.getSourceFiles(), emitEmitHelpers); forEach(host.getSourceFiles(), sourceFile => { if (!isExternalModuleOrDeclarationFile(sourceFile)) { emitSourceFile(sourceFile); @@ -488,7 +497,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitConcatenatedModule(sourceFile: SourceFile): void { currentSourceFile = sourceFile; exportFunctionForFile = undefined; - moduleEmitDelegates[modulekind](sourceFile, 0); + let canonicalName = resolveToSemiabsolutePath(sourceFile.fileName); + sourceFile.moduleName = sourceFile.moduleName || canonicalName; + bundleEmitDelegates[modulekind](sourceFile, 0, /*resolvePath*/true); + } + + function resolveToSemiabsolutePath(path: string): string { + let dir = host.getCurrentDirectory(); + return removeFileExtension( + getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/false) + ); } function isUniqueName(name: string): boolean { @@ -6620,7 +6638,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("}"); // execute } - function emitSystemModule(node: SourceFile, startIndex: number): void { + function emitSystemModule(node: SourceFile, startIndex: number, resolvePath?: boolean): void { collectExternalModuleInfo(node); // System modules has the following shape // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) @@ -6660,6 +6678,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(", "); } + if (resolvePath) { + text = makeModulePathSemiabsolute(text); + } write(text); } write(`], function(${exportFunctionForFile}) {`); @@ -6679,7 +6700,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi importAliasNames: string[]; } - function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean): AMDDependencyNames { + function makeModulePathSemiabsolute(externalModuleName: string): string { + let quotemark = externalModuleName.charAt(0); + let unquotedModuleName = externalModuleName.substring(1, externalModuleName.length - 1); + let resolvedFileName = host.resolveModuleName(unquotedModuleName, currentSourceFile.fileName); + if (resolvedFileName) { + let semiabsoluteName = resolveToSemiabsolutePath(resolvedFileName); + externalModuleName = quoteString(semiabsoluteName, quotemark); + } + return externalModuleName; + } + + function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, resolvePath?: boolean): AMDDependencyNames { // names of modules with corresponding parameter in the factory function let aliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in factory function @@ -6703,6 +6735,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Find the name of the external module let externalModuleName = getExternalModuleNameText(importNode); + if (resolvePath) { + externalModuleName = makeModulePathSemiabsolute(externalModuleName); + } + // Find the name of the module alias, if there is one let importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -6717,7 +6753,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return { aliasedModuleNames, unaliasedModuleNames, importAliasNames }; } - function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean) { + function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean, resolvePath?: boolean) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // @@ -6730,7 +6766,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, resolvePath); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -6758,7 +6794,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(") {"); } - function emitAMDModule(node: SourceFile, startIndex: number) { + function emitAMDModule(node: SourceFile, startIndex: number, resolvePath?: boolean) { emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -6767,7 +6803,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (node.moduleName) { write("\"" + node.moduleName + "\", "); } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, resolvePath); increaseIndent(); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); @@ -6789,11 +6825,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitExportEquals(/*emitAsReturn*/ false); } - function emitUMDModule(node: SourceFile, startIndex: number) { + function emitUMDModule(node: SourceFile, startIndex: number, resolvePath?: boolean) { emitEmitHelpers(node); collectExternalModuleInfo(node); - let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false); + let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false, resolvePath); // Module is detected first to support Browserify users that load into a browser with an AMD loader writeLines(`(function (factory) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c6d3a245a8d..b595d48dc57 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -522,6 +522,12 @@ namespace ts { getSourceFiles: program.getSourceFiles, writeFile: writeFileCallback || ( (fileName, data, writeByteOrderMark, onError) => host.writeFile(fileName, data, writeByteOrderMark, onError)), + resolveModuleName: (name: string, containingFile?: string) => { + let resolvedModule = resolveModuleNamesWorker([name], containingFile || "dummy.ts")[0]; + if (!resolvedModule) + return; + return resolvedModule.resolvedFileName; + }, }; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 452f59f0f03..9ae65af046e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -40,6 +40,7 @@ namespace ts { getNewLine(): string; writeFile: WriteFileCallback; + resolveModuleName(path: string, containingFile?: string): string; } // Pool writers to avoid needing to allocate them for every symbol we write. @@ -1619,21 +1620,48 @@ namespace ts { "\u0085": "\\u0085" // nextLine }; + let singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + let singleQuoteEscapedCharsMap: Map = { + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\'": "\\\'", + "\u2028": "\\u2028", // lineSeparator + "\u2029": "\\u2029", // paragraphSeparator + "\u0085": "\\u0085" // nextLine + }; + /** * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), * but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine) * Note that this doesn't actually wrap the input in double quotes. */ export function escapeString(s: string): string { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; + return escapeStringByQuote(s, "\""); + } + + export function escapeStringByQuote(s: string, quotemark: string): string { + let regex = quotemark === "'" ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; + let replacementMap = quotemark === "'" ? singleQuoteEscapedCharsMap : escapedCharsMap; + + s = regex.test(s) ? s.replace(regex, getReplacement) : s; return s; function getReplacement(c: string) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return replacementMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } } + export function quoteString(s: string, quotemark: string): string { + return quotemark + escapeStringByQuote(s, quotemark) + quotemark; + } + export function isIntrinsicJsxName(name: string) { let ch = name.substr(0, 1); return ch.toLowerCase() === ch; From 911e90730601f35a24dcd16d2e6d5f4fc6b12529 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 15:26:48 -0700 Subject: [PATCH 004/140] Added test for string literal types in type arguments. --- .../typeArgumentsWithStringLiteralTypes01.ts | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts diff --git a/tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts b/tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts new file mode 100644 index 00000000000..08c971458e3 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts @@ -0,0 +1,113 @@ +// @declaration: true + +declare function randBool(): boolean; +declare function takeReturnString(str: string): string; +declare function takeReturnHello(str: "Hello"): "Hello"; +declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; + +function fun1(x: T, y: T) { + return randBool() ? x : y; +} + +function fun2(x: T, y: U) { + return randBool() ? x : y; +} + +function fun3(...args: T[]): T { + return args[+randBool()]; +} + +namespace n1 { + // The following should all come back as strings. + // They should be assignable to/from something of a type 'string'. + // They should not be assignable to either "Hello" or "World". + export let a = fun1("Hello", "World"); + export let b = fun1("Hello", "Hello"); + export let c = fun2("Hello", "World"); + export let d = fun2("Hello", "Hello"); + export let e = fun3("Hello", "Hello", "World", "Foo"); + + // Should be valid + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Passing these as arguments should cause an error. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} + +namespace n2 { + // The following (regardless of errors) should come back typed + // as "Hello" (or "Hello" | "Hello"). + export let a = fun1<"Hello">("Hello", "Hello"); + export let b = fun1<"Hello">("Hello", "World"); + export let c = fun2<"Hello", "Hello">("Hello", "Hello"); + export let d = fun2<"Hello", "Hello">("Hello", "World"); + export let e = fun3<"Hello">("Hello", "World"); + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Should be valid + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Assignment from the returned value should cause an error. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} + + +namespace n3 { + // The following (regardless of errors) should come back typed + // as "Hello" | "World" (or "World" | "Hello"). + export let a = fun2<"Hello", "World">("Hello", "World"); + export let b = fun2<"Hello", "World">("World", "Hello"); + export let c = fun2<"World", "Hello">("Hello", "Hello"); + export let d = fun2<"World", "Hello">("World", "World"); + export let e = fun3<"Hello" | "World">("Hello", "World"); + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Both should be valid. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} \ No newline at end of file From f04cc39a68a7a576ca9e6b7149b076cd9eb95fd9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 15:54:16 -0700 Subject: [PATCH 005/140] Accepted baselines. --- .../stringLiteralTypesAsTags01.errors.txt | 86 +++++ .../reference/stringLiteralTypesAsTags01.js | 65 ++++ ...tringLiteralTypesInUnionTypes01.errors.txt | 59 ++++ .../stringLiteralTypesInUnionTypes01.js | 40 +++ ...tringLiteralTypesInUnionTypes02.errors.txt | 62 ++++ .../stringLiteralTypesInUnionTypes02.js | 40 +++ ...tringLiteralTypesInUnionTypes03.errors.txt | 50 +++ .../stringLiteralTypesInUnionTypes03.js | 39 +++ ...tringLiteralTypesInUnionTypes04.errors.txt | 52 +++ .../stringLiteralTypesInUnionTypes04.js | 67 ++++ ...alTypesInVariableDeclarations01.errors.txt | 81 +++++ ...ingLiteralTypesInVariableDeclarations01.js | 35 ++ .../stringLiteralTypesOverloads01.errors.txt | 146 ++++++++ .../stringLiteralTypesOverloads01.js | 93 +++++ .../stringLiteralTypesOverloads02.errors.txt | 129 +++++++ .../stringLiteralTypesOverloads02.js | 90 +++++ ...ingLiteralTypesTypePredicates01.errors.txt | 57 +++ .../stringLiteralTypesTypePredicates01.js | 46 +++ ...gumentsWithStringLiteralTypes01.errors.txt | 325 ++++++++++++++++++ .../typeArgumentsWithStringLiteralTypes01.js | 221 ++++++++++++ 20 files changed, 1783 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAsTags01.js create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes01.js create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes02.js create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes03.js create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes04.js create mode 100644 tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads01.js create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads02.js create mode 100644 tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesTypePredicates01.js create mode 100644 tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt create mode 100644 tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt new file mode 100644 index 00000000000..292cc8ea5b7 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt @@ -0,0 +1,86 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,12): error TS4081: Exported type alias 'Kind' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,13): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(9,10): error TS4033: Property 'kind' of exported interface has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(9,11): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(14,10): error TS4033: Property 'kind' of exported interface has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(14,11): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(18,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(20,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(22,21): error TS2304: Cannot find name 'is'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. + Property '"A"' is missing in type '{ kind: string; a: number; }'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (13 errors) ==== + + type Kind = "A" | "B" + +!!! error TS4081: Exported type alias 'Kind' has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + ~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + interface Entity { + kind: Kind; + } + + interface A extends Entity { + kind: "A"; + +!!! error TS4033: Property 'kind' of exported interface has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + a: number; + } + + interface B extends Entity { + kind: "B"; + +!!! error TS4033: Property 'kind' of exported interface has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + b: string; + } + + function hasKind(entity: Entity, kind: "A"): entity is A; + ~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function hasKind(entity: Entity, kind: "B"): entity is B; + ~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function hasKind(entity: Entity, kind: Kind): entity is Entity; + ~~~~~~~ +!!! error TS2394: Overload signature is not compatible with function implementation. + function hasKind(entity: Entity, kind: Kind): boolean { + return kind === is; + ~~ +!!! error TS2304: Cannot find name 'is'. + } + + let x: A = { + ~ +!!! error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. +!!! error TS2322: Property '"A"' is missing in type '{ kind: string; a: number; }'. + kind: "A", + a: 100, + } + + if (hasKind(x, "A")) { + let a = x; + } + else { + let b = x; + } + + if (!hasKind(x, "B")) { + let c = x; + } + else { + let d = x; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.js b/tests/baselines/reference/stringLiteralTypesAsTags01.js new file mode 100644 index 00000000000..2ce20607790 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.js @@ -0,0 +1,65 @@ +//// [stringLiteralTypesAsTags01.ts] + +type Kind = "A" | "B" + +interface Entity { + kind: Kind; +} + +interface A extends Entity { + kind: "A"; + a: number; +} + +interface B extends Entity { + kind: "B"; + b: string; +} + +function hasKind(entity: Entity, kind: "A"): entity is A; +function hasKind(entity: Entity, kind: "B"): entity is B; +function hasKind(entity: Entity, kind: Kind): entity is Entity; +function hasKind(entity: Entity, kind: Kind): boolean { + return kind === is; +} + +let x: A = { + kind: "A", + a: 100, +} + +if (hasKind(x, "A")) { + let a = x; +} +else { + let b = x; +} + +if (!hasKind(x, "B")) { + let c = x; +} +else { + let d = x; +} + +//// [stringLiteralTypesAsTags01.js] +"A" | "B"; +function hasKind(entity, kind) { + return kind === is; +} +var x = { + kind: "A", + a: 100 +}; +if (hasKind(x, "A")) { + var a = x; +} +else { + var b = x; +} +if (!hasKind(x, "B")) { + var c = x; +} +else { + var d = x; +} diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt new file mode 100644 index 00000000000..fcc13629ceb --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,9): error TS4081: Exported type alias 'T' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,10): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,30): error TS1005: ',' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,32): error TS1134: Variable declaration expected. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts (12 errors) ==== + + type T = "foo" | "bar" | "baz"; + +!!! error TS4081: Exported type alias 'T' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var x: "foo" | "bar" | "baz" = "foo"; + +!!! error TS4025: Exported variable 'x' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS1005: ',' expected. + ~~~~~ +!!! error TS1134: Variable declaration expected. + var y: T = "bar"; + + if (x === "foo") { + let a = x; + } + else if (x !== "bar") { + let b = x || y; + } + else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; + } + + x = y; + y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js new file mode 100644 index 00000000000..4eaaec42ceb --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js @@ -0,0 +1,40 @@ +//// [stringLiteralTypesInUnionTypes01.ts] + +type T = "foo" | "bar" | "baz"; + +var x: "foo" | "bar" | "baz" = "foo"; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; + +//// [stringLiteralTypesInUnionTypes01.js] +"foo" | "bar" | "baz"; +var x = "foo" | "bar" | "baz"; +"foo"; +var y = "bar"; +if (x === "foo") { + var a = x; +} +else if (x !== "bar") { + var b = x || y; +} +else { + var c = x; + var d = y; + var e = c || d; +} +x = y; +y = x; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt new file mode 100644 index 00000000000..dc8523051aa --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,18): error TS4081: Exported type alias 'T' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,19): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,19): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,35): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,32): error TS2304: Cannot find name 'string'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,39): error TS1005: ',' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,41): error TS1134: Variable declaration expected. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts (13 errors) ==== + + type T = string | "foo" | "bar" | "baz"; + +!!! error TS4081: Exported type alias 'T' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var x: "foo" | "bar" | "baz" | string = "foo"; + +!!! error TS4025: Exported variable 'x' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + ~ +!!! error TS1005: ',' expected. + ~~~~~ +!!! error TS1134: Variable declaration expected. + var y: T = "bar"; + + if (x === "foo") { + let a = x; + } + else if (x !== "bar") { + let b = x || y; + } + else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; + } + + x = y; + y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js new file mode 100644 index 00000000000..19b309980f8 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js @@ -0,0 +1,40 @@ +//// [stringLiteralTypesInUnionTypes02.ts] + +type T = string | "foo" | "bar" | "baz"; + +var x: "foo" | "bar" | "baz" | string = "foo"; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; + +//// [stringLiteralTypesInUnionTypes02.js] +"foo" | "bar" | "baz"; +var x = "foo" | "bar" | "baz" | string; +"foo"; +var y = "bar"; +if (x === "foo") { + var a = x; +} +else if (x !== "bar") { + var b = x || y; +} +else { + var c = x; + var d = y; + var e = c || d; +} +x = y; +y = x; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt new file mode 100644 index 00000000000..1595c625322 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,18): error TS4081: Exported type alias 'T' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,19): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,19): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,24): error TS2304: Cannot find name 'number'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (9 errors) ==== + + type T = number | "foo" | "bar"; + +!!! error TS4081: Exported type alias 'T' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var x: "foo" | "bar" | number; + +!!! error TS4025: Exported variable 'x' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. + var y: T = "bar"; + + if (x === "foo") { + let a = x; + } + else if (x !== "bar") { + let b = x || y; + } + else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; + } + + x = y; + y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js new file mode 100644 index 00000000000..7705848be2b --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js @@ -0,0 +1,39 @@ +//// [stringLiteralTypesInUnionTypes03.ts] + +type T = number | "foo" | "bar"; + +var x: "foo" | "bar" | number; +var y: T = "bar"; + +if (x === "foo") { + let a = x; +} +else if (x !== "bar") { + let b = x || y; +} +else { + let c = x; + let d = y; + let e: (typeof x) | (typeof y) = c || d; +} + +x = y; +y = x; + +//// [stringLiteralTypesInUnionTypes03.js] +"foo" | "bar"; +var x = "foo" | "bar" | number; +var y = "bar"; +if (x === "foo") { + var a = x; +} +else if (x !== "bar") { + var b = x || y; +} +else { + var c = x; + var d = y; + var e = c || d; +} +x = y; +y = x; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt new file mode 100644 index 00000000000..66d3e215237 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,9): error TS4081: Exported type alias 'T' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,10): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,15): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts (4 errors) ==== + + type T = "" | "foo"; + +!!! error TS4081: Exported type alias 'T' has or is using private name ''. + ~~ +!!! error TS1110: Type expected. + ~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + let x: T = ""; + let y: T = "foo"; + + if (x === "") { + let a = x; + } + + if (x !== "") { + let b = x; + } + + if (x == "") { + let c = x; + } + + if (x != "") { + let d = x; + } + + if (x) { + let e = x; + } + + if (!x) { + let f = x; + } + + if (!!x) { + let g = x; + } + + if (!!!x) { + let h = x; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js new file mode 100644 index 00000000000..5817d16ec8f --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js @@ -0,0 +1,67 @@ +//// [stringLiteralTypesInUnionTypes04.ts] + +type T = "" | "foo"; + +let x: T = ""; +let y: T = "foo"; + +if (x === "") { + let a = x; +} + +if (x !== "") { + let b = x; +} + +if (x == "") { + let c = x; +} + +if (x != "") { + let d = x; +} + +if (x) { + let e = x; +} + +if (!x) { + let f = x; +} + +if (!!x) { + let g = x; +} + +if (!!!x) { + let h = x; +} + +//// [stringLiteralTypesInUnionTypes04.js] +"" | "foo"; +var x = ""; +var y = "foo"; +if (x === "") { + var a = x; +} +if (x !== "") { + var b = x; +} +if (x == "") { + var c = x; +} +if (x != "") { + var d = x; +} +if (x) { + var e = x; +} +if (!x) { + var f = x; +} +if (!!x) { + var g = x; +} +if (!!!x) { + var h = x; +} diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt new file mode 100644 index 00000000000..14233db44cd --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt @@ -0,0 +1,81 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(2,7): error TS4025: Exported variable 'a' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(2,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(3,7): error TS4025: Exported variable 'b' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(3,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(4,7): error TS4025: Exported variable 'c' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(4,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,9): error TS4025: Exported variable 'd' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,10): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,7): error TS4025: Exported variable 'e' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,8): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,7): error TS4025: Exported variable 'f' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,8): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,7): error TS4025: Exported variable 'g' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,8): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,8): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,9): error TS4025: Exported variable 'h' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,10): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,10): error TS2364: Invalid left-hand side of assignment expression. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (20 errors) ==== + + let a: ""; + +!!! error TS4025: Exported variable 'a' has or is using private name ''. + ~~ +!!! error TS1110: Type expected. + var b: "foo"; + +!!! error TS4025: Exported variable 'b' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + let c: "bar"; + +!!! error TS4025: Exported variable 'c' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + const d: "baz"; + +!!! error TS4025: Exported variable 'd' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + + a = ""; + b = "foo"; + c = "bar"; + + let e: "" = ""; + +!!! error TS4025: Exported variable 'e' has or is using private name ''. + ~~ +!!! error TS1110: Type expected. + ~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + var f: "foo" = "foo"; + +!!! error TS4025: Exported variable 'f' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + let g: "bar" = "bar"; + +!!! error TS4025: Exported variable 'g' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + const h: "baz" = "baz"; + +!!! error TS4025: Exported variable 'h' has or is using private name ''. + ~~~~~ +!!! error TS1110: Type expected. + ~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + + e = ""; + f = "foo"; + g = "bar"; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js new file mode 100644 index 00000000000..4aae2a2438a --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js @@ -0,0 +1,35 @@ +//// [stringLiteralTypesInVariableDeclarations01.ts] + +let a: ""; +var b: "foo"; +let c: "bar"; +const d: "baz"; + +a = ""; +b = "foo"; +c = "bar"; + +let e: "" = ""; +var f: "foo" = "foo"; +let g: "bar" = "bar"; +const h: "baz" = "baz"; + +e = ""; +f = "foo"; +g = "bar"; + +//// [stringLiteralTypesInVariableDeclarations01.js] +var a = ""; +var b = "foo"; +var c = "bar"; +var d = "baz"; +a = ""; +b = "foo"; +c = "bar"; +var e = "" = ""; +var f = "foo" = "foo"; +var g = "bar" = "bar"; +var h = "baz" = "baz"; +e = ""; +f = "foo"; +g = "bar"; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt new file mode 100644 index 00000000000..e41de718dfa --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt @@ -0,0 +1,146 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,21): error TS4081: Exported type alias 'PrimitiveName' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,22): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,22): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,33): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,44): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,41): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,41): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,40): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,40): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(11,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,14): error TS4025: Exported variable 'string' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,15): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,15): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,14): error TS4025: Exported variable 'number' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,15): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,15): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,15): error TS4025: Exported variable 'boolean' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,16): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,16): error TS2364: Invalid left-hand side of assignment expression. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (30 errors) ==== + + type PrimitiveName = 'string' | 'number' | 'boolean'; + +!!! error TS4081: Exported type alias 'PrimitiveName' has or is using private name ''. + ~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + function getFalsyPrimitive(x: "string"): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "number"): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "boolean"): boolean; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "number" | "string"): number | string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: PrimitiveName) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2354: No best common type exists among return expressions. + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; + } + + namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); + } + + const string: "string" = "string" + +!!! error TS4025: Exported variable 'string' has or is using private name ''. + ~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + const number: "number" = "number" + +!!! error TS4025: Exported variable 'number' has or is using private name ''. + ~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + const boolean: "boolean" = "boolean" + +!!! error TS4025: Exported variable 'boolean' has or is using private name ''. + ~~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + + const stringOrNumber = string || number; + const stringOrBoolean = string || boolean; + const booleanOrNumber = number || boolean; + const stringOrBooleanOrNumber = stringOrBoolean || number; + + namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); + } + + + \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.js b/tests/baselines/reference/stringLiteralTypesOverloads01.js new file mode 100644 index 00000000000..a001f02c9c9 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.js @@ -0,0 +1,93 @@ +//// [stringLiteralTypesOverloads01.ts] + +type PrimitiveName = 'string' | 'number' | 'boolean'; + +function getFalsyPrimitive(x: "string"): string; +function getFalsyPrimitive(x: "number"): number; +function getFalsyPrimitive(x: "boolean"): boolean; +function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +function getFalsyPrimitive(x: "number" | "string"): number | string; +function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +function getFalsyPrimitive(x: PrimitiveName) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; +} + +namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); +} + +const string: "string" = "string" +const number: "number" = "number" +const boolean: "boolean" = "boolean" + +const stringOrNumber = string || number; +const stringOrBoolean = string || boolean; +const booleanOrNumber = number || boolean; +const stringOrBooleanOrNumber = stringOrBoolean || number; + +namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); +} + + + + +//// [stringLiteralTypesOverloads01.js] +'string' | 'number' | 'boolean'; +function getFalsyPrimitive(x) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + // Should be unreachable. + throw "Invalid value"; +} +var Consts1; +(function (Consts1) { + var EMPTY_STRING = getFalsyPrimitive("string"); + var ZERO = getFalsyPrimitive('number'); + var FALSE = getFalsyPrimitive("boolean"); +})(Consts1 || (Consts1 = {})); +var string = "string" = "string"; +var number = "number" = "number"; +var boolean = "boolean" = "boolean"; +var stringOrNumber = string || number; +var stringOrBoolean = string || boolean; +var booleanOrNumber = number || boolean; +var stringOrBooleanOrNumber = stringOrBoolean || number; +var Consts2; +(function (Consts2) { + var EMPTY_STRING = getFalsyPrimitive(string); + var ZERO = getFalsyPrimitive(number); + var FALSE = getFalsyPrimitive(boolean); + var a = getFalsyPrimitive(stringOrNumber); + var b = getFalsyPrimitive(stringOrBoolean); + var c = getFalsyPrimitive(booleanOrNumber); + var d = getFalsyPrimitive(stringOrBooleanOrNumber); +})(Consts2 || (Consts2 = {})); diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt new file mode 100644 index 00000000000..ff1e212c071 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt @@ -0,0 +1,129 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(3,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,41): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,41): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,40): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,40): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(9,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,14): error TS4025: Exported variable 'string' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,15): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,15): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,14): error TS4025: Exported variable 'number' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,15): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,15): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,15): error TS4025: Exported variable 'boolean' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,16): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,16): error TS2364: Invalid left-hand side of assignment expression. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (25 errors) ==== + + function getFalsyPrimitive(x: "string"): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "number"): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "boolean"): boolean; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "number" | "string"): number | string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; + ~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + function getFalsyPrimitive(x: string) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2354: No best common type exists among return expressions. + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; + } + + namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); + } + + const string: "string" = "string" + +!!! error TS4025: Exported variable 'string' has or is using private name ''. + ~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + const number: "number" = "number" + +!!! error TS4025: Exported variable 'number' has or is using private name ''. + ~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + const boolean: "boolean" = "boolean" + +!!! error TS4025: Exported variable 'boolean' has or is using private name ''. + ~~~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + + const stringOrNumber = string || number; + const stringOrBoolean = string || boolean; + const booleanOrNumber = number || boolean; + const stringOrBooleanOrNumber = stringOrBoolean || number; + + namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); + } + + + \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.js b/tests/baselines/reference/stringLiteralTypesOverloads02.js new file mode 100644 index 00000000000..ae38acebb95 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.js @@ -0,0 +1,90 @@ +//// [stringLiteralTypesOverloads02.ts] + +function getFalsyPrimitive(x: "string"): string; +function getFalsyPrimitive(x: "number"): number; +function getFalsyPrimitive(x: "boolean"): boolean; +function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +function getFalsyPrimitive(x: "number" | "string"): number | string; +function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +function getFalsyPrimitive(x: string) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + + // Should be unreachable. + throw "Invalid value"; +} + +namespace Consts1 { + const EMPTY_STRING = getFalsyPrimitive("string"); + const ZERO = getFalsyPrimitive('number'); + const FALSE = getFalsyPrimitive("boolean"); +} + +const string: "string" = "string" +const number: "number" = "number" +const boolean: "boolean" = "boolean" + +const stringOrNumber = string || number; +const stringOrBoolean = string || boolean; +const booleanOrNumber = number || boolean; +const stringOrBooleanOrNumber = stringOrBoolean || number; + +namespace Consts2 { + const EMPTY_STRING = getFalsyPrimitive(string); + const ZERO = getFalsyPrimitive(number); + const FALSE = getFalsyPrimitive(boolean); + + const a = getFalsyPrimitive(stringOrNumber); + const b = getFalsyPrimitive(stringOrBoolean); + const c = getFalsyPrimitive(booleanOrNumber); + const d = getFalsyPrimitive(stringOrBooleanOrNumber); +} + + + + +//// [stringLiteralTypesOverloads02.js] +function getFalsyPrimitive(x) { + if (x === "string") { + return ""; + } + if (x === "number") { + return 0; + } + if (x === "boolean") { + return false; + } + // Should be unreachable. + throw "Invalid value"; +} +var Consts1; +(function (Consts1) { + var EMPTY_STRING = getFalsyPrimitive("string"); + var ZERO = getFalsyPrimitive('number'); + var FALSE = getFalsyPrimitive("boolean"); +})(Consts1 || (Consts1 = {})); +var string = "string" = "string"; +var number = "number" = "number"; +var boolean = "boolean" = "boolean"; +var stringOrNumber = string || number; +var stringOrBoolean = string || boolean; +var booleanOrNumber = number || boolean; +var stringOrBooleanOrNumber = stringOrBoolean || number; +var Consts2; +(function (Consts2) { + var EMPTY_STRING = getFalsyPrimitive(string); + var ZERO = getFalsyPrimitive(number); + var FALSE = getFalsyPrimitive(boolean); + var a = getFalsyPrimitive(stringOrNumber); + var b = getFalsyPrimitive(stringOrBoolean); + var c = getFalsyPrimitive(booleanOrNumber); + var d = getFalsyPrimitive(stringOrBooleanOrNumber); +})(Consts2 || (Consts2 = {})); diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt new file mode 100644 index 00000000000..a4cc525cdd2 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,12): error TS4081: Exported type alias 'Kind' has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,13): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,46): error TS4060: Return type of exported function has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,47): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,46): error TS4060: Return type of exported function has or is using private name ''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,47): error TS1110: Type expected. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (10 errors) ==== + + type Kind = "A" | "B" + +!!! error TS4081: Exported type alias 'Kind' has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + ~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + function kindIs(kind: Kind, is: "A"): kind is "A"; + ~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + +!!! error TS4060: Return type of exported function has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + function kindIs(kind: Kind, is: "B"): kind is "B"; + ~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + +!!! error TS4060: Return type of exported function has or is using private name ''. + ~~~ +!!! error TS1110: Type expected. + function kindIs(kind: Kind, is: Kind): boolean { + return kind === is; + } + + var x: Kind = "A"; + + if (kindIs(x, "A")) { + let a = x; + } + else { + let b = x; + } + + if (!kindIs(x, "B")) { + let c = x; + } + else { + let d = x; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.js b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js new file mode 100644 index 00000000000..791caed9b31 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js @@ -0,0 +1,46 @@ +//// [stringLiteralTypesTypePredicates01.ts] + +type Kind = "A" | "B" + +function kindIs(kind: Kind, is: "A"): kind is "A"; +function kindIs(kind: Kind, is: "B"): kind is "B"; +function kindIs(kind: Kind, is: Kind): boolean { + return kind === is; +} + +var x: Kind = "A"; + +if (kindIs(x, "A")) { + let a = x; +} +else { + let b = x; +} + +if (!kindIs(x, "B")) { + let c = x; +} +else { + let d = x; +} + +//// [stringLiteralTypesTypePredicates01.js] +"A" | "B"; +"A"; +"B"; +function kindIs(kind, is) { + return kind === is; +} +var x = "A"; +if (kindIs(x, "A")) { + var a = x; +} +else { + var b = x; +} +if (!kindIs(x, "B")) { + var c = x; +} +else { + var d = x; +} diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt new file mode 100644 index 00000000000..626d0e3d6f4 --- /dev/null +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -0,0 +1,325 @@ +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,48): error TS4060: Return type of exported function has or is using private name ''. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,49): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,39): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,52): error TS1005: '=' expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,63): error TS4060: Return type of exported function has or is using private name ''. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,64): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,64): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,74): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(37,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(38,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(39,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(40,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(41,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(44,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(45,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(46,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(47,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(56,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(56,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,20): error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(62,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(64,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(65,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(68,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(69,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(70,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(71,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(72,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(76,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(78,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(79,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,34): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(90,20): error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(90,20): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(94,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(95,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(96,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(101,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(102,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(103,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(107,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(108,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(109,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(110,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(111,30): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. + + +==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (70 errors) ==== + + declare function randBool(): boolean; + declare function takeReturnString(str: string): string; + declare function takeReturnHello(str: "Hello"): "Hello"; + ~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + +!!! error TS4060: Return type of exported function has or is using private name ''. + ~~~~~~~ +!!! error TS1110: Type expected. + declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + ~ +!!! error TS1005: '=' expected. + +!!! error TS4060: Return type of exported function has or is using private name ''. + ~~~~~~~ +!!! error TS1110: Type expected. + ~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + function fun1(x: T, y: T) { + return randBool() ? x : y; + } + + function fun2(x: T, y: U) { + return randBool() ? x : y; + } + + function fun3(...args: T[]): T { + return args[+randBool()]; + } + + namespace n1 { + // The following should all come back as strings. + // They should be assignable to/from something of a type 'string'. + // They should not be assignable to either "Hello" or "World". + export let a = fun1("Hello", "World"); + export let b = fun1("Hello", "Hello"); + export let c = fun2("Hello", "World"); + export let d = fun2("Hello", "Hello"); + export let e = fun3("Hello", "Hello", "World", "Foo"); + + // Should be valid + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + b = takeReturnHello(b); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + c = takeReturnHello(c); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + d = takeReturnHello(d); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + e = takeReturnHello(e); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + + // Passing these as arguments should cause an error. + a = takeReturnHelloWorld(a); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + b = takeReturnHelloWorld(b); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + c = takeReturnHelloWorld(c); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + d = takeReturnHelloWorld(d); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + e = takeReturnHelloWorld(e); + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. + } + + namespace n2 { + // The following (regardless of errors) should come back typed + // as "Hello" (or "Hello" | "Hello"). + export let a = fun1<"Hello">("Hello", "Hello"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. + export let b = fun1<"Hello">("Hello", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. + export let c = fun2<"Hello", "Hello">("Hello", "Hello"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let d = fun2<"Hello", "Hello">("Hello", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let e = fun3<"Hello">("Hello", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + b = takeReturnString(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + c = takeReturnString(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + d = takeReturnString(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + e = takeReturnString(e); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + + // Should be valid + a = takeReturnHello(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + b = takeReturnHello(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + c = takeReturnHello(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + d = takeReturnHello(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + e = takeReturnHello(e); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + + // Assignment from the returned value should cause an error. + a = takeReturnHelloWorld(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + b = takeReturnHelloWorld(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + c = takeReturnHelloWorld(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + d = takeReturnHelloWorld(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + e = takeReturnHelloWorld(e); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + } + + + namespace n3 { + // The following (regardless of errors) should come back typed + // as "Hello" | "World" (or "World" | "Hello"). + export let a = fun2<"Hello", "World">("Hello", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let b = fun2<"Hello", "World">("World", "Hello"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let c = fun2<"World", "Hello">("Hello", "Hello"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let d = fun2<"World", "Hello">("World", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. + ~~~~~~~ +!!! error TS1134: Variable declaration expected. + export let e = fun3<"Hello" | "World">("Hello", "World"); + ~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + b = takeReturnString(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + c = takeReturnString(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + d = takeReturnString(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + e = takeReturnString(e); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + b = takeReturnHello(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + c = takeReturnHello(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + d = takeReturnHello(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + e = takeReturnHello(e); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. + + // Both should be valid. + a = takeReturnHelloWorld(a); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + b = takeReturnHelloWorld(b); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + c = takeReturnHelloWorld(c); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + d = takeReturnHelloWorld(d); + ~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. + e = takeReturnHelloWorld(e); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. + } \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js new file mode 100644 index 00000000000..15c7cf5ef2d --- /dev/null +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js @@ -0,0 +1,221 @@ +//// [typeArgumentsWithStringLiteralTypes01.ts] + +declare function randBool(): boolean; +declare function takeReturnString(str: string): string; +declare function takeReturnHello(str: "Hello"): "Hello"; +declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; + +function fun1(x: T, y: T) { + return randBool() ? x : y; +} + +function fun2(x: T, y: U) { + return randBool() ? x : y; +} + +function fun3(...args: T[]): T { + return args[+randBool()]; +} + +namespace n1 { + // The following should all come back as strings. + // They should be assignable to/from something of a type 'string'. + // They should not be assignable to either "Hello" or "World". + export let a = fun1("Hello", "World"); + export let b = fun1("Hello", "Hello"); + export let c = fun2("Hello", "World"); + export let d = fun2("Hello", "Hello"); + export let e = fun3("Hello", "Hello", "World", "Foo"); + + // Should be valid + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Passing these as arguments should cause an error. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} + +namespace n2 { + // The following (regardless of errors) should come back typed + // as "Hello" (or "Hello" | "Hello"). + export let a = fun1<"Hello">("Hello", "Hello"); + export let b = fun1<"Hello">("Hello", "World"); + export let c = fun2<"Hello", "Hello">("Hello", "Hello"); + export let d = fun2<"Hello", "Hello">("Hello", "World"); + export let e = fun3<"Hello">("Hello", "World"); + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Should be valid + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Assignment from the returned value should cause an error. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} + + +namespace n3 { + // The following (regardless of errors) should come back typed + // as "Hello" | "World" (or "World" | "Hello"). + export let a = fun2<"Hello", "World">("Hello", "World"); + export let b = fun2<"Hello", "World">("World", "Hello"); + export let c = fun2<"World", "Hello">("Hello", "Hello"); + export let d = fun2<"World", "Hello">("World", "World"); + export let e = fun3<"Hello" | "World">("Hello", "World"); + + // Assignment from the returned value should cause an error. + a = takeReturnString(a); + b = takeReturnString(b); + c = takeReturnString(c); + d = takeReturnString(d); + e = takeReturnString(e); + + // Passing these as arguments should cause an error. + a = takeReturnHello(a); + b = takeReturnHello(b); + c = takeReturnHello(c); + d = takeReturnHello(d); + e = takeReturnHello(e); + + // Both should be valid. + a = takeReturnHelloWorld(a); + b = takeReturnHelloWorld(b); + c = takeReturnHelloWorld(c); + d = takeReturnHelloWorld(d); + e = takeReturnHelloWorld(e); +} + +//// [typeArgumentsWithStringLiteralTypes01.js] +"Hello"; +"Hello" | "World"; +function fun1(x, y) { + return randBool() ? x : y; +} +function fun2(x, y) { + return randBool() ? x : y; +} +function fun3() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return args[+randBool()]; +} +var n1; +(function (n1) { + // The following should all come back as strings. + // They should be assignable to/from something of a type 'string'. + // They should not be assignable to either "Hello" or "World". + n1.a = fun1("Hello", "World"); + n1.b = fun1("Hello", "Hello"); + n1.c = fun2("Hello", "World"); + n1.d = fun2("Hello", "Hello"); + n1.e = fun3("Hello", "Hello", "World", "Foo"); + // Should be valid + n1.a = takeReturnString(n1.a); + n1.b = takeReturnString(n1.b); + n1.c = takeReturnString(n1.c); + n1.d = takeReturnString(n1.d); + n1.e = takeReturnString(n1.e); + // Passing these as arguments should cause an error. + n1.a = takeReturnHello(n1.a); + n1.b = takeReturnHello(n1.b); + n1.c = takeReturnHello(n1.c); + n1.d = takeReturnHello(n1.d); + n1.e = takeReturnHello(n1.e); + // Passing these as arguments should cause an error. + n1.a = takeReturnHelloWorld(n1.a); + n1.b = takeReturnHelloWorld(n1.b); + n1.c = takeReturnHelloWorld(n1.c); + n1.d = takeReturnHelloWorld(n1.d); + n1.e = takeReturnHelloWorld(n1.e); +})(n1 || (n1 = {})); +var n2; +(function (n2) { + // The following (regardless of errors) should come back typed + // as "Hello" (or "Hello" | "Hello"). + n2.a = fun1 < "Hello" > ("Hello", "Hello"); + n2.b = fun1 < "Hello" > ("Hello", "World"); + n2.c = fun2 < "Hello"; + "Hello" > ("Hello", "Hello"); + n2.d = fun2 < "Hello"; + "Hello" > ("Hello", "World"); + n2.e = fun3 < "Hello" > ("Hello", "World"); + // Assignment from the returned value should cause an error. + n2.a = takeReturnString(n2.a); + n2.b = takeReturnString(n2.b); + n2.c = takeReturnString(n2.c); + n2.d = takeReturnString(n2.d); + n2.e = takeReturnString(n2.e); + // Should be valid + n2.a = takeReturnHello(n2.a); + n2.b = takeReturnHello(n2.b); + n2.c = takeReturnHello(n2.c); + n2.d = takeReturnHello(n2.d); + n2.e = takeReturnHello(n2.e); + // Assignment from the returned value should cause an error. + n2.a = takeReturnHelloWorld(n2.a); + n2.b = takeReturnHelloWorld(n2.b); + n2.c = takeReturnHelloWorld(n2.c); + n2.d = takeReturnHelloWorld(n2.d); + n2.e = takeReturnHelloWorld(n2.e); +})(n2 || (n2 = {})); +var n3; +(function (n3) { + // The following (regardless of errors) should come back typed + // as "Hello" | "World" (or "World" | "Hello"). + n3.a = fun2 < "Hello"; + "World" > ("Hello", "World"); + n3.b = fun2 < "Hello"; + "World" > ("World", "Hello"); + n3.c = fun2 < "World"; + "Hello" > ("Hello", "Hello"); + n3.d = fun2 < "World"; + "Hello" > ("World", "World"); + n3.e = fun3 < "Hello" | "World" > ("Hello", "World"); + // Assignment from the returned value should cause an error. + n3.a = takeReturnString(n3.a); + n3.b = takeReturnString(n3.b); + n3.c = takeReturnString(n3.c); + n3.d = takeReturnString(n3.d); + n3.e = takeReturnString(n3.e); + // Passing these as arguments should cause an error. + n3.a = takeReturnHello(n3.a); + n3.b = takeReturnHello(n3.b); + n3.c = takeReturnHello(n3.c); + n3.d = takeReturnHello(n3.d); + n3.e = takeReturnHello(n3.e); + // Both should be valid. + n3.a = takeReturnHelloWorld(n3.a); + n3.b = takeReturnHelloWorld(n3.b); + n3.c = takeReturnHelloWorld(n3.c); + n3.d = takeReturnHelloWorld(n3.d); + n3.e = takeReturnHelloWorld(n3.e); +})(n3 || (n3 = {})); From 191be4f8fea8f176c7abffeeb1346f2bfe436fc8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 15:55:36 -0700 Subject: [PATCH 006/140] Make string literals valid constituent types nodes in the parser. --- src/compiler/parser.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 23fb846c0b4..769415dd94b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1969,9 +1969,7 @@ namespace ts { function parseParameterType(): TypeNode { if (parseOptional(SyntaxKind.ColonToken)) { - return token === SyntaxKind.StringLiteral - ? parseLiteralNode(/*internName*/ true) - : parseType(); + return parseType(); } return undefined; @@ -2359,6 +2357,8 @@ namespace ts { // If these are followed by a dot, then parse these out as a dotted type reference instead. let node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); + case SyntaxKind.StringLiteral: + return parseLiteralNode(/*internName*/ true) case SyntaxKind.VoidKeyword: return parseTokenNode(); case SyntaxKind.TypeOfKeyword: From 84786d82c14e3fae0f86d22e6fc635ecbac9dab8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 16:33:08 -0700 Subject: [PATCH 007/140] Accepted baselines. --- ...overy_IncompleteMemberVariable1.errors.txt | 34 ----- ...ErrorRecovery_IncompleteMemberVariable1.js | 1 - ...Recovery_IncompleteMemberVariable1.symbols | 67 ++++++++++ ...orRecovery_IncompleteMemberVariable1.types | 78 ++++++++++++ .../reference/stringLiteralType.errors.txt | 12 -- .../baselines/reference/stringLiteralType.js | 2 +- .../reference/stringLiteralType.symbols | 16 +++ .../reference/stringLiteralType.types | 16 +++ .../stringLiteralTypesAsTags01.errors.txt | 32 +---- .../reference/stringLiteralTypesAsTags01.js | 20 ++- ...tringLiteralTypesInUnionTypes01.errors.txt | 48 ++----- .../stringLiteralTypesInUnionTypes01.js | 10 +- ...tringLiteralTypesInUnionTypes02.errors.txt | 62 --------- .../stringLiteralTypesInUnionTypes02.js | 10 +- .../stringLiteralTypesInUnionTypes02.symbols | 52 ++++++++ .../stringLiteralTypesInUnionTypes02.types | 62 +++++++++ ...tringLiteralTypesInUnionTypes03.errors.txt | 40 ++---- .../stringLiteralTypesInUnionTypes03.js | 9 +- ...tringLiteralTypesInUnionTypes04.errors.txt | 24 ++-- .../stringLiteralTypesInUnionTypes04.js | 7 +- ...alTypesInVariableDeclarations01.errors.txt | 97 ++++++-------- ...ingLiteralTypesInVariableDeclarations01.js | 27 ++-- .../stringLiteralTypesOverloads01.errors.txt | 98 ++------------- .../stringLiteralTypesOverloads01.js | 29 ++++- .../stringLiteralTypesOverloads02.errors.txt | 83 ++---------- .../stringLiteralTypesOverloads02.js | 27 +++- ...ingLiteralTypesTypePredicates01.errors.txt | 39 ++---- .../stringLiteralTypesTypePredicates01.js | 10 +- ...gumentsWithStringLiteralTypes01.errors.txt | 119 +++++++++--------- .../typeArgumentsWithStringLiteralTypes01.js | 33 ++++- 30 files changed, 609 insertions(+), 555 deletions(-) delete mode 100644 tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.errors.txt create mode 100644 tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols create mode 100644 tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types delete mode 100644 tests/baselines/reference/stringLiteralType.errors.txt create mode 100644 tests/baselines/reference/stringLiteralType.symbols create mode 100644 tests/baselines/reference/stringLiteralType.types delete mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes02.types diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.errors.txt b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.errors.txt deleted file mode 100644 index 707e68c2c45..00000000000 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable1.ts(12,21): error TS1110: Type expected. - - -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable1.ts (1 errors) ==== - // Interface - interface IPoint { - getDist(): number; - } - - // Module - module Shapes { - - // Class - export class Point implements IPoint { - - public con: "hello"; - ~~~~~~~ -!!! error TS1110: Type expected. - // Constructor - constructor (public x: number, public y: number) { } - - // Instance member - getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } - - // Static member - static origin = new Point(0, 0); - } - - } - - // Local variables - var p: IPoint = new Shapes.Point(3, 4); - var dist = p.getDist(); - \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index ae2509c3f49..8055cd9d494 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -38,7 +38,6 @@ var Shapes; function Point(x, y) { this.x = x; this.y = y; - this.con = "hello"; } // Instance member Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols new file mode 100644 index 00000000000..db9cefbf642 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols @@ -0,0 +1,67 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable1.ts === +// Interface +interface IPoint { +>IPoint : Symbol(IPoint, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 0, 0)) + + getDist(): number; +>getDist : Symbol(getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 1, 18)) +} + +// Module +module Shapes { +>Shapes : Symbol(Shapes, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 3, 1)) + + // Class + export class Point implements IPoint { +>Point : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>IPoint : Symbol(IPoint, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 0, 0)) + + public con: "hello"; +>con : Symbol(con, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 9, 42)) + + // Constructor + constructor (public x: number, public y: number) { } +>x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +>getDist : Symbol(getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 60)) +>Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, 620, 27)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11)) +>sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, 620, 27)) +>this.x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this.x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this.y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>this.y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) + + // Static member + static origin = new Point(0, 0); +>origin : Symbol(Point.origin, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 16, 74)) +>Point : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) + } + +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +>p : Symbol(p, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 25, 3)) +>IPoint : Symbol(IPoint, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 0, 0)) +>Shapes.Point : Symbol(Shapes.Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) +>Shapes : Symbol(Shapes, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 3, 1)) +>Point : Symbol(Shapes.Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) + +var dist = p.getDist(); +>dist : Symbol(dist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 26, 3)) +>p.getDist : Symbol(IPoint.getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 1, 18)) +>p : Symbol(p, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 25, 3)) +>getDist : Symbol(IPoint.getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 1, 18)) + diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types new file mode 100644 index 00000000000..bb51151cfd7 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable1.ts === +// Interface +interface IPoint { +>IPoint : IPoint + + getDist(): number; +>getDist : () => number +} + +// Module +module Shapes { +>Shapes : typeof Shapes + + // Class + export class Point implements IPoint { +>Point : Point +>IPoint : IPoint + + public con: "hello"; +>con : "hello" + + // Constructor + constructor (public x: number, public y: number) { } +>x : number +>y : number + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +>getDist : () => number +>Math.sqrt(this.x * this.x + this.y * this.y) : number +>Math.sqrt : (x: number) => number +>Math : Math +>sqrt : (x: number) => number +>this.x * this.x + this.y * this.y : number +>this.x * this.x : number +>this.x : number +>this : Point +>x : number +>this.x : number +>this : Point +>x : number +>this.y * this.y : number +>this.y : number +>this : Point +>y : number +>this.y : number +>this : Point +>y : number + + // Static member + static origin = new Point(0, 0); +>origin : Point +>new Point(0, 0) : Point +>Point : typeof Point +>0 : number +>0 : number + } + +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +>p : IPoint +>IPoint : IPoint +>new Shapes.Point(3, 4) : Shapes.Point +>Shapes.Point : typeof Shapes.Point +>Shapes : typeof Shapes +>Point : typeof Shapes.Point +>3 : number +>4 : number + +var dist = p.getDist(); +>dist : number +>p.getDist() : number +>p.getDist : () => number +>p : IPoint +>getDist : () => number + diff --git a/tests/baselines/reference/stringLiteralType.errors.txt b/tests/baselines/reference/stringLiteralType.errors.txt deleted file mode 100644 index 275db139cf7..00000000000 --- a/tests/baselines/reference/stringLiteralType.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/types/primitives/stringLiteral/stringLiteralType.ts(1,8): error TS1110: Type expected. - - -==== tests/cases/conformance/types/primitives/stringLiteral/stringLiteralType.ts (1 errors) ==== - var x: 'hi'; - ~~~~ -!!! error TS1110: Type expected. - - function f(x: 'hi'); - function f(x: string); - function f(x: any) { - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralType.js b/tests/baselines/reference/stringLiteralType.js index 35f35f1cbef..a6926453c47 100644 --- a/tests/baselines/reference/stringLiteralType.js +++ b/tests/baselines/reference/stringLiteralType.js @@ -7,6 +7,6 @@ function f(x: any) { } //// [stringLiteralType.js] -var x = 'hi'; +var x; function f(x) { } diff --git a/tests/baselines/reference/stringLiteralType.symbols b/tests/baselines/reference/stringLiteralType.symbols new file mode 100644 index 00000000000..687d3052442 --- /dev/null +++ b/tests/baselines/reference/stringLiteralType.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/types/primitives/stringLiteral/stringLiteralType.ts === +var x: 'hi'; +>x : Symbol(x, Decl(stringLiteralType.ts, 0, 3)) + +function f(x: 'hi'); +>f : Symbol(f, Decl(stringLiteralType.ts, 0, 12), Decl(stringLiteralType.ts, 2, 20), Decl(stringLiteralType.ts, 3, 22)) +>x : Symbol(x, Decl(stringLiteralType.ts, 2, 11)) + +function f(x: string); +>f : Symbol(f, Decl(stringLiteralType.ts, 0, 12), Decl(stringLiteralType.ts, 2, 20), Decl(stringLiteralType.ts, 3, 22)) +>x : Symbol(x, Decl(stringLiteralType.ts, 3, 11)) + +function f(x: any) { +>f : Symbol(f, Decl(stringLiteralType.ts, 0, 12), Decl(stringLiteralType.ts, 2, 20), Decl(stringLiteralType.ts, 3, 22)) +>x : Symbol(x, Decl(stringLiteralType.ts, 4, 11)) +} diff --git a/tests/baselines/reference/stringLiteralType.types b/tests/baselines/reference/stringLiteralType.types new file mode 100644 index 00000000000..5d2e13c4ba5 --- /dev/null +++ b/tests/baselines/reference/stringLiteralType.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/types/primitives/stringLiteral/stringLiteralType.ts === +var x: 'hi'; +>x : 'hi' + +function f(x: 'hi'); +>f : { (x: 'hi'): any; (x: string): any; } +>x : 'hi' + +function f(x: string); +>f : { (x: 'hi'): any; (x: string): any; } +>x : string + +function f(x: any) { +>f : { (x: 'hi'): any; (x: string): any; } +>x : any +} diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt index 292cc8ea5b7..df05e25304f 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt @@ -1,30 +1,15 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,12): error TS4081: Exported type alias 'Kind' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,13): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(2,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(9,10): error TS4033: Property 'kind' of exported interface has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(9,11): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(14,10): error TS4033: Property 'kind' of exported interface has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(14,11): error TS1110: Type expected. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(18,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(20,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(22,21): error TS2304: Cannot find name 'is'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. - Property '"A"' is missing in type '{ kind: string; a: number; }'. + Types of property 'kind' are incompatible. + Type 'string' is not assignable to type '"A"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (13 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (5 errors) ==== type Kind = "A" | "B" - -!!! error TS4081: Exported type alias 'Kind' has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. - ~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. interface Entity { kind: Kind; @@ -32,19 +17,11 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): interface A extends Entity { kind: "A"; - -!!! error TS4033: Property 'kind' of exported interface has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. a: number; } interface B extends Entity { kind: "B"; - -!!! error TS4033: Property 'kind' of exported interface has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. b: string; } @@ -66,7 +43,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): let x: A = { ~ !!! error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. -!!! error TS2322: Property '"A"' is missing in type '{ kind: string; a: number; }'. +!!! error TS2322: Types of property 'kind' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type '"A"'. kind: "A", a: 100, } diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.js b/tests/baselines/reference/stringLiteralTypesAsTags01.js index 2ce20607790..3fe33ace487 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags01.js +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.js @@ -43,7 +43,6 @@ else { } //// [stringLiteralTypesAsTags01.js] -"A" | "B"; function hasKind(entity, kind) { return kind === is; } @@ -63,3 +62,22 @@ if (!hasKind(x, "B")) { else { var d = x; } + + +//// [stringLiteralTypesAsTags01.d.ts] +declare type Kind = "A" | "B"; +interface Entity { + kind: Kind; +} +interface A extends Entity { + kind: "A"; + a: number; +} +interface B extends Entity { + kind: "B"; + b: string; +} +declare function hasKind(entity: Entity, kind: "A"): entity is A; +declare function hasKind(entity: Entity, kind: "B"): entity is B; +declare function hasKind(entity: Entity, kind: Kind): entity is Entity; +declare let x: A; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt index fcc13629ceb..14d0a892f55 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt @@ -1,47 +1,21 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,9): error TS4081: Exported type alias 'T' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,10): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(2,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,30): error TS1005: ',' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,32): error TS1134: Variable declaration expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,5): error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. + Type 'string' is not assignable to type '"baz"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(5,5): error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. + Type 'string' is not assignable to type '"baz"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts (12 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts (2 errors) ==== type T = "foo" | "bar" | "baz"; - -!!! error TS4081: Exported type alias 'T' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x: "foo" | "bar" | "baz" = "foo"; - -!!! error TS4025: Exported variable 'x' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! error TS1005: ',' expected. - ~~~~~ -!!! error TS1134: Variable declaration expected. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. +!!! error TS2322: Type 'string' is not assignable to type '"baz"'. var y: T = "bar"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. +!!! error TS2322: Type 'string' is not assignable to type '"baz"'. if (x === "foo") { let a = x; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js index 4eaaec42ceb..d970310d68e 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js @@ -21,9 +21,7 @@ x = y; y = x; //// [stringLiteralTypesInUnionTypes01.js] -"foo" | "bar" | "baz"; -var x = "foo" | "bar" | "baz"; -"foo"; +var x = "foo"; var y = "bar"; if (x === "foo") { var a = x; @@ -38,3 +36,9 @@ else { } x = y; y = x; + + +//// [stringLiteralTypesInUnionTypes01.d.ts] +declare type T = "foo" | "bar" | "baz"; +declare var x: "foo" | "bar" | "baz"; +declare var y: T; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt deleted file mode 100644 index dc8523051aa..00000000000 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.errors.txt +++ /dev/null @@ -1,62 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,18): error TS4081: Exported type alias 'T' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,19): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,19): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(2,35): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,32): error TS2304: Cannot find name 'string'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,39): error TS1005: ',' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts(4,41): error TS1134: Variable declaration expected. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts (13 errors) ==== - - type T = string | "foo" | "bar" | "baz"; - -!!! error TS4081: Exported type alias 'T' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - - var x: "foo" | "bar" | "baz" | string = "foo"; - -!!! error TS4025: Exported variable 'x' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. - ~ -!!! error TS1005: ',' expected. - ~~~~~ -!!! error TS1134: Variable declaration expected. - var y: T = "bar"; - - if (x === "foo") { - let a = x; - } - else if (x !== "bar") { - let b = x || y; - } - else { - let c = x; - let d = y; - let e: (typeof x) | (typeof y) = c || d; - } - - x = y; - y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js index 19b309980f8..19b9c837c9d 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js @@ -21,9 +21,7 @@ x = y; y = x; //// [stringLiteralTypesInUnionTypes02.js] -"foo" | "bar" | "baz"; -var x = "foo" | "bar" | "baz" | string; -"foo"; +var x = "foo"; var y = "bar"; if (x === "foo") { var a = x; @@ -38,3 +36,9 @@ else { } x = y; y = x; + + +//// [stringLiteralTypesInUnionTypes02.d.ts] +declare type T = string | "foo" | "bar" | "baz"; +declare var x: "foo" | "bar" | "baz" | string; +declare var y: T; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols new file mode 100644 index 00000000000..c9b31dc710a --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts === + +type T = string | "foo" | "bar" | "baz"; +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes02.ts, 0, 0)) + +var x: "foo" | "bar" | "baz" | string = "foo"; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) + +var y: T = "bar"; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes02.ts, 0, 0)) + +if (x === "foo") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesInUnionTypes02.ts, 7, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) +} +else if (x !== "bar") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) + + let b = x || y; +>b : Symbol(b, Decl(stringLiteralTypesInUnionTypes02.ts, 10, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) +} +else { + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes02.ts, 13, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) + + let d = y; +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes02.ts, 14, 7)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) + + let e: (typeof x) | (typeof y) = c || d; +>e : Symbol(e, Decl(stringLiteralTypesInUnionTypes02.ts, 15, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes02.ts, 13, 7)) +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes02.ts, 14, 7)) +} + +x = y; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) + +y = x; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types new file mode 100644 index 00000000000..569edc77815 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types @@ -0,0 +1,62 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts === + +type T = string | "foo" | "bar" | "baz"; +>T : string | "foo" | "bar" | "baz" + +var x: "foo" | "bar" | "baz" | string = "foo"; +>x : "foo" | "bar" | "baz" | string +>"foo" : string + +var y: T = "bar"; +>y : string | "foo" | "bar" | "baz" +>T : string | "foo" | "bar" | "baz" +>"bar" : string + +if (x === "foo") { +>x === "foo" : boolean +>x : "foo" | "bar" | "baz" | string +>"foo" : string + + let a = x; +>a : "foo" | "bar" | "baz" | string +>x : "foo" | "bar" | "baz" | string +} +else if (x !== "bar") { +>x !== "bar" : boolean +>x : "foo" | "bar" | "baz" | string +>"bar" : string + + let b = x || y; +>b : string +>x || y : string +>x : "foo" | "bar" | "baz" | string +>y : string | "foo" | "bar" | "baz" +} +else { + let c = x; +>c : "foo" | "bar" | "baz" | string +>x : "foo" | "bar" | "baz" | string + + let d = y; +>d : string | "foo" | "bar" | "baz" +>y : string | "foo" | "bar" | "baz" + + let e: (typeof x) | (typeof y) = c || d; +>e : "foo" | "bar" | "baz" | string +>x : "foo" | "bar" | "baz" | string +>y : string | "foo" | "bar" | "baz" +>c || d : string +>c : "foo" | "bar" | "baz" | string +>d : string | "foo" | "bar" | "baz" +} + +x = y; +>x = y : string | "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" | string +>y : string | "foo" | "bar" | "baz" + +y = x; +>y = x : "foo" | "bar" | "baz" | string +>y : string | "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" | string + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt index 1595c625322..8ff377b2e72 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt @@ -1,43 +1,27 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,18): error TS4081: Exported type alias 'T' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,19): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,19): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(2,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,7): error TS4025: Exported variable 'x' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,8): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(4,24): error TS2304: Cannot find name 'number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(5,5): error TS2322: Type 'string' is not assignable to type 'number | "foo" | "bar"'. + Type 'string' is not assignable to type '"bar"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(7,5): error TS2365: Operator '===' cannot be applied to types '"foo" | "bar" | number' and 'string'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(10,10): error TS2365: Operator '!==' cannot be applied to types '"foo" | "bar" | number' and 'string'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (9 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (3 errors) ==== type T = number | "foo" | "bar"; - -!!! error TS4081: Exported type alias 'T' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x: "foo" | "bar" | number; - -!!! error TS4025: Exported variable 'x' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~ -!!! error TS2304: Cannot find name 'number'. var y: T = "bar"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number | "foo" | "bar"'. +!!! error TS2322: Type 'string' is not assignable to type '"bar"'. if (x === "foo") { + ~~~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '"foo" | "bar" | number' and 'string'. let a = x; } else if (x !== "bar") { + ~~~~~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types '"foo" | "bar" | number' and 'string'. let b = x || y; } else { diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js index 7705848be2b..f6728e0b2fb 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js @@ -21,8 +21,7 @@ x = y; y = x; //// [stringLiteralTypesInUnionTypes03.js] -"foo" | "bar"; -var x = "foo" | "bar" | number; +var x; var y = "bar"; if (x === "foo") { var a = x; @@ -37,3 +36,9 @@ else { } x = y; y = x; + + +//// [stringLiteralTypesInUnionTypes03.d.ts] +declare type T = number | "foo" | "bar"; +declare var x: "foo" | "bar" | number; +declare var y: T; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt index 66d3e215237..77cb9c09531 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt @@ -1,23 +1,21 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,9): error TS4081: Exported type alias 'T' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,10): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(2,15): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(4,5): error TS2322: Type 'string' is not assignable to type '"" | "foo"'. + Type 'string' is not assignable to type '"foo"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(5,5): error TS2322: Type 'string' is not assignable to type '"" | "foo"'. + Type 'string' is not assignable to type '"foo"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts (4 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts (2 errors) ==== type T = "" | "foo"; - -!!! error TS4081: Exported type alias 'T' has or is using private name ''. - ~~ -!!! error TS1110: Type expected. - ~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. let x: T = ""; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"" | "foo"'. +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. let y: T = "foo"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"" | "foo"'. +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. if (x === "") { let a = x; diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js index 5817d16ec8f..dc6cf51ad1e 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js @@ -38,7 +38,6 @@ if (!!!x) { } //// [stringLiteralTypesInUnionTypes04.js] -"" | "foo"; var x = ""; var y = "foo"; if (x === "") { @@ -65,3 +64,9 @@ if (!!x) { if (!!!x) { var h = x; } + + +//// [stringLiteralTypesInUnionTypes04.d.ts] +declare type T = "" | "foo"; +declare let x: T; +declare let y: T; diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt index 14233db44cd..3dd2adbbce0 100644 --- a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt @@ -1,81 +1,54 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(2,7): error TS4025: Exported variable 'a' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(2,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(3,7): error TS4025: Exported variable 'b' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(3,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(4,7): error TS4025: Exported variable 'c' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(4,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,9): error TS4025: Exported variable 'd' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,10): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,7): error TS4025: Exported variable 'e' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,8): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,7): error TS4025: Exported variable 'f' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,8): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,7): error TS4025: Exported variable 'g' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,8): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,8): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,9): error TS4025: Exported variable 'h' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,10): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,10): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(7,1): error TS2322: Type 'string' is not assignable to type '""'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(8,1): error TS2322: Type 'string' is not assignable to type '"foo"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(9,1): error TS2322: Type 'string' is not assignable to type '"bar"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,5): error TS2322: Type 'string' is not assignable to type '""'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,5): error TS2322: Type 'string' is not assignable to type '"foo"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,5): error TS2322: Type 'string' is not assignable to type '"bar"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,7): error TS2322: Type 'string' is not assignable to type '"baz"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(16,1): error TS2322: Type 'string' is not assignable to type '""'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(17,1): error TS2322: Type 'string' is not assignable to type '"foo"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(18,1): error TS2322: Type 'string' is not assignable to type '"bar"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (20 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (11 errors) ==== let a: ""; - -!!! error TS4025: Exported variable 'a' has or is using private name ''. - ~~ -!!! error TS1110: Type expected. var b: "foo"; - -!!! error TS4025: Exported variable 'b' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. let c: "bar"; - -!!! error TS4025: Exported variable 'c' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. const d: "baz"; - -!!! error TS4025: Exported variable 'd' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. + ~ +!!! error TS1155: 'const' declarations must be initialized a = ""; + ~ +!!! error TS2322: Type 'string' is not assignable to type '""'. b = "foo"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. c = "bar"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"bar"'. let e: "" = ""; - -!!! error TS4025: Exported variable 'e' has or is using private name ''. - ~~ -!!! error TS1110: Type expected. - ~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~ +!!! error TS2322: Type 'string' is not assignable to type '""'. var f: "foo" = "foo"; - -!!! error TS4025: Exported variable 'f' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. let g: "bar" = "bar"; - -!!! error TS4025: Exported variable 'g' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"bar"'. const h: "baz" = "baz"; - -!!! error TS4025: Exported variable 'h' has or is using private name ''. - ~~~~~ -!!! error TS1110: Type expected. - ~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"baz"'. e = ""; + ~ +!!! error TS2322: Type 'string' is not assignable to type '""'. f = "foo"; - g = "bar"; \ No newline at end of file + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. + g = "bar"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"bar"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js index 4aae2a2438a..15a4ca5d580 100644 --- a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.js @@ -19,17 +19,28 @@ f = "foo"; g = "bar"; //// [stringLiteralTypesInVariableDeclarations01.js] -var a = ""; -var b = "foo"; -var c = "bar"; -var d = "baz"; +var a; +var b; +var c; +var d; a = ""; b = "foo"; c = "bar"; -var e = "" = ""; -var f = "foo" = "foo"; -var g = "bar" = "bar"; -var h = "baz" = "baz"; +var e = ""; +var f = "foo"; +var g = "bar"; +var h = "baz"; e = ""; f = "foo"; g = "bar"; + + +//// [stringLiteralTypesInVariableDeclarations01.d.ts] +declare let a: ""; +declare var b: "foo"; +declare let c: "bar"; +declare const d: "baz"; +declare let e: ""; +declare var f: "foo"; +declare let g: "bar"; +declare const h: "baz"; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt index e41de718dfa..378857dc277 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt @@ -1,86 +1,20 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,21): error TS4081: Exported type alias 'PrimitiveName' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,22): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,22): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,33): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(2,44): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(7,41): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(8,41): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(9,40): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(10,40): error TS1005: '=' expected. tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(11,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,14): error TS4025: Exported variable 'string' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,15): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,15): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,14): error TS4025: Exported variable 'number' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,15): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,15): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,15): error TS4025: Exported variable 'boolean' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,16): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,16): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,7): error TS2322: Type 'string' is not assignable to type '"string"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,7): error TS2322: Type 'string' is not assignable to type ''number''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,7): error TS2322: Type 'string' is not assignable to type '"boolean"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (30 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (4 errors) ==== type PrimitiveName = 'string' | 'number' | 'boolean'; - -!!! error TS4081: Exported type alias 'PrimitiveName' has or is using private name ''. - ~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. function getFalsyPrimitive(x: "string"): string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "number"): number; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "boolean"): boolean; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "number" | "string"): number | string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: PrimitiveName) { ~~~~~~~~~~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. @@ -105,26 +39,14 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34, } const string: "string" = "string" - -!!! error TS4025: Exported variable 'string' has or is using private name ''. - ~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"string"'. const number: "number" = "number" - -!!! error TS4025: Exported variable 'number' has or is using private name ''. - ~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type ''number''. const boolean: "boolean" = "boolean" - -!!! error TS4025: Exported variable 'boolean' has or is using private name ''. - ~~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"boolean"'. const stringOrNumber = string || number; const stringOrBoolean = string || boolean; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.js b/tests/baselines/reference/stringLiteralTypesOverloads01.js index a001f02c9c9..23483776a9b 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.js +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.js @@ -54,7 +54,6 @@ namespace Consts2 { //// [stringLiteralTypesOverloads01.js] -'string' | 'number' | 'boolean'; function getFalsyPrimitive(x) { if (x === "string") { return ""; @@ -74,9 +73,9 @@ var Consts1; var ZERO = getFalsyPrimitive('number'); var FALSE = getFalsyPrimitive("boolean"); })(Consts1 || (Consts1 = {})); -var string = "string" = "string"; -var number = "number" = "number"; -var boolean = "boolean" = "boolean"; +var string = "string"; +var number = "number"; +var boolean = "boolean"; var stringOrNumber = string || number; var stringOrBoolean = string || boolean; var booleanOrNumber = number || boolean; @@ -91,3 +90,25 @@ var Consts2; var c = getFalsyPrimitive(booleanOrNumber); var d = getFalsyPrimitive(stringOrBooleanOrNumber); })(Consts2 || (Consts2 = {})); + + +//// [stringLiteralTypesOverloads01.d.ts] +declare type PrimitiveName = 'string' | 'number' | 'boolean'; +declare function getFalsyPrimitive(x: "string"): string; +declare function getFalsyPrimitive(x: "number"): number; +declare function getFalsyPrimitive(x: "boolean"): boolean; +declare function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +declare function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +declare function getFalsyPrimitive(x: "number" | "string"): number | string; +declare function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +declare namespace Consts1 { +} +declare const string: "string"; +declare const number: "number"; +declare const boolean: "boolean"; +declare const stringOrNumber: "string" | 'number'; +declare const stringOrBoolean: "string" | "boolean"; +declare const booleanOrNumber: 'number' | "boolean"; +declare const stringOrBooleanOrNumber: "string" | "boolean" | 'number'; +declare namespace Consts2 { +} diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt index ff1e212c071..ae9fb9ce4f6 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt @@ -1,69 +1,18 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(3,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(5,41): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(6,41): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(7,40): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,28): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(8,40): error TS1005: '=' expected. tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(9,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,14): error TS4025: Exported variable 'string' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,15): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,15): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,14): error TS4025: Exported variable 'number' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,15): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,15): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,15): error TS4025: Exported variable 'boolean' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,16): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,16): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,7): error TS2322: Type 'string' is not assignable to type '"string"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,7): error TS2322: Type 'string' is not assignable to type '"number"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,7): error TS2322: Type 'string' is not assignable to type '"boolean"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (25 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (4 errors) ==== function getFalsyPrimitive(x: "string"): string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "number"): number; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "boolean"): boolean; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "number" | "string"): number | string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; - ~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. function getFalsyPrimitive(x: string) { ~~~~~~~~~~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. @@ -88,26 +37,14 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32, } const string: "string" = "string" - -!!! error TS4025: Exported variable 'string' has or is using private name ''. - ~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"string"'. const number: "number" = "number" - -!!! error TS4025: Exported variable 'number' has or is using private name ''. - ~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"number"'. const boolean: "boolean" = "boolean" - -!!! error TS4025: Exported variable 'boolean' has or is using private name ''. - ~~~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"boolean"'. const stringOrNumber = string || number; const stringOrBoolean = string || boolean; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.js b/tests/baselines/reference/stringLiteralTypesOverloads02.js index ae38acebb95..3c53f9380a8 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads02.js +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.js @@ -71,9 +71,9 @@ var Consts1; var ZERO = getFalsyPrimitive('number'); var FALSE = getFalsyPrimitive("boolean"); })(Consts1 || (Consts1 = {})); -var string = "string" = "string"; -var number = "number" = "number"; -var boolean = "boolean" = "boolean"; +var string = "string"; +var number = "number"; +var boolean = "boolean"; var stringOrNumber = string || number; var stringOrBoolean = string || boolean; var booleanOrNumber = number || boolean; @@ -88,3 +88,24 @@ var Consts2; var c = getFalsyPrimitive(booleanOrNumber); var d = getFalsyPrimitive(stringOrBooleanOrNumber); })(Consts2 || (Consts2 = {})); + + +//// [stringLiteralTypesOverloads02.d.ts] +declare function getFalsyPrimitive(x: "string"): string; +declare function getFalsyPrimitive(x: "number"): number; +declare function getFalsyPrimitive(x: "boolean"): boolean; +declare function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; +declare function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; +declare function getFalsyPrimitive(x: "number" | "string"): number | string; +declare function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; +declare namespace Consts1 { +} +declare const string: "string"; +declare const number: "number"; +declare const boolean: "boolean"; +declare const stringOrNumber: "string" | "number"; +declare const stringOrBoolean: "string" | "boolean"; +declare const booleanOrNumber: "number" | "boolean"; +declare const stringOrBooleanOrNumber: "string" | "boolean" | "number"; +declare namespace Consts2 { +} diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt index a4cc525cdd2..3e412a6c770 100644 --- a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt @@ -1,46 +1,27 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,12): error TS4081: Exported type alias 'Kind' has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,13): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(2,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,46): error TS4060: Return type of exported function has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,47): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,46): error TS4060: Return type of exported function has or is using private name ''. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,47): error TS1110: Type expected. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(10,5): error TS2322: Type 'string' is not assignable to type '"A" | "B"'. + Type 'string' is not assignable to type '"B"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (10 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (3 errors) ==== type Kind = "A" | "B" - -!!! error TS4081: Exported type alias 'Kind' has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. - ~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. function kindIs(kind: Kind, is: "A"): kind is "A"; ~~~~~~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. - -!!! error TS4060: Return type of exported function has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function kindIs(kind: Kind, is: "B"): kind is "B"; ~~~~~~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. - -!!! error TS4060: Return type of exported function has or is using private name ''. - ~~~ -!!! error TS1110: Type expected. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function kindIs(kind: Kind, is: Kind): boolean { return kind === is; } var x: Kind = "A"; + ~ +!!! error TS2322: Type 'string' is not assignable to type '"A" | "B"'. +!!! error TS2322: Type 'string' is not assignable to type '"B"'. if (kindIs(x, "A")) { let a = x; diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.js b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js index 791caed9b31..fd4129d272d 100644 --- a/tests/baselines/reference/stringLiteralTypesTypePredicates01.js +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js @@ -25,9 +25,6 @@ else { } //// [stringLiteralTypesTypePredicates01.js] -"A" | "B"; -"A"; -"B"; function kindIs(kind, is) { return kind === is; } @@ -44,3 +41,10 @@ if (!kindIs(x, "B")) { else { var d = x; } + + +//// [stringLiteralTypesTypePredicates01.d.ts] +declare type Kind = "A" | "B"; +declare function kindIs(kind: Kind, is: "A"): kind is "A"; +declare function kindIs(kind: Kind, is: "B"): kind is "B"; +declare var x: Kind; diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt index 626d0e3d6f4..f6421445ae1 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -1,23 +1,19 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,48): error TS4060: Return type of exported function has or is using private name ''. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,49): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,39): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,52): error TS1005: '=' expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,63): error TS4060: Return type of exported function has or is using private name ''. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,64): error TS1110: Type expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,64): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(5,74): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(37,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(38,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(39,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(40,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(41,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(44,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(45,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(46,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(47,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(44,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(45,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(46,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(47,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. @@ -38,11 +34,16 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(70,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(71,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(72,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(76,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(78,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(79,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(76,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(78,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(79,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,34): error TS1134: Variable declaration expected. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. @@ -63,39 +64,26 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(102,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(103,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(107,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(108,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(109,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(110,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(111,30): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(107,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(108,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(109,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(110,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. + Type 'boolean' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(111,30): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello" | "World"'. + Type 'number' is not assignable to type '"World"'. -==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (70 errors) ==== +==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (61 errors) ==== declare function randBool(): boolean; declare function takeReturnString(str: string): string; declare function takeReturnHello(str: "Hello"): "Hello"; ~~~~~~~~~~~~~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - -!!! error TS4060: Return type of exported function has or is using private name ''. - ~~~~~~~ -!!! error TS1110: Type expected. declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. - ~ -!!! error TS1005: '=' expected. - -!!! error TS4060: Return type of exported function has or is using private name ''. - ~~~~~~~ -!!! error TS1110: Type expected. - ~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. function fun1(x: T, y: T) { return randBool() ? x : y; @@ -146,19 +134,24 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // Passing these as arguments should cause an error. a = takeReturnHelloWorld(a); ~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'string' is not assignable to type '"World"'. b = takeReturnHelloWorld(b); ~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'string' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); ~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'string' is not assignable to type '"World"'. d = takeReturnHelloWorld(d); ~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'string' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); ~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'string' is not assignable to type '"World"'. } namespace n2 { @@ -227,19 +220,24 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // Assignment from the returned value should cause an error. a = takeReturnHelloWorld(a); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. b = takeReturnHelloWorld(b); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. d = takeReturnHelloWorld(d); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. } @@ -309,17 +307,22 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // Both should be valid. a = takeReturnHelloWorld(a); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. b = takeReturnHelloWorld(b); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. d = takeReturnHelloWorld(d); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello" | "World"'. +!!! error TS2345: Type 'number' is not assignable to type '"World"'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js index 15c7cf5ef2d..e6e2b695a3b 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js @@ -113,8 +113,6 @@ namespace n3 { } //// [typeArgumentsWithStringLiteralTypes01.js] -"Hello"; -"Hello" | "World"; function fun1(x, y) { return randBool() ? x : y; } @@ -219,3 +217,34 @@ var n3; n3.d = takeReturnHelloWorld(n3.d); n3.e = takeReturnHelloWorld(n3.e); })(n3 || (n3 = {})); + + +//// [typeArgumentsWithStringLiteralTypes01.d.ts] +declare function randBool(): boolean; +declare function takeReturnString(str: string): string; +declare function takeReturnHello(str: "Hello"): "Hello"; +declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; +declare function fun1(x: T, y: T): T; +declare function fun2(x: T, y: U): T | U; +declare function fun3(...args: T[]): T; +declare namespace n1 { + let a: string; + let b: string; + let c: string; + let d: string; + let e: string; +} +declare namespace n2 { + let a: boolean; + let b: boolean; + let c: boolean; + let d: boolean; + let e: boolean; +} +declare namespace n3 { + let a: boolean; + let b: boolean; + let c: boolean; + let d: boolean; + let e: number; +} From dc0e368f824001d16bc7b22c7d0b8ac44305d924 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 16:45:48 -0700 Subject: [PATCH 008/140] Make string literals valid types in type lists. --- src/compiler/parser.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 769415dd94b..a9d7f94715b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2387,6 +2387,7 @@ namespace ts { case SyntaxKind.OpenBracketToken: case SyntaxKind.LessThanToken: case SyntaxKind.NewKeyword: + case SyntaxKind.StringLiteral: return true; case SyntaxKind.OpenParenToken: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, @@ -5446,6 +5447,7 @@ namespace ts { return parseTokenNode(); } + // TODO (drosen): Parse string literal types in JSDoc as well. return parseJSDocTypeReference(); } From 8891fba1498df42360b22faf5ac71753dcd4e0d2 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 16:47:31 -0700 Subject: [PATCH 009/140] Accepted baselines. --- ...gumentsWithStringLiteralTypes01.errors.txt | 222 +++++------------- .../typeArgumentsWithStringLiteralTypes01.js | 46 ++-- .../typeParameterConstraints1.errors.txt | 5 +- 3 files changed, 74 insertions(+), 199 deletions(-) diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt index f6421445ae1..413d2127003 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -14,69 +14,29 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. Type 'string' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(54,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(56,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(56,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,20): error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,20): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(62,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(64,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(65,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(68,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(69,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(70,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(71,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(72,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(76,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(78,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(79,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(86,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,20): error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,34): error TS1134: Variable declaration expected. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(90,20): error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(90,20): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(94,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(95,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(96,26): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(101,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(102,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(103,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(107,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(108,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(109,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(110,30): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. - Type 'boolean' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(111,30): error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello" | "World"'. - Type 'number' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. + Type '"World"' is not assignable to type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. + Type '"World"' is not assignable to type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. + Type 'string' is not assignable to type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. + Type '"World"' is not assignable to type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. + Type '"World"' is not assignable to type '"Hello"'. -==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (61 errors) ==== +==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (25 errors) ==== declare function randBool(): boolean; declare function takeReturnString(str: string): string; @@ -158,86 +118,47 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // The following (regardless of errors) should come back typed // as "Hello" (or "Hello" | "Hello"). export let a = fun1<"Hello">("Hello", "Hello"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. export let b = fun1<"Hello">("Hello", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: T) => T' and 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let c = fun2<"Hello", "Hello">("Hello", "Hello"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. export let d = fun2<"Hello", "Hello">("Hello", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let e = fun3<"Hello">("Hello", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. // Assignment from the returned value should cause an error. a = takeReturnString(a); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"Hello"'. b = takeReturnString(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. c = takeReturnString(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"Hello"'. d = takeReturnString(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. e = takeReturnString(e); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Should be valid a = takeReturnHello(a); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. b = takeReturnHello(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. c = takeReturnHello(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. d = takeReturnHello(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. e = takeReturnHello(e); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. // Assignment from the returned value should cause an error. a = takeReturnHelloWorld(a); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. + ~ +!!! error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. +!!! error TS2322: Type '"World"' is not assignable to type '"Hello"'. b = takeReturnHelloWorld(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. + ~ +!!! error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. +!!! error TS2322: Type '"World"' is not assignable to type '"Hello"'. d = takeReturnHelloWorld(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. } @@ -245,84 +166,47 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // The following (regardless of errors) should come back typed // as "Hello" | "World" (or "World" | "Hello"). export let a = fun2<"Hello", "World">("Hello", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. export let b = fun2<"Hello", "World">("World", "Hello"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let c = fun2<"World", "Hello">("Hello", "Hello"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. export let d = fun2<"World", "Hello">("World", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(x: T, y: U) => T | U' and 'string'. - ~~~~~~~ -!!! error TS1134: Variable declaration expected. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. export let e = fun3<"Hello" | "World">("Hello", "World"); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '(...args: T[]) => T' and 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. // Assignment from the returned value should cause an error. a = takeReturnString(a); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. +!!! error TS2322: Type 'string' is not assignable to type '"World"'. b = takeReturnString(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. c = takeReturnString(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. d = takeReturnString(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. e = takeReturnString(e); - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. +!!! error TS2322: Type 'string' is not assignable to type '"World"'. // Passing these as arguments should cause an error. a = takeReturnHello(a); ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Type '"World"' is not assignable to type '"Hello"'. b = takeReturnHello(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. c = takeReturnHello(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. d = takeReturnHello(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello"'. e = takeReturnHello(e); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Type '"World"' is not assignable to type '"Hello"'. // Both should be valid. a = takeReturnHelloWorld(a); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. b = takeReturnHelloWorld(b); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. d = takeReturnHelloWorld(d); - ~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'boolean' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'number' is not assignable to type '"World"'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js index e6e2b695a3b..c07dd225396 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.js @@ -159,13 +159,11 @@ var n2; (function (n2) { // The following (regardless of errors) should come back typed // as "Hello" (or "Hello" | "Hello"). - n2.a = fun1 < "Hello" > ("Hello", "Hello"); - n2.b = fun1 < "Hello" > ("Hello", "World"); - n2.c = fun2 < "Hello"; - "Hello" > ("Hello", "Hello"); - n2.d = fun2 < "Hello"; - "Hello" > ("Hello", "World"); - n2.e = fun3 < "Hello" > ("Hello", "World"); + n2.a = fun1("Hello", "Hello"); + n2.b = fun1("Hello", "World"); + n2.c = fun2("Hello", "Hello"); + n2.d = fun2("Hello", "World"); + n2.e = fun3("Hello", "World"); // Assignment from the returned value should cause an error. n2.a = takeReturnString(n2.a); n2.b = takeReturnString(n2.b); @@ -189,15 +187,11 @@ var n3; (function (n3) { // The following (regardless of errors) should come back typed // as "Hello" | "World" (or "World" | "Hello"). - n3.a = fun2 < "Hello"; - "World" > ("Hello", "World"); - n3.b = fun2 < "Hello"; - "World" > ("World", "Hello"); - n3.c = fun2 < "World"; - "Hello" > ("Hello", "Hello"); - n3.d = fun2 < "World"; - "Hello" > ("World", "World"); - n3.e = fun3 < "Hello" | "World" > ("Hello", "World"); + n3.a = fun2("Hello", "World"); + n3.b = fun2("World", "Hello"); + n3.c = fun2("Hello", "Hello"); + n3.d = fun2("World", "World"); + n3.e = fun3("Hello", "World"); // Assignment from the returned value should cause an error. n3.a = takeReturnString(n3.a); n3.b = takeReturnString(n3.b); @@ -235,16 +229,16 @@ declare namespace n1 { let e: string; } declare namespace n2 { - let a: boolean; - let b: boolean; - let c: boolean; - let d: boolean; - let e: boolean; + let a: "Hello"; + let b: any; + let c: "Hello"; + let d: any; + let e: any; } declare namespace n3 { - let a: boolean; - let b: boolean; - let c: boolean; - let d: boolean; - let e: number; + let a: "Hello" | "World"; + let b: any; + let c: any; + let d: any; + let e: "Hello" | "World"; } diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index f30fd4f6700..e837e19317d 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -1,12 +1,11 @@ tests/cases/compiler/typeParameterConstraints1.ts(6,25): error TS2304: Cannot find name 'hm'. -tests/cases/compiler/typeParameterConstraints1.ts(8,25): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(9,25): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(10,26): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(11,26): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot find name 'undefined'. -==== tests/cases/compiler/typeParameterConstraints1.ts (6 errors) ==== +==== tests/cases/compiler/typeParameterConstraints1.ts (5 errors) ==== function foo1(test: T) { } function foo2(test: T) { } function foo3(test: T) { } @@ -17,8 +16,6 @@ tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot f !!! error TS2304: Cannot find name 'hm'. function foo7(test: T) { } // valid function foo8(test: T) { } - ~~ -!!! error TS1110: Type expected. function foo9 (test: T) { } ~ !!! error TS1110: Type expected. From 82545ce8544cf0e24b278fa11c8afc8116de1c3c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 16:58:03 -0700 Subject: [PATCH 010/140] Added test for string types in tuples. --- .../stringLiteralTypesAndTuples01.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts new file mode 100644 index 00000000000..7ac9aa3b427 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts @@ -0,0 +1,20 @@ +// @declaration: true + +// Should all be strings. +let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; + +type RexOrRaptor = "t-rex" | "raptor" +let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; + +rawr(dinosaur); + +function rawr(dino: RexOrRaptor) { + if (dino === "t-rex") { + return "ROAAAAR!"; + } + if (dino === "raptor") { + return "yip yip!"; + } + + throw "Unexpected " + dino; +} \ No newline at end of file From ed927d8cf642065806f28bdc715f44cfc704872e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 1 Oct 2015 16:58:17 -0700 Subject: [PATCH 011/140] Accepted baselines. --- .../stringLiteralTypesAndTuples01.errors.txt | 32 ++++++++++++++ .../stringLiteralTypesAndTuples01.js | 42 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAndTuples01.js diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt b/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt new file mode 100644 index 00000000000..849f4922e45 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,5): error TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type '"I'm"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,37): error TS2304: Cannot find name 'Dinosaur'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (2 errors) ==== + + // Should all be strings. + let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; + + type RexOrRaptor = "t-rex" | "raptor" + let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; + ~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type '"I'm"'. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'Dinosaur'. + + rawr(dinosaur); + + function rawr(dino: RexOrRaptor) { + if (dino === "t-rex") { + return "ROAAAAR!"; + } + if (dino === "raptor") { + return "yip yip!"; + } + + throw "Unexpected " + dino; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.js b/tests/baselines/reference/stringLiteralTypesAndTuples01.js new file mode 100644 index 00000000000..66e57b1eea5 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.js @@ -0,0 +1,42 @@ +//// [stringLiteralTypesAndTuples01.ts] + +// Should all be strings. +let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; + +type RexOrRaptor = "t-rex" | "raptor" +let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; + +rawr(dinosaur); + +function rawr(dino: RexOrRaptor) { + if (dino === "t-rex") { + return "ROAAAAR!"; + } + if (dino === "raptor") { + return "yip yip!"; + } + + throw "Unexpected " + dino; +} + +//// [stringLiteralTypesAndTuples01.js] +// Should all be strings. +var _a = ["Hello", "Brave", "New", "World"], hello = _a[0], brave = _a[1], newish = _a[2], world = _a[3]; +var _b = ['I\'m', 'a', 't-rex'], im = _b[0], a = _b[1], dinosaur = _b[2]; +rawr(dinosaur); +function rawr(dino) { + if (dino === "t-rex") { + return "ROAAAAR!"; + } + if (dino === "raptor") { + return "yip yip!"; + } + throw "Unexpected " + dino; +} + + +//// [stringLiteralTypesAndTuples01.d.ts] +declare let hello: string, brave: string, newish: string, world: string; +declare type RexOrRaptor = "t-rex" | "raptor"; +declare let im: "I'm", a: "a", dinosaur: any; +declare function rawr(dino: RexOrRaptor): string; From 122753b50a4f87981dccda3a0dc65d0dfb3250fb Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 1 Oct 2015 19:23:12 -0700 Subject: [PATCH 012/140] sourcemap correctness --- src/compiler/emitter.ts | 17 ++++++++++---- src/compiler/program.ts | 51 ++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index df2687768fc..3a4b9a4a3bf 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -473,12 +473,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitSourceFile(root); } else { - forEach(host.getSourceFiles(), emitEmitHelpers); + if (modulekind) { + forEach(host.getSourceFiles(), emitEmitHelpers); + } forEach(host.getSourceFiles(), sourceFile => { if (!isExternalModuleOrDeclarationFile(sourceFile)) { emitSourceFile(sourceFile); } - else if (isExternalModule(sourceFile)) { + else if (modulekind && isExternalModule(sourceFile)) { emitConcatenatedModule(sourceFile); } }); @@ -499,7 +501,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi exportFunctionForFile = undefined; let canonicalName = resolveToSemiabsolutePath(sourceFile.fileName); sourceFile.moduleName = sourceFile.moduleName || canonicalName; - bundleEmitDelegates[modulekind](sourceFile, 0, /*resolvePath*/true); + emit(sourceFile); } function resolveToSemiabsolutePath(path: string): string { @@ -7051,8 +7053,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (isExternalModule(node) || compilerOptions.isolatedModules) { - let emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ModuleKind.CommonJS]; - emitModule(node, startIndex); + if (root) { + let emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ModuleKind.CommonJS]; + emitModule(node, startIndex); + } + else { + bundleEmitDelegates[modulekind](node, startIndex, /*resolvePath*/true); + } } else { externalImports = undefined; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b595d48dc57..f54906d85ee 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -377,6 +377,29 @@ namespace ts { } } + // there has to be common source directory if user specified --outdir || --sourceRoot + // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted + if (options.outDir || // there is --outDir specified + options.sourceRoot || // there is --sourceRoot specified + options.mapRoot) { // there is --mapRoot specified + + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + // Compute the commonSourceDirectory from the input files + commonSourceDirectory = computeCommonSourceDirectory(files); + } + + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += directorySeparator; + } + } + verifyCompilerOptions(); // unconditionally set oldProgram to undefined to prevent it from being captured in closure @@ -934,6 +957,10 @@ namespace ts { } }); + if (!commonPathComponents) { // Can happen when all input files are .d.ts files + return currentDirectory; + } + return getNormalizedPathFromPathComponents(commonPathComponents); } @@ -1036,30 +1063,6 @@ namespace ts { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } - // there has to be common source directory if user specified --outdir || --sourceRoot - // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted - if (options.outDir || // there is --outDir specified - options.sourceRoot || // there is --sourceRoot specified - (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated - (!outFile || firstExternalModuleSourceFile !== undefined))) { - - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - // If a rootDir is specified and is valid use it as the commonSourceDirectory - commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); - } - else { - // Compute the commonSourceDirectory from the input files - commonSourceDirectory = computeCommonSourceDirectory(files); - } - - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += directorySeparator; - } - } - if (options.noEmit) { if (options.out) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); From 8e409f34c71ef55b988bd3b68cbffe2ebc51fdd0 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 13:22:36 -0700 Subject: [PATCH 013/140] new baselines for sourcemaps tests (given that modules can now get emitted into single out) --- src/compiler/emitter.ts | 2 +- .../reference/getEmitOutputMapRoots.baseline | 4 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 18 - .../amd/bin/test.js | 33 -- .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 14 +- .../node/bin/test.d.ts | 18 - .../node/bin/test.js | 33 -- .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 14 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 14 + .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 14 + .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 44 ++ .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 29 + .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 29 + .../reference/project/prologueEmit/amd/out.js | 6 +- .../project/prologueEmit/node/out.js | 6 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 13 - .../amd/bin/test.js | 23 - .../amd/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 246 ++++++-- .../node/bin/test.d.ts | 13 - .../node/bin/test.js | 23 - .../node/bin/test.js.map | 2 +- ...edSubfolderSpecifyOutputFile.sourcemap.txt | 74 +-- .../amd/bin/outAndOutDirFile.d.ts | 13 - .../amd/bin/outAndOutDirFile.js | 23 - .../amd/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 246 ++++++-- .../node/bin/outAndOutDirFile.d.ts | 13 - .../node/bin/outAndOutDirFile.js | 23 - .../node/bin/outAndOutDirFile.js.map | 2 +- ...OutputFileAndOutputDirectory.sourcemap.txt | 74 +-- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 553 +++++++++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...MultifolderSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 2 +- .../amd/bin/test.d.ts | 0 .../amd/bin/test.js | 1 - .../amd/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 361 +++++++++++- .../node/bin/test.d.ts | 0 .../node/bin/test.js | 1 - .../node/bin/test.js.map | 2 +- ...leSubfolderSpecifyOutputFile.sourcemap.txt | 2 +- 342 files changed, 14323 insertions(+), 2713 deletions(-) delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3a4b9a4a3bf..52b8760bbd1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7053,7 +7053,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (isExternalModule(node) || compilerOptions.isolatedModules) { - if (root) { + if (root || (!isExternalModule(node) && compilerOptions.isolatedModules)) { let emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ModuleKind.CommonJS]; emitModule(node, startIndex); } diff --git a/tests/baselines/reference/getEmitOutputMapRoots.baseline b/tests/baselines/reference/getEmitOutputMapRoots.baseline index b4a4ace4d42..66130347d2d 100644 --- a/tests/baselines/reference/getEmitOutputMapRoots.baseline +++ b/tests/baselines/reference/getEmitOutputMapRoots.baseline @@ -1,6 +1,6 @@ EmitSkipped: false FileName : declSingleFile.js.map -{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB;IAAAA;IAGAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : declSingleFile.js +{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB;IAAAA;IAGAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : declSingleFile.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,4 +8,4 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=mapRootDir/declSingleFile.js.map +//# sourceMappingURL=tests/cases/fourslash/mapRootDir/declSingleFile.js.map diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 7ef36232b8d..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index a1d591a0497..94371fe696d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 133c266cc9e..ef882554ddb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:../../ref/m2.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:../ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:../ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:../test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 7ef36232b8d..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index a1d591a0497..a580c050d07 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 0b573b627cf..c6aeabde516 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:../../ref/m2.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:../test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index fc53d59d7cb..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 4f87045fd25..22aaecafe2d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index a9e2e3f0e3c..68630d9e431 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:../../ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:../ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:../ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:../test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index fc53d59d7cb..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 4f87045fd25..2eab0f87324 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index c4c267ec395..8f645dc8a2d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:../../ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:../test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 18e06e5bc50..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..c532c3846d9 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_module_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index da94013dea3..9384228ece5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:../../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../../outputdir_module_multifolder_ref/m2.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../../outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 18e06e5bc50..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..2974abdc1cc 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_module_multifolder_ref/m2.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index f348cfad93c..47e6fcc66ef 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:../../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../../outputdir_module_multifolder_ref/m2.ts,../test.ts =================================================================== >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index f6e3eb542f4..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..6377a26395e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 759b9dab302..ef240e21383 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map sourceRoot: -sources: +sources: ../m1.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index f6e3eb542f4..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..f491a9ec373 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 75228e5ea64..aa64e62c809 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map sourceRoot: -sources: +sources: ../m1.ts,../test.ts =================================================================== >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 7ff280253f1..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..f77c1351b15 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 18b397608e4..d6a44398f8e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 7ff280253f1..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..bfdacf69428 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 97c6b8a85e4..55f448a9c2f 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:../test.ts JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../test.ts =================================================================== >>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index c4c79e0454b..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index b63911a2bc8..ca8dd0934b5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/ref/m2.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index f1cc6df9de8..33ebe5aaafb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/test.ts +sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/ref/m2.ts,../outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:../outputdir_mixed_subfolder/ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../outputdir_mixed_subfolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:../outputdir_mixed_subfolder/ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index c4c79e0454b..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index b63911a2bc8..02be1ec09fb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/ref/m2.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 0a373a20359..d55115b85f2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/test.ts +sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/ref/m2.ts,../outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index c0138423cae..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 630508cb9f8..794d2a58176 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/ref/m2.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index fd08e128cfe..9932fdda3e9 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: ../../mapFiles/outAndOutDirFile.js.map sourceRoot: -sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/test.ts +sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/ref/m2.ts,../outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:../outputdir_mixed_subfolder/ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../outputdir_mixed_subfolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:../outputdir_mixed_subfolder/ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index c0138423cae..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 630508cb9f8..43710b5f061 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/ref/m2.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index eb9ad2993b2..89fba663c60 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: ../../mapFiles/outAndOutDirFile.js.map sourceRoot: -sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/test.ts +sources: ../outputdir_mixed_subfolder/ref/m1.ts,../outputdir_mixed_subfolder/ref/m2.ts,../outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index f359cef4be2..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..a7235c6c2b3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../projects/outputdir_module_multifolder/ref/m1.ts","../projects/outputdir_module_multifolder_ref/m2.ts","../projects/outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index c2eacec3bdc..2cbcfa7b2ce 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:../../projects/outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: ../../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../projects/outputdir_module_multifolder/ref/m1.ts,../projects/outputdir_module_multifolder_ref/m2.ts,../projects/outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../projects/outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../projects/outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../projects/outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index f359cef4be2..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..ca280b23052 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../projects/outputdir_module_multifolder/ref/m1.ts","../projects/outputdir_module_multifolder_ref/m2.ts","../projects/outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 1d6a282976d..e020f2716f7 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:../../projects/outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: ../../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../projects/outputdir_module_multifolder/ref/m1.ts,../projects/outputdir_module_multifolder_ref/m2.ts,../projects/outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 58e831a041d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..b94a5ff18e5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_simple/m1.ts","../outputdir_module_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 410dc94963f..8a95e1100a5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:../outputdir_module_simple/test.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../outputdir_module_simple/m1.ts,../outputdir_module_simple/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../outputdir_module_simple/m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../outputdir_module_simple/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 58e831a041d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..847236565f8 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_simple/m1.ts","../outputdir_module_simple/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 0af20dc5ef9..ffc11c547d2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:../outputdir_module_simple/test.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../outputdir_module_simple/m1.ts,../outputdir_module_simple/test.ts =================================================================== >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 58e831a041d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..ae6d9b42221 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_subfolder/ref/m1.ts","../outputdir_module_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index fe747e98d9c..25e76457d53 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:../outputdir_module_subfolder/test.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../outputdir_module_subfolder/ref/m1.ts,../outputdir_module_subfolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../outputdir_module_subfolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../outputdir_module_subfolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 58e831a041d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..b8c7cced3ae 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_subfolder/ref/m1.ts","../outputdir_module_subfolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 8f609cc28d9..4a7d5c7d49f 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:../outputdir_module_subfolder/test.ts JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: -sources: +sources: ../outputdir_module_subfolder/ref/m1.ts,../outputdir_module_subfolder/test.ts =================================================================== >>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d75277ac607..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var m2_a1: number; -declare class m2_c1 { - m2_c1_p1: number; -} -declare var m2_instance1: m2_c1; -declare function m2_f1(): m2_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 8fafee438e6..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,33 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -var m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -var m2_instance1 = new m2_c1(); -function m2_f1() { - return m2_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map index 03cefb2f8d3..fc3b27ea65c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../projects/outputdir_multifolder/ref/m1.ts","../projects/outputdir_multifolder_ref/m2.ts","../projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index d173bd36fb2..534e9184f7b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== JsFile: test.js -mapUrl: ../../mapFiles/test.js.map +mapUrl: ../../../mapFiles/test.js.map sourceRoot: -sources: ../outputdir_multifolder/ref/m1.ts,../outputdir_multifolder_ref/m2.ts,../outputdir_multifolder/test.ts +sources: ../projects/outputdir_multifolder/ref/m1.ts,../projects/outputdir_multifolder_ref/m2.ts,../projects/outputdir_multifolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder/ref/m1.ts +sourceFile:../projects/outputdir_multifolder/ref/m1.ts ------------------------------------------------------------------- >>>var m1_a1 = 10; 1 > @@ -143,7 +143,7 @@ sourceFile:../outputdir_multifolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder_ref/m2.ts +sourceFile:../projects/outputdir_multifolder_ref/m2.ts ------------------------------------------------------------------- >>>var m2_a1 = 10; 1-> @@ -280,7 +280,7 @@ sourceFile:../outputdir_multifolder_ref/m2.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder/test.ts +sourceFile:../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> @@ -427,11 +427,11 @@ sourceFile:../outputdir_multifolder/test.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} 1 >Emitted(32, 1) Source(11, 1) + SourceIndex(2) name (f1) 2 >Emitted(32, 2) Source(11, 2) + SourceIndex(2) name (f1) --- ->>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file +>>>//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d75277ac607..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var m2_a1: number; -declare class m2_c1 { - m2_c1_p1: number; -} -declare var m2_instance1: m2_c1; -declare function m2_f1(): m2_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 8fafee438e6..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,33 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -var m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -var m2_instance1 = new m2_c1(); -function m2_f1() { - return m2_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map index 03cefb2f8d3..fc3b27ea65c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../projects/outputdir_multifolder/ref/m1.ts","../projects/outputdir_multifolder_ref/m2.ts","../projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index d173bd36fb2..534e9184f7b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== JsFile: test.js -mapUrl: ../../mapFiles/test.js.map +mapUrl: ../../../mapFiles/test.js.map sourceRoot: -sources: ../outputdir_multifolder/ref/m1.ts,../outputdir_multifolder_ref/m2.ts,../outputdir_multifolder/test.ts +sources: ../projects/outputdir_multifolder/ref/m1.ts,../projects/outputdir_multifolder_ref/m2.ts,../projects/outputdir_multifolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder/ref/m1.ts +sourceFile:../projects/outputdir_multifolder/ref/m1.ts ------------------------------------------------------------------- >>>var m1_a1 = 10; 1 > @@ -143,7 +143,7 @@ sourceFile:../outputdir_multifolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder_ref/m2.ts +sourceFile:../projects/outputdir_multifolder_ref/m2.ts ------------------------------------------------------------------- >>>var m2_a1 = 10; 1-> @@ -280,7 +280,7 @@ sourceFile:../outputdir_multifolder_ref/m2.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js -sourceFile:../outputdir_multifolder/test.ts +sourceFile:../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> @@ -427,11 +427,11 @@ sourceFile:../outputdir_multifolder/test.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} 1 >Emitted(32, 1) Source(11, 1) + SourceIndex(2) name (f1) 2 >Emitted(32, 2) Source(11, 2) + SourceIndex(2) name (f1) --- ->>>//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file +>>>//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index af0071d7e46..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index df57785d945..c6996bb53b9 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 0c806666ef0..bd84417baa2 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts +sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index af0071d7e46..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index df57785d945..0b202d40b8c 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index aede30c6f73..7a04c10d333 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts +sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 2ebe138ffda..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index e7042dca90a..d78e3b4607a 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 5637274312d..bdeabb5ae19 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts +sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 2ebe138ffda..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index e7042dca90a..363ef3c21bf 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index fa3d5513061..33ade6d5e9d 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts +sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts,file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..211bf71cbed 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 1fce6af3084..b45d5fdd6ef 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts,file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts,file:///tests/cases/projects/outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..1c42486b782 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index aaf57c9d055..4dfb2e5d394 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts,file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts,file:///tests/cases/projects/outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..445268f27c1 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/m1.ts","file:///tests/cases/projects/outputdir_module_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 7c3fae48716..2268138862a 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:file:///tests/cases/projects/outputdir_module_simple/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_simple/m1.ts,file:///tests/cases/projects/outputdir_module_simple/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_simple/m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_simple/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..a7424e92122 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/m1.ts","file:///tests/cases/projects/outputdir_module_simple/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 804e4408446..889ac03323b 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:file:///tests/cases/projects/outputdir_module_simple/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_simple/m1.ts,file:///tests/cases/projects/outputdir_module_simple/test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..439677f8aba 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_module_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 894bcf6cef4..b547512c50d 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_module_subfolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..44276925bda 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_module_subfolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 9a7f754c534..3bb1f02d820 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: -sources: +sources: file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts,file:///tests/cases/projects/outputdir_module_subfolder/test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index af0071d7e46..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 7a70d18105c..37bb9be8a95 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 49c44cde80e..65ffacd46fc 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index af0071d7e46..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 7a70d18105c..a6626039aa2 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index d54d4d6245e..714864e506f 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 2ebe138ffda..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 53e31e30260..f3058d9f878 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 7793026dd6e..72dd27c642f 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 2ebe138ffda..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 53e31e30260..ba9f4ee590c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index a6deca12207..8284d795792 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..85e465474d3 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index deb74d2ae36..4eb71f2bf29 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..f84040526ba 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 5f476cfb8ed..77c5e460779 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..2ace469f902 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 8b526ff5859..6e3a046bb27 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..3b75f2878c9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index ff984bf74ee..d52a70d4dac 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..29e01bc0bc6 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 67e50350919..93d4a677676 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: ref/m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 52f1b822100..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..4409af8d0a7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index c5bce1a19d5..abdc3af24ca 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: ref/m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.js index ad3b4896eec..40bdaa24fc9 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -8,6 +8,20 @@ var m1_instance1 = new m1_c1(); function m1_f1() { return m1_instance1; } +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); /// /// var a1 = 10; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js index ad3b4896eec..40bdaa24fc9 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -8,6 +8,20 @@ var m1_instance1 = new m1_c1(); function m1_f1() { return m1_instance1; } +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); /// /// var a1 = 10; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js index e69de29bb2d..0814424ca39 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,44 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.js index e69de29bb2d..d07eebbd726 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,29 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.js index e69de29bb2d..a1bb15d7b35 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,29 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index fb0ca5dfac0..42313b7ce64 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,11 +1,11 @@ -var _this = this; -// Add a lambda to ensure global 'this' capture is triggered -(function () { return _this.window; }); var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +var _this = this; +// Add a lambda to ensure global 'this' capture is triggered +(function () { return _this.window; }); // class inheritance to ensure __extends is emitted var m; (function (m) { diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index fb0ca5dfac0..42313b7ce64 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,11 +1,11 @@ -var _this = this; -// Add a lambda to ensure global 'this' capture is triggered -(function () { return _this.window; }); var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; +var _this = this; +// Add a lambda to ensure global 'this' capture is triggered +(function () { return _this.window; }); // class inheritance to ensure __extends is emitted var m; (function (m) { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 65bbb0e67c2..3aa34b0f833 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index bbad2c102f9..06d778caf3a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 65bbb0e67c2..cf4a14ae9e9 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index c409dc99f14..631ec5abf3d 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 820efe6d9d1..454bdf3acb0 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 8536097d111..bda16ffe4e1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 820efe6d9d1..f7d00d1aff9 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 47e9f1da73a..d46f8d557ed 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index e53f2e0a755..0fd0b2def0c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index e1bca270ba0..3937e0acb04 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index e53f2e0a755..027f9569ebc 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 63e22ab64ba..1c069ce2390 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index 42e5a82e74b..a910369c3e4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 0fc6cd6eb2a..fab0c65ae8e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: +sources: m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map index 42e5a82e74b..487d57bd2ae 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 08491d50151..2da5935b483 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: +sources: m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index 279042a1a0f..30bac946d14 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 5e87f2ef555..15269d7fb80 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: +sources: ref/m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index 279042a1a0f..622f2c91c95 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 67fc9030f41..9bcf1436d51 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: +sources: ref/m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 86afcf32e25..62f932a571e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 94b86ffdde1..cbab02333cb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 86afcf32e25..03976e6a8d6 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 12a6fdbc6dd..e064f005473 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 13b958b1025..a9529891ffd 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 11e34ee5a2e..f2fc29c157e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: ../src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 13b958b1025..23957761470 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 5b9ec51c270..5690deb27df 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: ../src/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index 512eba0e11a..39dcc66e06b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 9c817da60e9..b2923025e73 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index 512eba0e11a..a3ab2ebecdb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index e34bffc6f61..c0077fe3214 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index 512eba0e11a..262e5cdc1f3 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index c259bb45210..97323d5d307 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map index 512eba0e11a..f55a72e7977 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 65bea50d84f..b38468c878d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index 512eba0e11a..dc294ebd160 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 7be1fe1fb8f..e754942b588 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: ref/m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index 512eba0e11a..f803a29f3bf 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 5a3d45c1960..7e4dd146e52 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ -sources: +sources: ref/m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index a1d591a0497..94371fe696d 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index b1d3f293b7e..23f10a2cf62 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:../ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:../ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:../test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index a1d591a0497..a580c050d07 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index 676e8f264ec..4bc6731c326 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:../test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 4f87045fd25..22aaecafe2d 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index a73c3b0852a..5a223fb7109 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:../../../ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:../ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:../ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:../ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:../test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 4f87045fd25..2eab0f87324 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 77ff10492be..b36bfbd8c56 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:../../../ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: -sources: ../ref/m1.ts,../test.ts +sources: ../ref/m1.ts,../ref/m2.ts,../test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:../test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:../test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:../test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:../test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:../test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:../test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:../test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:../test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..c532c3846d9 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_module_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt index 74ecef44103..3fa1bc7e057 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../../outputdir_module_multifolder_ref/m2.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../../outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..2974abdc1cc 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_module_multifolder_ref/m2.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt index f8d10678ca0..d36064b989c 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../../outputdir_module_multifolder_ref/m2.ts,../test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..6377a26395e 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt index a1646bc14e5..2d6e3052871 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../m1.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..f491a9ec373 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt index 4ff8b4fa8c7..c1334bd15ae 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../m1.ts,../test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index c1e0281a2ab..f77c1351b15 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt index d0abf20190f..c72d3084670 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:../test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index c1e0281a2ab..bfdacf69428 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt index 205f70497ad..9011abbae05 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: -sources: +sources: ../ref/m1.ts,../test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 7a70d18105c..37bb9be8a95 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index d4cac643490..d88a0d7585b 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/test.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index d61b4c3b876..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 5af28cf8560..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 7a70d18105c..a6626039aa2 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index cb96dcbf7d7..244cd8fafdf 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/test.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 53e31e30260..f3058d9f878 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index d54fa316273..5744420ab71 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -174,7 +174,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -306,7 +306,7 @@ sourceFile:ref/m1.ts >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} @@ -315,16 +315,182 @@ sourceFile:ref/m1.ts --- ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js +sourceFile:ref/m2.ts +------------------------------------------------------------------- +>>>define("ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1->export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1->Emitted(12, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(12, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(12, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(12, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(12, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(14, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(15, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(15, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(16, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(16, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(17, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(17, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(18, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(18, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(18, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(18, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(19, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(19, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(19, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(19, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(19, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(19, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(19, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(20, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(21, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(21, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(21, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(21, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(21, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(22, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(22, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(23, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(23, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(23, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(23, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/outAndOutDirFile.js sourceFile:test.ts ------------------------------------------------------------------- +>>>}); >>>/// -1-> +1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^-> -1-> +1 > 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1 >Emitted(25, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(25, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -332,8 +498,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(26, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(26, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -350,25 +516,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(27, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(27, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(27, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(27, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(27, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(27, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(28, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(29, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -378,16 +544,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(30, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(30, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(31, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(31, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -401,10 +567,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(32, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(32, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(32, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(32, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -425,21 +591,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(33, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(33, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(33, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(33, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(33, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(33, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(33, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(33, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(34, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -453,11 +619,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(35, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(35, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(35, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(35, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(35, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -466,7 +632,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(36, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(36, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts deleted file mode 100644 index 9b9cdd4a214..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -declare var m1_a1: number; -declare class m1_c1 { - m1_c1_p1: number; -} -declare var m1_instance1: m1_c1; -declare function m1_f1(): m1_c1; -declare var a1: number; -declare class c1 { - p1: number; -} -declare var instance1: c1; -declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js deleted file mode 100644 index 1750a5975ae..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js +++ /dev/null @@ -1,23 +0,0 @@ -var m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -var m1_instance1 = new m1_c1(); -function m1_f1() { - return m1_instance1; -} -/// -/// -var a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -var instance1 = new c1(); -function f1() { - return instance1; -} -//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 53e31e30260..ba9f4ee590c 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","ref/m2.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;AERD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 8bd8c2ac035..568c310918f 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -173,7 +173,7 @@ sourceFile:ref/m2.ts JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts,test.ts +sources: ref/m1.ts,ref/m2.ts,test.ts =================================================================== ------------------------------------------------------------------- emittedFile:bin/outAndOutDirFile.js @@ -322,8 +322,8 @@ sourceFile:test.ts 3 > ^-> 1-> 2 >/// -1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +1->Emitted(11, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -331,8 +331,8 @@ sourceFile:test.ts 1-> > 2 >/// -1->Emitted(12, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) +1->Emitted(12, 1) Source(2, 1) + SourceIndex(2) +2 >Emitted(12, 34) Source(2, 34) + SourceIndex(2) --- >>>var a1 = 10; 1 > @@ -349,25 +349,25 @@ sourceFile:test.ts 4 > = 5 > 10 6 > ; -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> 2 >^^^^^^^^^^^^^^^^^^^^-> 1-> > -1->Emitted(14, 1) Source(4, 1) + SourceIndex(1) +1->Emitted(14, 1) Source(4, 1) + SourceIndex(2) --- >>> function c1() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(15, 5) Source(4, 1) + SourceIndex(1) name (c1) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(2) name (c1) --- >>> } 1->^^^^ @@ -377,16 +377,16 @@ sourceFile:test.ts > public p1: number; > 2 > } -1->Emitted(16, 5) Source(6, 1) + SourceIndex(1) name (c1.constructor) -2 >Emitted(16, 6) Source(6, 2) + SourceIndex(1) name (c1.constructor) +1->Emitted(16, 5) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(16, 6) Source(6, 2) + SourceIndex(2) name (c1.constructor) --- >>> return c1; 1->^^^^ 2 > ^^^^^^^^^ 1-> 2 > } -1->Emitted(17, 5) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(17, 14) Source(6, 2) + SourceIndex(1) name (c1) +1->Emitted(17, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(17, 14) Source(6, 2) + SourceIndex(2) name (c1) --- >>>})(); 1 > @@ -400,10 +400,10 @@ sourceFile:test.ts 4 > class c1 { > public p1: number; > } -1 >Emitted(18, 1) Source(6, 1) + SourceIndex(1) name (c1) -2 >Emitted(18, 2) Source(6, 2) + SourceIndex(1) name (c1) -3 >Emitted(18, 2) Source(4, 1) + SourceIndex(1) -4 >Emitted(18, 6) Source(6, 2) + SourceIndex(1) +1 >Emitted(18, 1) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(18, 2) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(18, 2) Source(4, 1) + SourceIndex(2) +4 >Emitted(18, 6) Source(6, 2) + SourceIndex(2) --- >>>var instance1 = new c1(); 1-> @@ -424,21 +424,21 @@ sourceFile:test.ts 6 > c1 7 > () 8 > ; -1->Emitted(19, 1) Source(8, 1) + SourceIndex(1) -2 >Emitted(19, 5) Source(8, 5) + SourceIndex(1) -3 >Emitted(19, 14) Source(8, 14) + SourceIndex(1) -4 >Emitted(19, 17) Source(8, 17) + SourceIndex(1) -5 >Emitted(19, 21) Source(8, 21) + SourceIndex(1) -6 >Emitted(19, 23) Source(8, 23) + SourceIndex(1) -7 >Emitted(19, 25) Source(8, 25) + SourceIndex(1) -8 >Emitted(19, 26) Source(8, 26) + SourceIndex(1) +1->Emitted(19, 1) Source(8, 1) + SourceIndex(2) +2 >Emitted(19, 5) Source(8, 5) + SourceIndex(2) +3 >Emitted(19, 14) Source(8, 14) + SourceIndex(2) +4 >Emitted(19, 17) Source(8, 17) + SourceIndex(2) +5 >Emitted(19, 21) Source(8, 21) + SourceIndex(2) +6 >Emitted(19, 23) Source(8, 23) + SourceIndex(2) +7 >Emitted(19, 25) Source(8, 25) + SourceIndex(2) +8 >Emitted(19, 26) Source(8, 26) + SourceIndex(2) --- >>>function f1() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(20, 1) Source(9, 1) + SourceIndex(1) +1 >Emitted(20, 1) Source(9, 1) + SourceIndex(2) --- >>> return instance1; 1->^^^^ @@ -452,11 +452,11 @@ sourceFile:test.ts 3 > 4 > instance1 5 > ; -1->Emitted(21, 5) Source(10, 5) + SourceIndex(1) name (f1) -2 >Emitted(21, 11) Source(10, 11) + SourceIndex(1) name (f1) -3 >Emitted(21, 12) Source(10, 12) + SourceIndex(1) name (f1) -4 >Emitted(21, 21) Source(10, 21) + SourceIndex(1) name (f1) -5 >Emitted(21, 22) Source(10, 22) + SourceIndex(1) name (f1) +1->Emitted(21, 5) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(21, 11) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(21, 12) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(21, 21) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(21, 22) Source(10, 22) + SourceIndex(2) name (f1) --- >>>} 1 > @@ -465,7 +465,7 @@ sourceFile:test.ts 1 > > 2 >} -1 >Emitted(22, 1) Source(11, 1) + SourceIndex(1) name (f1) -2 >Emitted(22, 2) Source(11, 2) + SourceIndex(1) name (f1) +1 >Emitted(22, 1) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(22, 2) Source(11, 2) + SourceIndex(2) name (f1) --- >>>//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..85e465474d3 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICRU,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAC;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICNU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 86764c6d57a..088f581289a 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -571,6 +571,557 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder_ref/m2.ts +------------------------------------------------------------------- +>>>}); +>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { +>>> exports.m2_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m2_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(1, 12) + SourceIndex(1) +2 >Emitted(16, 18) Source(1, 17) + SourceIndex(1) +3 >Emitted(16, 21) Source(1, 20) + SourceIndex(1) +4 >Emitted(16, 23) Source(1, 22) + SourceIndex(1) +5 >Emitted(16, 24) Source(1, 23) + SourceIndex(1) +--- +>>> var m2_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(2, 1) + SourceIndex(1) +--- +>>> function m2_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(2, 1) + SourceIndex(1) name (m2_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m2_c1 { + > public m2_c1_p1: number; + > +2 > } +1->Emitted(19, 9) Source(4, 1) + SourceIndex(1) name (m2_c1.constructor) +2 >Emitted(19, 10) Source(4, 2) + SourceIndex(1) name (m2_c1.constructor) +--- +>>> return m2_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(20, 21) Source(4, 2) + SourceIndex(1) name (m2_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m2_c1 { + > public m2_c1_p1: number; + > } +1 >Emitted(21, 5) Source(4, 1) + SourceIndex(1) name (m2_c1) +2 >Emitted(21, 6) Source(4, 2) + SourceIndex(1) name (m2_c1) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_c1 = m2_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m2_c1 +3 > { + > public m2_c1_p1: number; + > } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 18) Source(2, 19) + SourceIndex(1) +3 >Emitted(22, 26) Source(4, 2) + SourceIndex(1) +4 >Emitted(22, 27) Source(4, 2) + SourceIndex(1) +--- +>>> exports.m2_instance1 = new m2_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m2_instance1 +3 > = +4 > new +5 > m2_c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(6, 12) + SourceIndex(1) +2 >Emitted(23, 25) Source(6, 24) + SourceIndex(1) +3 >Emitted(23, 28) Source(6, 27) + SourceIndex(1) +4 >Emitted(23, 32) Source(6, 31) + SourceIndex(1) +5 >Emitted(23, 37) Source(6, 36) + SourceIndex(1) +6 >Emitted(23, 39) Source(6, 38) + SourceIndex(1) +7 >Emitted(23, 40) Source(6, 39) + SourceIndex(1) +--- +>>> function m2_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(7, 1) + SourceIndex(1) +--- +>>> return exports.m2_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m2_f1() { + > +2 > return +3 > +4 > m2_instance1 +5 > ; +1->Emitted(25, 9) Source(8, 5) + SourceIndex(1) name (m2_f1) +2 >Emitted(25, 15) Source(8, 11) + SourceIndex(1) name (m2_f1) +3 >Emitted(25, 16) Source(8, 12) + SourceIndex(1) name (m2_f1) +4 >Emitted(25, 36) Source(8, 24) + SourceIndex(1) name (m2_f1) +5 >Emitted(25, 37) Source(8, 25) + SourceIndex(1) name (m2_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(9, 1) + SourceIndex(1) name (m2_f1) +2 >Emitted(26, 6) Source(9, 2) + SourceIndex(1) name (m2_f1) +--- +>>> exports.m2_f1 = m2_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m2_f1 +3 > () { + > return m2_instance1; + > } +4 > +1->Emitted(27, 5) Source(7, 17) + SourceIndex(1) +2 >Emitted(27, 18) Source(7, 22) + SourceIndex(1) +3 >Emitted(27, 26) Source(9, 2) + SourceIndex(1) +4 >Emitted(27, 27) Source(9, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:outputdir_module_multifolder/test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >import m2 = require("../outputdir_module_multifolder_ref/m2"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(30, 5) Source(3, 12) + SourceIndex(2) +2 >Emitted(30, 15) Source(3, 14) + SourceIndex(2) +3 >Emitted(30, 18) Source(3, 17) + SourceIndex(2) +4 >Emitted(30, 20) Source(3, 19) + SourceIndex(2) +5 >Emitted(30, 21) Source(3, 20) + SourceIndex(2) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(31, 5) Source(4, 1) + SourceIndex(2) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(32, 9) Source(4, 1) + SourceIndex(2) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(33, 9) Source(6, 1) + SourceIndex(2) name (c1.constructor) +2 >Emitted(33, 10) Source(6, 2) + SourceIndex(2) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(34, 9) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(34, 18) Source(6, 2) + SourceIndex(2) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(35, 5) Source(6, 1) + SourceIndex(2) name (c1) +2 >Emitted(35, 6) Source(6, 2) + SourceIndex(2) name (c1) +3 >Emitted(35, 6) Source(4, 1) + SourceIndex(2) +4 >Emitted(35, 10) Source(6, 2) + SourceIndex(2) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(36, 5) Source(4, 14) + SourceIndex(2) +2 >Emitted(36, 15) Source(4, 16) + SourceIndex(2) +3 >Emitted(36, 20) Source(6, 2) + SourceIndex(2) +4 >Emitted(36, 21) Source(6, 2) + SourceIndex(2) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(37, 5) Source(8, 12) + SourceIndex(2) +2 >Emitted(37, 22) Source(8, 21) + SourceIndex(2) +3 >Emitted(37, 25) Source(8, 24) + SourceIndex(2) +4 >Emitted(37, 29) Source(8, 28) + SourceIndex(2) +5 >Emitted(37, 31) Source(8, 30) + SourceIndex(2) +6 >Emitted(37, 33) Source(8, 32) + SourceIndex(2) +7 >Emitted(37, 34) Source(8, 33) + SourceIndex(2) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(38, 5) Source(9, 1) + SourceIndex(2) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(39, 9) Source(10, 5) + SourceIndex(2) name (f1) +2 >Emitted(39, 15) Source(10, 11) + SourceIndex(2) name (f1) +3 >Emitted(39, 16) Source(10, 12) + SourceIndex(2) name (f1) +4 >Emitted(39, 33) Source(10, 21) + SourceIndex(2) name (f1) +5 >Emitted(39, 34) Source(10, 22) + SourceIndex(2) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(40, 5) Source(11, 1) + SourceIndex(2) name (f1) +2 >Emitted(40, 6) Source(11, 2) + SourceIndex(2) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(41, 5) Source(9, 17) + SourceIndex(2) +2 >Emitted(41, 15) Source(9, 19) + SourceIndex(2) +3 >Emitted(41, 20) Source(11, 2) + SourceIndex(2) +4 >Emitted(41, 21) Source(11, 2) + SourceIndex(2) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^-> +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(42, 5) Source(13, 12) + SourceIndex(2) +2 >Emitted(42, 15) Source(13, 14) + SourceIndex(2) +3 >Emitted(42, 18) Source(13, 17) + SourceIndex(2) +4 >Emitted(42, 20) Source(13, 19) + SourceIndex(2) +5 >Emitted(42, 21) Source(13, 20) + SourceIndex(2) +6 >Emitted(42, 26) Source(13, 25) + SourceIndex(2) +7 >Emitted(42, 27) Source(13, 26) + SourceIndex(2) +--- +>>> exports.a3 = m2.m2_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + >export var +2 > a3 +3 > = +4 > m2 +5 > . +6 > m2_c1 +7 > ; +1->Emitted(43, 5) Source(14, 12) + SourceIndex(2) +2 >Emitted(43, 15) Source(14, 14) + SourceIndex(2) +3 >Emitted(43, 18) Source(14, 17) + SourceIndex(2) +4 >Emitted(43, 20) Source(14, 19) + SourceIndex(2) +5 >Emitted(43, 21) Source(14, 20) + SourceIndex(2) +6 >Emitted(43, 26) Source(14, 25) + SourceIndex(2) +7 >Emitted(43, 27) Source(14, 26) + SourceIndex(2) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..f84040526ba 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts","outputdir_module_multifolder_ref/m2.ts","outputdir_module_multifolder/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index eb2dff17042..a116b6b4d78 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -615,6 +615,6 @@ sourceFile:outputdir_module_multifolder/test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref/m2.ts,outputdir_module_multifolder/test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..2ace469f902 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 3e447368494..906ba3a07ac 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:m1.ts +------------------------------------------------------------------- +>>>define("m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..3b75f2878c9 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 4d3c5799e27..432e0b90c49 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map index d3e851981ec..29e01bc0bc6 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA;;;ICPU,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAC;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 54c26748c78..a5d445804bf 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -373,6 +373,365 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: ref/m1.ts,test.ts =================================================================== +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:ref/m1.ts +------------------------------------------------------------------- +>>>define("ref/m1", ["require", "exports"], function (require, exports) { +>>> exports.m1_a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >export var +2 > m1_a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) +2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) +3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) +4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) +5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) +--- +>>> var m1_c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function m1_c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^-> +1->export class m1_c1 { + > public m1_c1_p1: number; + > +2 > } +1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) +2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) +--- +>>> return m1_c1; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class m1_c1 { + > public m1_c1_p1: number; + > } +1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) +2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) +3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_c1 = m1_c1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > m1_c1 +3 > { + > public m1_c1_p1: number; + > } +4 > +1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) +3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) +4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) +--- +>>> exports.m1_instance1 = new m1_c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > m1_instance1 +3 > = +4 > new +5 > m1_c1 +6 > () +7 > ; +1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) +2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) +3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) +4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) +5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) +6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) +7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) +--- +>>> function m1_f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) +--- +>>> return exports.m1_instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function m1_f1() { + > +2 > return +3 > +4 > m1_instance1 +5 > ; +1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) +2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) +3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) +4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) +5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) +2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) +--- +>>> exports.m1_f1 = m1_f1; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^ +4 > ^ +1-> +2 > m1_f1 +3 > () { + > return m1_instance1; + > } +4 > +1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) +2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) +3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) +4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:bin/test.js +sourceFile:test.ts +------------------------------------------------------------------- +>>>}); +>>>define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { +>>> exports.a1 = 10; +1 >^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 >import m1 = require("ref/m1"); + >export var +2 > a1 +3 > = +4 > 10 +5 > ; +1 >Emitted(16, 5) Source(2, 12) + SourceIndex(1) +2 >Emitted(16, 15) Source(2, 14) + SourceIndex(1) +3 >Emitted(16, 18) Source(2, 17) + SourceIndex(1) +4 >Emitted(16, 20) Source(2, 19) + SourceIndex(1) +5 >Emitted(16, 21) Source(2, 20) + SourceIndex(1) +--- +>>> var c1 = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(17, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function c1() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(18, 9) Source(3, 1) + SourceIndex(1) name (c1) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^-> +1->export class c1 { + > public p1: number; + > +2 > } +1->Emitted(19, 9) Source(5, 1) + SourceIndex(1) name (c1.constructor) +2 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) name (c1.constructor) +--- +>>> return c1; +1->^^^^^^^^ +2 > ^^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(20, 18) Source(5, 2) + SourceIndex(1) name (c1) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class c1 { + > public p1: number; + > } +1 >Emitted(21, 5) Source(5, 1) + SourceIndex(1) name (c1) +2 >Emitted(21, 6) Source(5, 2) + SourceIndex(1) name (c1) +3 >Emitted(21, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.c1 = c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 > c1 +3 > { + > public p1: number; + > } +4 > +1->Emitted(22, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(22, 15) Source(3, 16) + SourceIndex(1) +3 >Emitted(22, 20) Source(5, 2) + SourceIndex(1) +4 >Emitted(22, 21) Source(5, 2) + SourceIndex(1) +--- +>>> exports.instance1 = new c1(); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^ +6 > ^^ +7 > ^ +1-> + > + >export var +2 > instance1 +3 > = +4 > new +5 > c1 +6 > () +7 > ; +1->Emitted(23, 5) Source(7, 12) + SourceIndex(1) +2 >Emitted(23, 22) Source(7, 21) + SourceIndex(1) +3 >Emitted(23, 25) Source(7, 24) + SourceIndex(1) +4 >Emitted(23, 29) Source(7, 28) + SourceIndex(1) +5 >Emitted(23, 31) Source(7, 30) + SourceIndex(1) +6 >Emitted(23, 33) Source(7, 32) + SourceIndex(1) +7 >Emitted(23, 34) Source(7, 33) + SourceIndex(1) +--- +>>> function f1() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(24, 5) Source(8, 1) + SourceIndex(1) +--- +>>> return exports.instance1; +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^ +1->export function f1() { + > +2 > return +3 > +4 > instance1 +5 > ; +1->Emitted(25, 9) Source(9, 5) + SourceIndex(1) name (f1) +2 >Emitted(25, 15) Source(9, 11) + SourceIndex(1) name (f1) +3 >Emitted(25, 16) Source(9, 12) + SourceIndex(1) name (f1) +4 >Emitted(25, 33) Source(9, 21) + SourceIndex(1) name (f1) +5 >Emitted(25, 34) Source(9, 22) + SourceIndex(1) name (f1) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(26, 5) Source(10, 1) + SourceIndex(1) name (f1) +2 >Emitted(26, 6) Source(10, 2) + SourceIndex(1) name (f1) +--- +>>> exports.f1 = f1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^-> +1-> +2 > f1 +3 > () { + > return instance1; + > } +4 > +1->Emitted(27, 5) Source(8, 17) + SourceIndex(1) +2 >Emitted(27, 15) Source(8, 19) + SourceIndex(1) +3 >Emitted(27, 20) Source(10, 2) + SourceIndex(1) +4 >Emitted(27, 21) Source(10, 2) + SourceIndex(1) +--- +>>> exports.a2 = m1.m1_c1; +1->^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> + > + >export var +2 > a2 +3 > = +4 > m1 +5 > . +6 > m1_c1 +7 > ; +1->Emitted(28, 5) Source(12, 12) + SourceIndex(1) +2 >Emitted(28, 15) Source(12, 14) + SourceIndex(1) +3 >Emitted(28, 18) Source(12, 17) + SourceIndex(1) +4 >Emitted(28, 20) Source(12, 19) + SourceIndex(1) +5 >Emitted(28, 21) Source(12, 20) + SourceIndex(1) +6 >Emitted(28, 26) Source(12, 25) + SourceIndex(1) +7 >Emitted(28, 27) Source(12, 26) + SourceIndex(1) +--- +>>>}); >>>//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js deleted file mode 100644 index 6f3fefb9498..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map index d3e851981ec..4409af8d0a7 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index cf41966a818..3f2ad9829b3 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -394,6 +394,6 @@ sourceFile:test.ts JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ -sources: +sources: ref/m1.ts,test.ts =================================================================== >>>//# sourceMappingURL=test.js.map \ No newline at end of file From a3e7ccb108b8897f969499941403e5803cef4e75 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 15:00:46 -0700 Subject: [PATCH 014/140] Use normalized text for text on string literal types. --- src/compiler/checker.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9f1bf504a0e..c062398c1a9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1620,7 +1620,7 @@ namespace ts { writeAnonymousType(type, flags); } else if (type.flags & TypeFlags.StringLiteral) { - writer.writeStringLiteral((type).text); + writer.writeStringLiteral(`"${escapeString((type).text)}"`); } else { // Should never get here @@ -4213,12 +4213,13 @@ namespace ts { } function getStringLiteralType(node: StringLiteral): StringLiteralType { - if (hasProperty(stringLiteralTypes, node.text)) { - return stringLiteralTypes[node.text]; + const text = node.text; + if (hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; } - let type = stringLiteralTypes[node.text] = createType(TypeFlags.StringLiteral); - type.text = getTextOfNode(node); + let type = stringLiteralTypes[text] = createType(TypeFlags.StringLiteral); + type.text = text; return type; } From 20c2c4e5e53ce5c19667caf087d303530df1e432 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 15:22:35 -0700 Subject: [PATCH 015/140] Amended fourslash tests to expect double quotes. --- .../fourslash/overloadOnConstCallSignature.ts | 2 +- .../fourslash/quickInfoForOverloadOnConst1.ts | 16 ++++++++-------- .../fourslash/signatureHelpOnOverloadOnConst.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/cases/fourslash/overloadOnConstCallSignature.ts b/tests/cases/fourslash/overloadOnConstCallSignature.ts index d729fd4da6f..101d7750e04 100644 --- a/tests/cases/fourslash/overloadOnConstCallSignature.ts +++ b/tests/cases/fourslash/overloadOnConstCallSignature.ts @@ -11,7 +11,7 @@ goTo.marker('1'); verify.signatureHelpCountIs(4); -verify.currentSignatureHelpIs('foo(name: \'order\'): string'); +verify.currentSignatureHelpIs('foo(name: "order"): string'); edit.insert('"hi"'); goTo.marker('2'); diff --git a/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts b/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts index f2ee37aa675..948c2fde999 100644 --- a/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts +++ b/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts @@ -20,22 +20,22 @@ ////c.x1(1, (x/*10*/x) => { return 1; } ); goTo.marker('1'); -verify.quickInfoIs("(method) I.x1(a: number, callback: (x: 'hi') => number): any"); +verify.quickInfoIs("(method) I.x1(a: number, callback: (x: \"hi\") => number): any"); goTo.marker('2'); -verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: \"hi\") => number): any"); goTo.marker('3'); -verify.quickInfoIs("(parameter) callback: (x: 'hi') => number"); +verify.quickInfoIs("(parameter) callback: (x: \"hi\") => number"); goTo.marker('4'); -verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: \"hi\") => number): any"); goTo.marker('5'); verify.quickInfoIs('(parameter) callback: (x: string) => number'); goTo.marker('6'); verify.quickInfoIs('(parameter) callback: (x: string) => number'); goTo.marker('7'); -verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: \"hi\") => number): any"); goTo.marker('8'); -verify.quickInfoIs("(parameter) xx: 'hi'"); +verify.quickInfoIs("(parameter) xx: \"hi\""); goTo.marker('9'); -verify.quickInfoIs("(parameter) xx: 'bye'"); +verify.quickInfoIs("(parameter) xx: \"bye\""); goTo.marker('10'); -verify.quickInfoIs("(parameter) xx: 'hi'"); \ No newline at end of file +verify.quickInfoIs("(parameter) xx: \"hi\""); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpOnOverloadOnConst.ts b/tests/cases/fourslash/signatureHelpOnOverloadOnConst.ts index 8edd0617d70..e312b71aebe 100644 --- a/tests/cases/fourslash/signatureHelpOnOverloadOnConst.ts +++ b/tests/cases/fourslash/signatureHelpOnOverloadOnConst.ts @@ -18,9 +18,9 @@ verify.currentParameterSpanIs("z: string"); goTo.marker('2'); verify.signatureHelpCountIs(3); verify.currentParameterHelpArgumentNameIs("x"); -verify.currentParameterSpanIs("x: 'hi'"); +verify.currentParameterSpanIs("x: \"hi\""); goTo.marker('3'); verify.signatureHelpCountIs(3); verify.currentParameterHelpArgumentNameIs("y"); -verify.currentParameterSpanIs("y: 'bye'"); +verify.currentParameterSpanIs("y: \"bye\""); From 87f2957e4d510637f5fcab4151561a60548944d0 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 15:23:53 -0700 Subject: [PATCH 016/140] Accepted baselines. --- .../callSignatureFunctionOverload.types | 16 +-- .../reference/constantOverloadFunction.types | 16 +-- ...ritedOverloadedSpecializedSignatures.types | 16 +-- ...pecializedCallAndConstructSignatures.types | 4 +- .../memberFunctionsWithPublicOverloads.types | 40 +++---- .../overloadOnConstConstraintChecks1.types | 30 +++--- .../overloadOnConstConstraintChecks2.types | 12 +-- .../overloadOnConstConstraintChecks3.types | 12 +-- .../overloadOnConstInheritance1.types | 12 +-- .../overloadOnConstInheritance2.errors.txt | 4 +- .../overloadOnConstInheritance3.errors.txt | 4 +- .../reference/primtiveTypesAreIdentical.types | 12 +-- .../specializedSignatureInInterface.types | 4 +- ...reIsSubtypeOfNonSpecializedSignature.types | 102 +++++++++--------- .../reference/stringLiteralType.types | 10 +- .../stringLiteralTypesOverloads01.errors.txt | 4 +- .../stringLiteralTypesOverloads01.js | 6 +- ...aturesWithSpecializedSignatures.errors.txt | 4 +- ...aturesWithSpecializedSignatures.errors.txt | 4 +- .../typesWithSpecializedCallSignatures.types | 58 +++++----- ...esWithSpecializedConstructSignatures.types | 26 ++--- 21 files changed, 198 insertions(+), 198 deletions(-) diff --git a/tests/baselines/reference/callSignatureFunctionOverload.types b/tests/baselines/reference/callSignatureFunctionOverload.types index b9788e5b143..d5897c01494 100644 --- a/tests/baselines/reference/callSignatureFunctionOverload.types +++ b/tests/baselines/reference/callSignatureFunctionOverload.types @@ -1,33 +1,33 @@ === tests/cases/compiler/callSignatureFunctionOverload.ts === var foo: { ->foo : { (name: string): string; (name: 'order'): string; (name: 'content'): string; (name: 'done'): string; } +>foo : { (name: string): string; (name: "order"): string; (name: "content"): string; (name: "done"): string; } (name: string): string; >name : string (name: 'order'): string; ->name : 'order' +>name : "order" (name: 'content'): string; ->name : 'content' +>name : "content" (name: 'done'): string; ->name : 'done' +>name : "done" } var foo2: { ->foo2 : { (name: string): string; (name: 'order'): string; (name: 'order'): string; (name: 'done'): string; } +>foo2 : { (name: string): string; (name: "order"): string; (name: "order"): string; (name: "done"): string; } (name: string): string; >name : string (name: 'order'): string; ->name : 'order' +>name : "order" (name: 'order'): string; ->name : 'order' +>name : "order" (name: 'done'): string; ->name : 'done' +>name : "done" } diff --git a/tests/baselines/reference/constantOverloadFunction.types b/tests/baselines/reference/constantOverloadFunction.types index d643d3a726d..d7deaaae46d 100644 --- a/tests/baselines/reference/constantOverloadFunction.types +++ b/tests/baselines/reference/constantOverloadFunction.types @@ -19,27 +19,27 @@ class Derived3 extends Base { biz() { } } >biz : () => void function foo(tagName: 'canvas'): Derived1; ->foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } ->tagName : 'canvas' +>foo : { (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; (tagName: string): Base; } +>tagName : "canvas" >Derived1 : Derived1 function foo(tagName: 'div'): Derived2; ->foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } ->tagName : 'div' +>foo : { (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; (tagName: string): Base; } +>tagName : "div" >Derived2 : Derived2 function foo(tagName: 'span'): Derived3; ->foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } ->tagName : 'span' +>foo : { (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; (tagName: string): Base; } +>tagName : "span" >Derived3 : Derived3 function foo(tagName: string): Base; ->foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>foo : { (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; (tagName: string): Base; } >tagName : string >Base : Base function foo(tagName: any): Base { ->foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>foo : { (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; (tagName: string): Base; } >tagName : any >Base : Base diff --git a/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types index dc8b9b465d8..0ec428bb159 100644 --- a/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types +++ b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types @@ -11,7 +11,7 @@ interface B extends A { >A : A (key:'foo'):string; ->key : 'foo' +>key : "foo" } var b:B; @@ -32,7 +32,7 @@ interface A { >A : A (x: 'A1'): string; ->x : 'A1' +>x : "A1" (x: string): void; >x : string @@ -43,21 +43,21 @@ interface B extends A { >A : A (x: 'B1'): number; ->x : 'B1' +>x : "B1" } interface A { >A : A (x: 'A2'): boolean; ->x : 'A2' +>x : "A2" } interface B { >B : B (x: 'B2'): string[]; ->x : 'B2' +>x : "B2" } interface C1 extends B { @@ -65,7 +65,7 @@ interface C1 extends B { >B : B (x: 'C1'): number[]; ->x : 'C1' +>x : "C1" } interface C2 extends B { @@ -73,7 +73,7 @@ interface C2 extends B { >B : B (x: 'C2'): boolean[]; ->x : 'C2' +>x : "C2" } interface C extends C1, C2 { @@ -82,7 +82,7 @@ interface C extends C1, C2 { >C2 : C2 (x: 'C'): string; ->x : 'C' +>x : "C" } var c: C; diff --git a/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types index 971b5e56907..7b19fd5889b 100644 --- a/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types +++ b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types @@ -3,13 +3,13 @@ interface Foo { >Foo : Foo (x: 'a'): number; ->x : 'a' +>x : "a" (x: string): any; >x : string new (x: 'a'): any; ->x : 'a' +>x : "a" new (x: string): Object; >x : string diff --git a/tests/baselines/reference/memberFunctionsWithPublicOverloads.types b/tests/baselines/reference/memberFunctionsWithPublicOverloads.types index 7cbc2aca1ff..bcd937e9cfc 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicOverloads.types +++ b/tests/baselines/reference/memberFunctionsWithPublicOverloads.types @@ -17,20 +17,20 @@ class C { >y : any public bar(x: 'hi'); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } ->x : 'hi' +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } +>x : "hi" public bar(x: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : string public bar(x: number, y: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : number >y : string public bar(x: any, y?: any) { } ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : any >y : any @@ -49,20 +49,20 @@ class C { >y : any public static bar(x: 'hi'); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } ->x : 'hi' +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } +>x : "hi" public static bar(x: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : string public static bar(x: number, y: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : number >y : string public static bar(x: any, y?: any) { } ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : any >y : any } @@ -88,22 +88,22 @@ class D { >y : any public bar(x: 'hi'); ->bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } ->x : 'hi' +>bar : { (x: "hi"): any; (x: string): any; (x: T, y: T): any; } +>x : "hi" public bar(x: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: T, y: T): any; } >x : string public bar(x: T, y: T); ->bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: T, y: T): any; } >x : T >T : T >y : T >T : T public bar(x: any, y?: any) { } ->bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: T, y: T): any; } >x : any >y : any @@ -122,20 +122,20 @@ class D { >y : any public static bar(x: 'hi'); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } ->x : 'hi' +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } +>x : "hi" public static bar(x: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : string public static bar(x: number, y: string); ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : number >y : string public static bar(x: any, y?: any) { } ->bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>bar : { (x: "hi"): any; (x: string): any; (x: number, y: string): any; } >x : any >y : any diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.types b/tests/baselines/reference/overloadOnConstConstraintChecks1.types index cc561eb6e21..012774b3cc9 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.types @@ -22,23 +22,23 @@ interface MyDoc { // Document >MyDoc : MyDoc createElement(tagName: string): Base; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } >tagName : string >Base : Base createElement(tagName: 'canvas'): Derived1; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'canvas' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "canvas" >Derived1 : Derived1 createElement(tagName: 'div'): Derived2; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'div' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "div" >Derived2 : Derived2 createElement(tagName: 'span'): Derived3; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'span' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "span" >Derived3 : Derived3 // + 100 more @@ -49,27 +49,27 @@ class D implements MyDoc { >MyDoc : MyDoc createElement(tagName:string): Base; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } >tagName : string >Base : Base createElement(tagName: 'canvas'): Derived1; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'canvas' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "canvas" >Derived1 : Derived1 createElement(tagName: 'div'): Derived2; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'div' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "div" >Derived2 : Derived2 createElement(tagName: 'span'): Derived3; ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } ->tagName : 'span' +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } +>tagName : "span" >Derived3 : Derived3 createElement(tagName:any): Base { ->createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>createElement : { (tagName: string): Base; (tagName: "canvas"): Derived1; (tagName: "div"): Derived2; (tagName: "span"): Derived3; } >tagName : any >Base : Base diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.types b/tests/baselines/reference/overloadOnConstConstraintChecks2.types index 36fa89dec4a..6102c282a60 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.types @@ -14,22 +14,22 @@ class C extends A { >foo : () => void } function foo(name: 'hi'): B; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } ->name : 'hi' +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } +>name : "hi" >B : B function foo(name: 'bye'): C; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } ->name : 'bye' +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } +>name : "bye" >C : C function foo(name: string): A; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } >name : string >A : A function foo(name: any): A { ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } >name : any >A : A diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.types b/tests/baselines/reference/overloadOnConstConstraintChecks3.types index 94a03bb7680..0348d3d4b79 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.types @@ -16,22 +16,22 @@ class C extends A { >foo : () => void } function foo(name: 'hi'): B; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } ->name : 'hi' +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } +>name : "hi" >B : B function foo(name: 'bye'): C; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } ->name : 'bye' +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } +>name : "bye" >C : C function foo(name: string): A; ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } >name : string >A : A function foo(name: any): A { ->foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>foo : { (name: "hi"): B; (name: "bye"): C; (name: string): A; } >name : any >A : A diff --git a/tests/baselines/reference/overloadOnConstInheritance1.types b/tests/baselines/reference/overloadOnConstInheritance1.types index 96f8df3dffd..4721c18e55c 100644 --- a/tests/baselines/reference/overloadOnConstInheritance1.types +++ b/tests/baselines/reference/overloadOnConstInheritance1.types @@ -3,23 +3,23 @@ interface Base { >Base : Base addEventListener(x: string): any; ->addEventListener : { (x: string): any; (x: 'foo'): string; } +>addEventListener : { (x: string): any; (x: "foo"): string; } >x : string addEventListener(x: 'foo'): string; ->addEventListener : { (x: string): any; (x: 'foo'): string; } ->x : 'foo' +>addEventListener : { (x: string): any; (x: "foo"): string; } +>x : "foo" } interface Deriver extends Base { >Deriver : Deriver >Base : Base addEventListener(x: string): any; ->addEventListener : { (x: string): any; (x: 'bar'): string; } +>addEventListener : { (x: string): any; (x: "bar"): string; } >x : string addEventListener(x: 'bar'): string; ->addEventListener : { (x: string): any; (x: 'bar'): string; } ->x : 'bar' +>addEventListener : { (x: string): any; (x: "bar"): string; } +>x : "bar" } diff --git a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt index 159af64a13a..4870106f474 100644 --- a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. Types of property 'addEventListener' are incompatible. - Type '(x: 'bar') => string' is not assignable to type '{ (x: string): any; (x: 'foo'): string; }'. + Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -13,7 +13,7 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Speciali ~~~~~~~ !!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'addEventListener' are incompatible. -!!! error TS2430: Type '(x: 'bar') => string' is not assignable to type '{ (x: string): any; (x: 'foo'): string; }'. +!!! error TS2430: Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. diff --git a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt index e0fff7b1ec7..b338f9795d7 100644 --- a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. Types of property 'addEventListener' are incompatible. - Type '{ (x: 'bar'): string; (x: 'foo'): string; }' is not assignable to type '(x: string) => any'. + Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. tests/cases/compiler/overloadOnConstInheritance3.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -13,7 +13,7 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Speciali ~~~~~~~ !!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'addEventListener' are incompatible. -!!! error TS2430: Type '{ (x: 'bar'): string; (x: 'foo'): string; }' is not assignable to type '(x: string) => any'. +!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. // shouldn't need to redeclare the string overload addEventListener(x: 'bar'): string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/primtiveTypesAreIdentical.types b/tests/baselines/reference/primtiveTypesAreIdentical.types index bbff4623f0b..0b8e7dadf7d 100644 --- a/tests/baselines/reference/primtiveTypesAreIdentical.types +++ b/tests/baselines/reference/primtiveTypesAreIdentical.types @@ -50,19 +50,19 @@ function foo4(x: any) { } >x : any function foo5(x: 'a'); ->foo5 : { (x: 'a'): any; (x: 'a'): any; (x: string): any; } ->x : 'a' +>foo5 : { (x: "a"): any; (x: "a"): any; (x: string): any; } +>x : "a" function foo5(x: 'a'); ->foo5 : { (x: 'a'): any; (x: 'a'): any; (x: string): any; } ->x : 'a' +>foo5 : { (x: "a"): any; (x: "a"): any; (x: string): any; } +>x : "a" function foo5(x: string); ->foo5 : { (x: 'a'): any; (x: 'a'): any; (x: string): any; } +>foo5 : { (x: "a"): any; (x: "a"): any; (x: string): any; } >x : string function foo5(x: any) { } ->foo5 : { (x: 'a'): any; (x: 'a'): any; (x: string): any; } +>foo5 : { (x: "a"): any; (x: "a"): any; (x: string): any; } >x : any enum E { A } diff --git a/tests/baselines/reference/specializedSignatureInInterface.types b/tests/baselines/reference/specializedSignatureInInterface.types index c8f76f4cb9b..b9621af7b8b 100644 --- a/tests/baselines/reference/specializedSignatureInInterface.types +++ b/tests/baselines/reference/specializedSignatureInInterface.types @@ -11,8 +11,8 @@ interface B extends A { >A : A (key:'foo'):string; ->key : 'foo' +>key : "foo" (key:'bar'):string; ->key : 'bar' +>key : "bar" } diff --git a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.types b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.types index cb86966d65a..b27a935ced6 100644 --- a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.types +++ b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.types @@ -3,30 +3,30 @@ // All the below should not be errors function foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; } +>x : "a" function foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; } +>foo : { (x: "a"): any; (x: string): any; } >x : string function foo(x: any) { } ->foo : { (x: 'a'): any; (x: string): any; } +>foo : { (x: "a"): any; (x: string): any; } >x : any class C { >C : C foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; } +>foo : { (x: "a"): any; (x: string): any; } >x : string foo(x: any) { } ->foo : { (x: 'a'): any; (x: string): any; } +>foo : { (x: "a"): any; (x: string): any; } >x : any } @@ -35,20 +35,20 @@ class C2 { >T : T foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : string foo(x: T); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : T >T : T foo(x: any) { } ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : any } @@ -58,20 +58,20 @@ class C3 { >String : String foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : string foo(x: T); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : T >T : T foo(x: any) { } ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : any } @@ -79,7 +79,7 @@ interface I { >I : I (x: 'a'); ->x : 'a' +>x : "a" (x: number); >x : number @@ -88,15 +88,15 @@ interface I { >x : string foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; (x: number): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; (x: number): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; (x: number): any; } +>foo : { (x: "a"): any; (x: string): any; (x: number): any; } >x : string foo(x: number); ->foo : { (x: 'a'): any; (x: string): any; (x: number): any; } +>foo : { (x: "a"): any; (x: string): any; (x: number): any; } >x : number } @@ -105,7 +105,7 @@ interface I2 { >T : T (x: 'a'); ->x : 'a' +>x : "a" (x: T); >x : T @@ -115,15 +115,15 @@ interface I2 { >x : string foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : string foo(x: T); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : T >T : T } @@ -134,7 +134,7 @@ interface I3 { >String : String (x: 'a'); ->x : 'a' +>x : "a" (x: string); >x : string @@ -144,49 +144,49 @@ interface I3 { >T : T foo(x: 'a'); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } ->x : 'a' +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } +>x : "a" foo(x: string); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : string foo(x: T); ->foo : { (x: 'a'): any; (x: string): any; (x: T): any; } +>foo : { (x: "a"): any; (x: string): any; (x: T): any; } >x : T >T : T } var a: { ->a : { (x: string): any; (x: 'a'): any; (x: number): any; foo(x: string): any; foo(x: 'a'): any; foo(x: number): any; } +>a : { (x: string): any; (x: "a"): any; (x: number): any; foo(x: string): any; foo(x: "a"): any; foo(x: number): any; } (x: string); >x : string (x: 'a'); ->x : 'a' +>x : "a" (x: number); >x : number foo(x: string); ->foo : { (x: string): any; (x: 'a'): any; (x: number): any; } +>foo : { (x: string): any; (x: "a"): any; (x: number): any; } >x : string foo(x: 'a'); ->foo : { (x: string): any; (x: 'a'): any; (x: number): any; } ->x : 'a' +>foo : { (x: string): any; (x: "a"): any; (x: number): any; } +>x : "a" foo(x: number); ->foo : { (x: string): any; (x: 'a'): any; (x: number): any; } +>foo : { (x: string): any; (x: "a"): any; (x: number): any; } >x : number } var a2: { ->a2 : { (x: 'a'): any; (x: string): any; (x: T): any; foo(x: string): any; foo(x: 'a'): any; foo(x: T): any; } +>a2 : { (x: "a"): any; (x: string): any; (x: T): any; foo(x: string): any; foo(x: "a"): any; foo(x: T): any; } (x: 'a'); ->x : 'a' +>x : "a" (x: string); >x : string @@ -197,25 +197,25 @@ var a2: { >T : T foo(x: string); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } >x : string foo(x: 'a'); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } ->x : 'a' +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } +>x : "a" foo(x: T); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } >T : T >x : T >T : T } var a3: { ->a3 : { (x: 'a'): any; (x: T): any; (x: string): any; foo(x: string): any; foo(x: 'a'): any; foo(x: T): any; } +>a3 : { (x: "a"): any; (x: T): any; (x: string): any; foo(x: string): any; foo(x: "a"): any; foo(x: T): any; } (x: 'a'); ->x : 'a' +>x : "a" (x: T); >T : T @@ -226,15 +226,15 @@ var a3: { >x : string foo(x: string); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } >x : string foo(x: 'a'); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } ->x : 'a' +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } +>x : "a" foo(x: T); ->foo : { (x: string): any; (x: 'a'): any; (x: T): any; } +>foo : { (x: string): any; (x: "a"): any; (x: T): any; } >T : T >String : String >x : T diff --git a/tests/baselines/reference/stringLiteralType.types b/tests/baselines/reference/stringLiteralType.types index 5d2e13c4ba5..affa995c2f3 100644 --- a/tests/baselines/reference/stringLiteralType.types +++ b/tests/baselines/reference/stringLiteralType.types @@ -1,16 +1,16 @@ === tests/cases/conformance/types/primitives/stringLiteral/stringLiteralType.ts === var x: 'hi'; ->x : 'hi' +>x : "hi" function f(x: 'hi'); ->f : { (x: 'hi'): any; (x: string): any; } ->x : 'hi' +>f : { (x: "hi"): any; (x: string): any; } +>x : "hi" function f(x: string); ->f : { (x: 'hi'): any; (x: string): any; } +>f : { (x: "hi"): any; (x: string): any; } >x : string function f(x: any) { ->f : { (x: 'hi'): any; (x: string): any; } +>f : { (x: "hi"): any; (x: string): any; } >x : any } diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt index 378857dc277..6e0fd982638 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(11,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,7): error TS2322: Type 'string' is not assignable to type '"string"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,7): error TS2322: Type 'string' is not assignable to type ''number''. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,7): error TS2322: Type 'string' is not assignable to type '"number"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,7): error TS2322: Type 'string' is not assignable to type '"boolean"'. @@ -43,7 +43,7 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34, !!! error TS2322: Type 'string' is not assignable to type '"string"'. const number: "number" = "number" ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type ''number''. +!!! error TS2322: Type 'string' is not assignable to type '"number"'. const boolean: "boolean" = "boolean" ~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '"boolean"'. diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.js b/tests/baselines/reference/stringLiteralTypesOverloads01.js index 23483776a9b..73dabd26fab 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.js +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.js @@ -106,9 +106,9 @@ declare namespace Consts1 { declare const string: "string"; declare const number: "number"; declare const boolean: "boolean"; -declare const stringOrNumber: "string" | 'number'; +declare const stringOrNumber: "string" | "number"; declare const stringOrBoolean: "string" | "boolean"; -declare const booleanOrNumber: 'number' | "boolean"; -declare const stringOrBooleanOrNumber: "string" | "boolean" | 'number'; +declare const booleanOrNumber: "number" | "boolean"; +declare const stringOrBooleanOrNumber: "string" | "boolean" | "number"; declare namespace Consts2 { } diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt index d3c399477d6..da742fcd69c 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. - Type '(x: string) => string' is not assignable to type '{ (x: 'a'): number; (x: string): number; }'. + Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'. Type 'string' is not assignable to type 'number'. @@ -78,7 +78,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type '(x: string) => string' is not assignable to type '{ (x: 'a'): number; (x: string): number; }'. +!!! error TS2430: Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'. !!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: (x: string) => string; // error because base returns non-void; diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt index 03cc6de0ca4..8a885a2455f 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. - Type 'new (x: string) => string' is not assignable to type '{ new (x: 'a'): number; new (x: string): number; }'. + Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'. Type 'string' is not assignable to type 'number'. @@ -78,7 +78,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'new (x: string) => string' is not assignable to type '{ new (x: 'a'): number; new (x: string): number; }'. +!!! error TS2430: Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'. !!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: new (x: string) => string; // error because base returns non-void; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.types b/tests/baselines/reference/typesWithSpecializedCallSignatures.types index fa3ac7a4ba4..113e24456f9 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.types +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.types @@ -19,22 +19,22 @@ class C { >C : C foo(x: 'hi'): Derived1; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'hi' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "hi" >Derived1 : Derived1 foo(x: 'bye'): Derived2; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'bye' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "bye" >Derived2 : Derived2 foo(x: string): Base; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >x : string >Base : Base foo(x) { ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >x : any return x; @@ -50,17 +50,17 @@ interface I { >I : I foo(x: 'hi'): Derived1; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'hi' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "hi" >Derived1 : Derived1 foo(x: 'bye'): Derived2; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'bye' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "bye" >Derived2 : Derived2 foo(x: string): Base; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >x : string >Base : Base } @@ -69,20 +69,20 @@ var i: I; >I : I var a: { ->a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } foo(x: 'hi'): Derived1; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'hi' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "hi" >Derived1 : Derived1 foo(x: 'bye'): Derived2; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } ->x : 'bye' +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } +>x : "bye" >Derived2 : Derived2 foo(x: string): Base; ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >x : string >Base : Base @@ -94,9 +94,9 @@ c = i; >i : I c = a; ->c = a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>c = a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } >c : C ->a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } i = c; >i = c : C @@ -104,44 +104,44 @@ i = c; >c : C i = a; ->i = a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>i = a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } >i : I ->a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } a = c; >a = c : C ->a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } >c : C a = i; >a = i : I ->a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; } +>a : { foo(x: "hi"): Derived1; foo(x: "bye"): Derived2; foo(x: string): Base; } >i : I var r1: Derived1 = c.foo('hi'); >r1 : Derived1 >Derived1 : Derived1 >c.foo('hi') : Derived1 ->c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >c : C ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >'hi' : string var r2: Derived2 = c.foo('bye'); >r2 : Derived2 >Derived2 : Derived2 >c.foo('bye') : Derived2 ->c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >c : C ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >'bye' : string var r3: Base = c.foo('hm'); >r3 : Base >Base : Base >c.foo('hm') : Base ->c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >c : C ->foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; } +>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >'hm' : string diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.types b/tests/baselines/reference/typesWithSpecializedConstructSignatures.types index 66e274d917a..2698439c527 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.types +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.types @@ -19,10 +19,10 @@ class C { >C : C constructor(x: 'hi'); ->x : 'hi' +>x : "hi" constructor(x: 'bye'); ->x : 'bye' +>x : "bye" constructor(x: string); >x : string @@ -44,11 +44,11 @@ interface I { >I : I new(x: 'hi'): Derived1; ->x : 'hi' +>x : "hi" >Derived1 : Derived1 new(x: 'bye'): Derived2; ->x : 'bye' +>x : "bye" >Derived2 : Derived2 new(x: string): Base; @@ -60,14 +60,14 @@ var i: I; >I : I var a: { ->a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } new(x: 'hi'): Derived1; ->x : 'hi' +>x : "hi" >Derived1 : Derived1 new(x: 'bye'): Derived2; ->x : 'bye' +>x : "bye" >Derived2 : Derived2 new(x: string): Base; @@ -82,18 +82,18 @@ c = i; >i : I c = a; ->c = a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>c = a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } >c : C ->a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } i = a; ->i = a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>i = a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } >i : I ->a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } a = i; >a = i : I ->a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } >i : I var r1 = new C('hi'); @@ -113,6 +113,6 @@ var r3: Base = new a('hm'); >r3 : Base >Base : Base >new a('hm') : Base ->a : { new (x: 'hi'): Derived1; new (x: 'bye'): Derived2; new (x: string): Base; } +>a : { new (x: "hi"): Derived1; new (x: "bye"): Derived2; new (x: string): Base; } >'hm' : string From f721971063f210389dc3cd4c0d0a6b3e4562d4e8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 15:41:12 -0700 Subject: [PATCH 017/140] Capture compatible contextual types for unions containing string literals. --- src/compiler/checker.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c062398c1a9..dd6c3a63df9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10103,6 +10103,28 @@ namespace ts { return getUnionType([type1, type2]); } + function checkStringLiteralExpression(node: LiteralExpression) { + // TODO (drosen): Do we want to apply the same approach to no-sub template literals? + + let contextualType = getContextualType(node); + if (contextualType) { + if (contextualType.flags & TypeFlags.Union) { + for (const type of (contextualType).types) { + if (type.flags & TypeFlags.StringLiteral && (type).text === node.text) { + return contextualType; + } + } + } + else if (contextualType.flags & TypeFlags.StringLiteral && (contextualType).text === node.text) { + // NOTE: This doesn't work because the contextual type of a string literal + // always gets its apparent type. + // Thus you'll always end up with 'String' instead of the literal. + return contextualType; + } + } + return stringType; + } + function checkTemplateExpression(node: TemplateExpression): Type { // We just want to check each expressions, but we are unconcerned with // the type of each expression, as any value may be coerced into a string. @@ -10233,8 +10255,9 @@ namespace ts { case SyntaxKind.TemplateExpression: return checkTemplateExpression(node); case SyntaxKind.StringLiteral: + return checkStringLiteralExpression(node); case SyntaxKind.NoSubstitutionTemplateLiteral: - return stringType; + return stringType case SyntaxKind.RegularExpressionLiteral: return globalRegExpType; case SyntaxKind.ArrayLiteralExpression: From 7b4e94dbd57aef497a6cda2d6b440d35dd6e9d19 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 15:42:16 -0700 Subject: [PATCH 018/140] Accepted baselines. --- ...tringLiteralTypesInUnionTypes01.errors.txt | 33 ------- .../stringLiteralTypesInUnionTypes01.symbols | 52 +++++++++++ .../stringLiteralTypesInUnionTypes01.types | 62 +++++++++++++ .../stringLiteralTypesInUnionTypes02.types | 4 +- ...tringLiteralTypesInUnionTypes03.errors.txt | 7 +- ...tringLiteralTypesInUnionTypes04.errors.txt | 50 ---------- .../stringLiteralTypesInUnionTypes04.symbols | 76 +++++++++++++++ .../stringLiteralTypesInUnionTypes04.types | 92 +++++++++++++++++++ ...ingLiteralTypesTypePredicates01.errors.txt | 7 +- 9 files changed, 286 insertions(+), 97 deletions(-) delete mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes01.types delete mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes04.types diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt deleted file mode 100644 index 14d0a892f55..00000000000 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(4,5): error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. - Type 'string' is not assignable to type '"baz"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(5,5): error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. - Type 'string' is not assignable to type '"baz"'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts (2 errors) ==== - - type T = "foo" | "bar" | "baz"; - - var x: "foo" | "bar" | "baz" = "foo"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. -!!! error TS2322: Type 'string' is not assignable to type '"baz"'. - var y: T = "bar"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'. -!!! error TS2322: Type 'string' is not assignable to type '"baz"'. - - if (x === "foo") { - let a = x; - } - else if (x !== "bar") { - let b = x || y; - } - else { - let c = x; - let d = y; - let e: (typeof x) | (typeof y) = c || d; - } - - x = y; - y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols new file mode 100644 index 00000000000..c608929383e --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts === + +type T = "foo" | "bar" | "baz"; +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes01.ts, 0, 0)) + +var x: "foo" | "bar" | "baz" = "foo"; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) + +var y: T = "bar"; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes01.ts, 0, 0)) + +if (x === "foo") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesInUnionTypes01.ts, 7, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) +} +else if (x !== "bar") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) + + let b = x || y; +>b : Symbol(b, Decl(stringLiteralTypesInUnionTypes01.ts, 10, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) +} +else { + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes01.ts, 13, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) + + let d = y; +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes01.ts, 14, 7)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) + + let e: (typeof x) | (typeof y) = c || d; +>e : Symbol(e, Decl(stringLiteralTypesInUnionTypes01.ts, 15, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes01.ts, 13, 7)) +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes01.ts, 14, 7)) +} + +x = y; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) + +y = x; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types new file mode 100644 index 00000000000..b5a2d876bcc --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types @@ -0,0 +1,62 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts === + +type T = "foo" | "bar" | "baz"; +>T : "foo" | "bar" | "baz" + +var x: "foo" | "bar" | "baz" = "foo"; +>x : "foo" | "bar" | "baz" +>"foo" : "foo" | "bar" | "baz" + +var y: T = "bar"; +>y : "foo" | "bar" | "baz" +>T : "foo" | "bar" | "baz" +>"bar" : "foo" | "bar" | "baz" + +if (x === "foo") { +>x === "foo" : boolean +>x : "foo" | "bar" | "baz" +>"foo" : string + + let a = x; +>a : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" +} +else if (x !== "bar") { +>x !== "bar" : boolean +>x : "foo" | "bar" | "baz" +>"bar" : string + + let b = x || y; +>b : "foo" | "bar" | "baz" +>x || y : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" +>y : "foo" | "bar" | "baz" +} +else { + let c = x; +>c : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" + + let d = y; +>d : "foo" | "bar" | "baz" +>y : "foo" | "bar" | "baz" + + let e: (typeof x) | (typeof y) = c || d; +>e : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" +>y : "foo" | "bar" | "baz" +>c || d : "foo" | "bar" | "baz" +>c : "foo" | "bar" | "baz" +>d : "foo" | "bar" | "baz" +} + +x = y; +>x = y : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" +>y : "foo" | "bar" | "baz" + +y = x; +>y = x : "foo" | "bar" | "baz" +>y : "foo" | "bar" | "baz" +>x : "foo" | "bar" | "baz" + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types index 569edc77815..e3ac5ba4817 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types @@ -5,12 +5,12 @@ type T = string | "foo" | "bar" | "baz"; var x: "foo" | "bar" | "baz" | string = "foo"; >x : "foo" | "bar" | "baz" | string ->"foo" : string +>"foo" : "foo" | "bar" | "baz" | string var y: T = "bar"; >y : string | "foo" | "bar" | "baz" >T : string | "foo" | "bar" | "baz" ->"bar" : string +>"bar" : string | "foo" | "bar" | "baz" if (x === "foo") { >x === "foo" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt index 8ff377b2e72..74249b178d6 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt @@ -1,18 +1,13 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(5,5): error TS2322: Type 'string' is not assignable to type 'number | "foo" | "bar"'. - Type 'string' is not assignable to type '"bar"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(7,5): error TS2365: Operator '===' cannot be applied to types '"foo" | "bar" | number' and 'string'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(10,10): error TS2365: Operator '!==' cannot be applied to types '"foo" | "bar" | number' and 'string'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (3 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (2 errors) ==== type T = number | "foo" | "bar"; var x: "foo" | "bar" | number; var y: T = "bar"; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number | "foo" | "bar"'. -!!! error TS2322: Type 'string' is not assignable to type '"bar"'. if (x === "foo") { ~~~~~~~~~~~ diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt deleted file mode 100644 index 77cb9c09531..00000000000 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(4,5): error TS2322: Type 'string' is not assignable to type '"" | "foo"'. - Type 'string' is not assignable to type '"foo"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts(5,5): error TS2322: Type 'string' is not assignable to type '"" | "foo"'. - Type 'string' is not assignable to type '"foo"'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts (2 errors) ==== - - type T = "" | "foo"; - - let x: T = ""; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"" | "foo"'. -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. - let y: T = "foo"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"" | "foo"'. -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. - - if (x === "") { - let a = x; - } - - if (x !== "") { - let b = x; - } - - if (x == "") { - let c = x; - } - - if (x != "") { - let d = x; - } - - if (x) { - let e = x; - } - - if (!x) { - let f = x; - } - - if (!!x) { - let g = x; - } - - if (!!!x) { - let h = x; - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols new file mode 100644 index 00000000000..ced93fcefc9 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts === + +type T = "" | "foo"; +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) + +let x: T = ""; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) + +let y: T = "foo"; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes04.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) + +if (x === "") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesInUnionTypes04.ts, 7, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (x !== "") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let b = x; +>b : Symbol(b, Decl(stringLiteralTypesInUnionTypes04.ts, 11, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (x == "") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes04.ts, 15, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (x != "") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let d = x; +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes04.ts, 19, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (x) { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let e = x; +>e : Symbol(e, Decl(stringLiteralTypesInUnionTypes04.ts, 23, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (!x) { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let f = x; +>f : Symbol(f, Decl(stringLiteralTypesInUnionTypes04.ts, 27, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (!!x) { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let g = x; +>g : Symbol(g, Decl(stringLiteralTypesInUnionTypes04.ts, 31, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} + +if (!!!x) { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) + + let h = x; +>h : Symbol(h, Decl(stringLiteralTypesInUnionTypes04.ts, 35, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) +} diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types new file mode 100644 index 00000000000..9a010b490cc --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types @@ -0,0 +1,92 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts === + +type T = "" | "foo"; +>T : "" | "foo" + +let x: T = ""; +>x : "" | "foo" +>T : "" | "foo" +>"" : "" | "foo" + +let y: T = "foo"; +>y : "" | "foo" +>T : "" | "foo" +>"foo" : "" | "foo" + +if (x === "") { +>x === "" : boolean +>x : "" | "foo" +>"" : string + + let a = x; +>a : "" | "foo" +>x : "" | "foo" +} + +if (x !== "") { +>x !== "" : boolean +>x : "" | "foo" +>"" : string + + let b = x; +>b : "" | "foo" +>x : "" | "foo" +} + +if (x == "") { +>x == "" : boolean +>x : "" | "foo" +>"" : string + + let c = x; +>c : "" | "foo" +>x : "" | "foo" +} + +if (x != "") { +>x != "" : boolean +>x : "" | "foo" +>"" : string + + let d = x; +>d : "" | "foo" +>x : "" | "foo" +} + +if (x) { +>x : "" | "foo" + + let e = x; +>e : "" | "foo" +>x : "" | "foo" +} + +if (!x) { +>!x : boolean +>x : "" | "foo" + + let f = x; +>f : "" | "foo" +>x : "" | "foo" +} + +if (!!x) { +>!!x : boolean +>!x : boolean +>x : "" | "foo" + + let g = x; +>g : "" | "foo" +>x : "" | "foo" +} + +if (!!!x) { +>!!!x : boolean +>!!x : boolean +>!x : boolean +>x : "" | "foo" + + let h = x; +>h : "" | "foo" +>x : "" | "foo" +} diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt index 3e412a6c770..b888c3ca77e 100644 --- a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt @@ -1,10 +1,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(10,5): error TS2322: Type 'string' is not assignable to type '"A" | "B"'. - Type 'string' is not assignable to type '"B"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (3 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (2 errors) ==== type Kind = "A" | "B" @@ -19,9 +17,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.t } var x: Kind = "A"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"A" | "B"'. -!!! error TS2322: Type 'string' is not assignable to type '"B"'. if (kindIs(x, "A")) { let a = x; From d8d72aabae439e17d18e35887981165413b71556 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 16:00:45 -0700 Subject: [PATCH 019/140] Separated the concept of apparent types from contextual types for string literal types. In most cases, expressions are interested in the apparent type of the contextual type. For instance: var x = { hasOwnProperty(prop) { /* ... */ }; In the above, 'prop' should be contextually typed as 'string' from the signature of 'hasOwnProperty' in the global 'Object' type. However, in the case of string literal types, we don't want to get the apparent type after fetching the contextual type. This is because the apparent type of the '"onload"' string literal type is the global 'String' type. This has adverse effects in simple assignments like the following: let x: "onload" = "onload"; In this example, the right-hand side of the assignment will grab the type of 'x'. After figuring out the type is "onload", we then get the apparent type which is 'String'. This is problematic because when we then check the assignment itself, 'String's are not assignable to '"onload"'s. So in this case, we grab the contextual type *without* getting its apparent type. --- src/compiler/checker.ts | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dd6c3a63df9..2dcded72ad4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -80,7 +80,7 @@ namespace ts { symbolToString, getAugmentedPropertiesOfType, getRootSymbols, - getContextualType, + getContextualType: getApparentTypeOfContextualType, getFullyQualifiedName, getResolvedSignature, getConstantValue, @@ -6716,7 +6716,7 @@ namespace ts { else if (operator === SyntaxKind.BarBarToken) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. - let type = getContextualType(binaryExpression); + let type = getApparentTypeOfContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); } @@ -6788,7 +6788,7 @@ namespace ts { function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) { let objectLiteral = element.parent; - let type = getContextualType(objectLiteral); + let type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!hasDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name @@ -6814,7 +6814,7 @@ namespace ts { // type of T. function getContextualTypeForElementExpression(node: Expression): Type { let arrayLiteral = node.parent; - let type = getContextualType(arrayLiteral); + let type = getApparentTypeOfContextualType(arrayLiteral); if (type) { let index = indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) @@ -6827,7 +6827,7 @@ namespace ts { // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. function getContextualTypeForConditionalOperand(node: Expression): Type { let conditional = node.parent; - return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + return node === conditional.whenTrue || node === conditional.whenFalse ? getApparentTypeOfContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr: JsxExpression|JsxSpreadAttribute): Type { @@ -6852,12 +6852,22 @@ namespace ts { // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. - function getContextualType(node: Expression): Type { - let type = getContextualTypeWorker(node); + function getApparentTypeOfContextualType(node: Expression): Type { + let type = getContextualType(node); return type && getApparentType(type); } - function getContextualTypeWorker(node: Expression): Type { + /** + * Woah! Do you really want to use this function? + * + * Unless you're trying to get the *non-apparent* type for a value-literal type, + * you probably meant to use 'getApparentTypeOfContextualType'. + * Otherwise this is slightly less useful. + * + * @param node the expression whose contextual type will be returned. + * @returns the contextual type of an expression. + */ + function getContextualType(node: Expression): Type { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -6896,7 +6906,7 @@ namespace ts { Debug.assert(parent.parent.kind === SyntaxKind.TemplateExpression); return getContextualTypeForSubstitutionExpression(parent.parent, node); case SyntaxKind.ParenthesizedExpression: - return getContextualType(parent); + return getApparentTypeOfContextualType(parent); case SyntaxKind.JsxExpression: case SyntaxKind.JsxSpreadAttribute: return getContextualTypeForJsxExpression(parent); @@ -6936,7 +6946,7 @@ namespace ts { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); let type = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + : getApparentTypeOfContextualType(node); if (!type) { return undefined; } @@ -7066,7 +7076,7 @@ namespace ts { type.pattern = node; return type; } - let contextualType = getContextualType(node); + let contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { let pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting @@ -7157,7 +7167,7 @@ namespace ts { let propertiesTable: SymbolTable = {}; let propertiesArray: Symbol[] = []; - let contextualType = getContextualType(node); + let contextualType = getApparentTypeOfContextualType(node); let contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression); let inDestructuringPattern = isAssignmentTarget(node); @@ -10116,9 +10126,6 @@ namespace ts { } } else if (contextualType.flags & TypeFlags.StringLiteral && (contextualType).text === node.text) { - // NOTE: This doesn't work because the contextual type of a string literal - // always gets its apparent type. - // Thus you'll always end up with 'String' instead of the literal. return contextualType; } } @@ -10184,7 +10191,7 @@ namespace ts { if (isInferentialContext(contextualMapper)) { let signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - let contextualType = getContextualType(node); + let contextualType = getApparentTypeOfContextualType(node); if (contextualType) { let contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { From 315b06dc99b6bcf6079e31f535d9ab3171d1d9ad Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 16:09:57 -0700 Subject: [PATCH 020/140] Accepted baselines. --- ...ritedOverloadedSpecializedSignatures.types | 16 ++++----- ...pecializedCallAndConstructSignatures.types | 4 +-- .../stringLiteralTypesAndTuples01.errors.txt | 9 +---- .../stringLiteralTypesAsTags01.errors.txt | 9 +---- ...alTypesInVariableDeclarations01.errors.txt | 34 ++----------------- .../stringLiteralTypesOverloads01.errors.txt | 11 +----- .../stringLiteralTypesOverloads02.errors.txt | 11 +----- .../reference/symbolProperty41.types | 2 +- ...gumentsWithStringLiteralTypes01.errors.txt | 18 +++++----- .../typesWithSpecializedCallSignatures.types | 4 +-- ...esWithSpecializedConstructSignatures.types | 4 +-- 11 files changed, 30 insertions(+), 92 deletions(-) diff --git a/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types index 0ec428bb159..563cb58a755 100644 --- a/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types +++ b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types @@ -24,7 +24,7 @@ b('foo').charAt(0); >b('foo').charAt : (pos: number) => string >b('foo') : string >b : B ->'foo' : string +>'foo' : "foo" >charAt : (pos: number) => string >0 : number @@ -94,25 +94,25 @@ var x1: string[] = c('B2'); >x1 : string[] >c('B2') : string[] >c : C ->'B2' : string +>'B2' : "B2" var x2: number = c('B1'); >x2 : number >c('B1') : number >c : C ->'B1' : string +>'B1' : "B1" var x3: boolean = c('A2'); >x3 : boolean >c('A2') : boolean >c : C ->'A2' : string +>'A2' : "A2" var x4: string = c('A1'); >x4 : string >c('A1') : string >c : C ->'A1' : string +>'A1' : "A1" var x5: void = c('A0'); >x5 : void @@ -124,19 +124,19 @@ var x6: number[] = c('C1'); >x6 : number[] >c('C1') : number[] >c : C ->'C1' : string +>'C1' : "C1" var x7: boolean[] = c('C2'); >x7 : boolean[] >c('C2') : boolean[] >c : C ->'C2' : string +>'C2' : "C2" var x8: string = c('C'); >x8 : string >c('C') : string >c : C ->'C' : string +>'C' : "C" var x9: void = c('generic'); >x9 : void diff --git a/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types index 7b19fd5889b..5288d9f15a4 100644 --- a/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types +++ b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types @@ -24,7 +24,7 @@ var r = f('a'); >r : number >f('a') : number >f : Foo ->'a' : string +>'a' : "a" var r2 = f('A'); >r2 : any @@ -36,7 +36,7 @@ var r3 = new f('a'); >r3 : any >new f('a') : any >f : Foo ->'a' : string +>'a' : "a" var r4 = new f('A'); >r4 : Object diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt b/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt index 849f4922e45..6a8704ce554 100644 --- a/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt @@ -1,20 +1,13 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,5): error TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type '"I'm"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,37): error TS2304: Cannot find name 'Dinosaur'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (2 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (1 errors) ==== // Should all be strings. let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; type RexOrRaptor = "t-rex" | "raptor" let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; - ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type '"I'm"'. ~~~~~~~~ !!! error TS2304: Cannot find name 'Dinosaur'. diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt index df05e25304f..6e4f8943fb6 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.errors.txt @@ -2,12 +2,9 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(18,10) tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(20,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(22,21): error TS2304: Cannot find name 'is'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. - Types of property 'kind' are incompatible. - Type 'string' is not assignable to type '"A"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (5 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (4 errors) ==== type Kind = "A" | "B" @@ -41,10 +38,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): } let x: A = { - ~ -!!! error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'. -!!! error TS2322: Types of property 'kind' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type '"A"'. kind: "A", a: 100, } diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt index 3dd2adbbce0..1a639a1c222 100644 --- a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt @@ -1,17 +1,7 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,7): error TS1155: 'const' declarations must be initialized -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(7,1): error TS2322: Type 'string' is not assignable to type '""'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(8,1): error TS2322: Type 'string' is not assignable to type '"foo"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(9,1): error TS2322: Type 'string' is not assignable to type '"bar"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,5): error TS2322: Type 'string' is not assignable to type '""'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,5): error TS2322: Type 'string' is not assignable to type '"foo"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,5): error TS2322: Type 'string' is not assignable to type '"bar"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,7): error TS2322: Type 'string' is not assignable to type '"baz"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(16,1): error TS2322: Type 'string' is not assignable to type '""'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(17,1): error TS2322: Type 'string' is not assignable to type '"foo"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(18,1): error TS2322: Type 'string' is not assignable to type '"bar"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (11 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (1 errors) ==== let a: ""; var b: "foo"; @@ -21,34 +11,14 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarat !!! error TS1155: 'const' declarations must be initialized a = ""; - ~ -!!! error TS2322: Type 'string' is not assignable to type '""'. b = "foo"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. c = "bar"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"bar"'. let e: "" = ""; - ~ -!!! error TS2322: Type 'string' is not assignable to type '""'. var f: "foo" = "foo"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. let g: "bar" = "bar"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"bar"'. const h: "baz" = "baz"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"baz"'. e = ""; - ~ -!!! error TS2322: Type 'string' is not assignable to type '""'. f = "foo"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. - g = "bar"; - ~ -!!! error TS2322: Type 'string' is not assignable to type '"bar"'. \ No newline at end of file + g = "bar"; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt index 6e0fd982638..1592427208b 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(11,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,7): error TS2322: Type 'string' is not assignable to type '"string"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,7): error TS2322: Type 'string' is not assignable to type '"number"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,7): error TS2322: Type 'string' is not assignable to type '"boolean"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (4 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (1 errors) ==== type PrimitiveName = 'string' | 'number' | 'boolean'; @@ -39,14 +36,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34, } const string: "string" = "string" - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"string"'. const number: "number" = "number" - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"number"'. const boolean: "boolean" = "boolean" - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"boolean"'. const stringOrNumber = string || number; const stringOrBoolean = string || boolean; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt index ae9fb9ce4f6..995cf687b70 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(9,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,7): error TS2322: Type 'string' is not assignable to type '"string"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,7): error TS2322: Type 'string' is not assignable to type '"number"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,7): error TS2322: Type 'string' is not assignable to type '"boolean"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (4 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (1 errors) ==== function getFalsyPrimitive(x: "string"): string; function getFalsyPrimitive(x: "number"): number; @@ -37,14 +34,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32, } const string: "string" = "string" - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"string"'. const number: "number" = "number" - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"number"'. const boolean: "boolean" = "boolean" - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type '"boolean"'. const stringOrNumber = string || number; const stringOrBoolean = string || boolean; diff --git a/tests/baselines/reference/symbolProperty41.types b/tests/baselines/reference/symbolProperty41.types index 61b71dfe246..f312481ac04 100644 --- a/tests/baselines/reference/symbolProperty41.types +++ b/tests/baselines/reference/symbolProperty41.types @@ -49,5 +49,5 @@ c[Symbol.iterator]("hello"); >Symbol.iterator : symbol >Symbol : SymbolConstructor >iterator : symbol ->"hello" : string +>"hello" : "hello" diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt index 413d2127003..69f8d6581a1 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -14,9 +14,9 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. Type 'string' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. @@ -25,7 +25,7 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 Type '"World"' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. @@ -119,14 +119,14 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 // as "Hello" (or "Hello" | "Hello"). export let a = fun1<"Hello">("Hello", "Hello"); export let b = fun1<"Hello">("Hello", "World"); - ~~~~~~~ + ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let c = fun2<"Hello", "Hello">("Hello", "Hello"); export let d = fun2<"Hello", "Hello">("Hello", "World"); - ~~~~~~~ + ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let e = fun3<"Hello">("Hello", "World"); - ~~~~~~~ + ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. // Assignment from the returned value should cause an error. @@ -173,8 +173,8 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. export let d = fun2<"World", "Hello">("World", "World"); - ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. export let e = fun3<"Hello" | "World">("Hello", "World"); // Assignment from the returned value should cause an error. diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.types b/tests/baselines/reference/typesWithSpecializedCallSignatures.types index 113e24456f9..b587ee7840e 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.types +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.types @@ -125,7 +125,7 @@ var r1: Derived1 = c.foo('hi'); >c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >c : C >foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } ->'hi' : string +>'hi' : "hi" var r2: Derived2 = c.foo('bye'); >r2 : Derived2 @@ -134,7 +134,7 @@ var r2: Derived2 = c.foo('bye'); >c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } >c : C >foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; } ->'bye' : string +>'bye' : "bye" var r3: Base = c.foo('hm'); >r3 : Base diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.types b/tests/baselines/reference/typesWithSpecializedConstructSignatures.types index 2698439c527..3036c0cea71 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.types +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.types @@ -100,14 +100,14 @@ var r1 = new C('hi'); >r1 : C >new C('hi') : C >C : typeof C ->'hi' : string +>'hi' : "hi" var r2: Derived2 = new i('bye'); >r2 : Derived2 >Derived2 : Derived2 >new i('bye') : Derived2 >i : I ->'bye' : string +>'bye' : "bye" var r3: Base = new a('hm'); >r3 : Base From 4b736da23172030a4a7970e06fa20cb094167535 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 16:30:22 -0700 Subject: [PATCH 021/140] Fixed issue in test. --- .../types/stringLiteral/stringLiteralTypesAndTuples01.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts index 7ac9aa3b427..388f4567ed7 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts @@ -4,7 +4,7 @@ let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; type RexOrRaptor = "t-rex" | "raptor" -let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; +let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; rawr(dinosaur); From fd5dec4ff12aceb9be710624a5dc6d871e576e58 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 2 Oct 2015 16:34:15 -0700 Subject: [PATCH 022/140] Accepted baselines. --- .../stringLiteralTypesAndTuples01.errors.txt | 25 -------- .../stringLiteralTypesAndTuples01.js | 4 +- .../stringLiteralTypesAndTuples01.symbols | 41 +++++++++++++ .../stringLiteralTypesAndTuples01.types | 59 +++++++++++++++++++ 4 files changed, 102 insertions(+), 27 deletions(-) delete mode 100644 tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAndTuples01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesAndTuples01.types diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt b/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt deleted file mode 100644 index 6a8704ce554..00000000000 --- a/tests/baselines/reference/stringLiteralTypesAndTuples01.errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,37): error TS2304: Cannot find name 'Dinosaur'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (1 errors) ==== - - // Should all be strings. - let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; - - type RexOrRaptor = "t-rex" | "raptor" - let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; - ~~~~~~~~ -!!! error TS2304: Cannot find name 'Dinosaur'. - - rawr(dinosaur); - - function rawr(dino: RexOrRaptor) { - if (dino === "t-rex") { - return "ROAAAAR!"; - } - if (dino === "raptor") { - return "yip yip!"; - } - - throw "Unexpected " + dino; - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.js b/tests/baselines/reference/stringLiteralTypesAndTuples01.js index 66e57b1eea5..ae02d12429a 100644 --- a/tests/baselines/reference/stringLiteralTypesAndTuples01.js +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.js @@ -4,7 +4,7 @@ let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; type RexOrRaptor = "t-rex" | "raptor" -let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex']; +let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; rawr(dinosaur); @@ -38,5 +38,5 @@ function rawr(dino) { //// [stringLiteralTypesAndTuples01.d.ts] declare let hello: string, brave: string, newish: string, world: string; declare type RexOrRaptor = "t-rex" | "raptor"; -declare let im: "I'm", a: "a", dinosaur: any; +declare let im: "I'm", a: "a", dinosaur: "t-rex" | "raptor"; declare function rawr(dino: RexOrRaptor): string; diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.symbols b/tests/baselines/reference/stringLiteralTypesAndTuples01.symbols new file mode 100644 index 00000000000..b7ca53517ca --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.symbols @@ -0,0 +1,41 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts === + +// Should all be strings. +let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; +>hello : Symbol(hello, Decl(stringLiteralTypesAndTuples01.ts, 2, 5)) +>brave : Symbol(brave, Decl(stringLiteralTypesAndTuples01.ts, 2, 11)) +>newish : Symbol(newish, Decl(stringLiteralTypesAndTuples01.ts, 2, 18)) +>world : Symbol(world, Decl(stringLiteralTypesAndTuples01.ts, 2, 26)) + +type RexOrRaptor = "t-rex" | "raptor" +>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71)) + +let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; +>im : Symbol(im, Decl(stringLiteralTypesAndTuples01.ts, 5, 5)) +>a : Symbol(a, Decl(stringLiteralTypesAndTuples01.ts, 5, 8)) +>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 5, 11)) +>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71)) + +rawr(dinosaur); +>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 7, 15)) +>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 5, 11)) + +function rawr(dino: RexOrRaptor) { +>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 7, 15)) +>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14)) +>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71)) + + if (dino === "t-rex") { +>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14)) + + return "ROAAAAR!"; + } + if (dino === "raptor") { +>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14)) + + return "yip yip!"; + } + + throw "Unexpected " + dino; +>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14)) +} diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.types b/tests/baselines/reference/stringLiteralTypesAndTuples01.types new file mode 100644 index 00000000000..740cf237412 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts === + +// Should all be strings. +let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"]; +>hello : string +>brave : string +>newish : string +>world : string +>["Hello", "Brave", "New", "World"] : [string, string, string, string] +>"Hello" : string +>"Brave" : string +>"New" : string +>"World" : string + +type RexOrRaptor = "t-rex" | "raptor" +>RexOrRaptor : "t-rex" | "raptor" + +let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; +>im : "I'm" +>a : "a" +>dinosaur : "t-rex" | "raptor" +>RexOrRaptor : "t-rex" | "raptor" +>['I\'m', 'a', 't-rex'] : ["I'm", "a", "t-rex" | "raptor"] +>'I\'m' : "I'm" +>'a' : "a" +>'t-rex' : "t-rex" | "raptor" + +rawr(dinosaur); +>rawr(dinosaur) : string +>rawr : (dino: "t-rex" | "raptor") => string +>dinosaur : "t-rex" | "raptor" + +function rawr(dino: RexOrRaptor) { +>rawr : (dino: "t-rex" | "raptor") => string +>dino : "t-rex" | "raptor" +>RexOrRaptor : "t-rex" | "raptor" + + if (dino === "t-rex") { +>dino === "t-rex" : boolean +>dino : "t-rex" | "raptor" +>"t-rex" : string + + return "ROAAAAR!"; +>"ROAAAAR!" : string + } + if (dino === "raptor") { +>dino === "raptor" : boolean +>dino : "t-rex" | "raptor" +>"raptor" : string + + return "yip yip!"; +>"yip yip!" : string + } + + throw "Unexpected " + dino; +>"Unexpected " + dino : string +>"Unexpected " : string +>dino : "t-rex" | "raptor" +} From 4c4087c6566becf9f7e8d9f38daafc0c07540ab8 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 17:03:29 -0700 Subject: [PATCH 023/140] Add compiler error for incompatible module formats --- Jakefile.js | 2 +- src/compiler/diagnosticMessages.json | 20 ++++++++++++-------- src/compiler/emitter.ts | 4 ++-- src/compiler/program.ts | 5 +++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 943f2eff5ec..84f2d527857 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -225,7 +225,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) { file(outFile, prereqs, function() { var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; - var options = "--module commonjs --noImplicitAny --noEmitOnError"; + var options = "--noImplicitAny --noEmitOnError"; // Keep comments when specifically requested // or when in debug mode. diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6986d7ff5fb..0685eb44304 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2262,14 +2262,6 @@ "code": 6063 }, - "Specify JSX code generation: 'preserve' or 'react'": { - "category": "Message", - "code": 6080 - }, - "Argument for '--jsx' must be 'preserve' or 'react'.": { - "category": "Message", - "code": 6081 - }, "Enables experimental support for ES7 decorators.": { "category": "Message", "code": 6065 @@ -2302,6 +2294,18 @@ "category": "Message", "code": 6072 }, + "Specify JSX code generation: 'preserve' or 'react'": { + "category": "Message", + "code": 6080 + }, + "Argument for '--jsx' must be 'preserve' or 'react'.": { + "category": "Message", + "code": 6081 + }, + "Only 'amd', 'umd', and 'system' modules are supported alongside --{0}.": { + "category": "Error", + "code": 6082 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 52b8760bbd1..7e4a1714d51 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -457,11 +457,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi }; let bundleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = { - [ModuleKind.ES6]: () => {}, + [ModuleKind.ES6]() { }, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, [ModuleKind.UMD]: emitUMDModule, - [ModuleKind.CommonJS]: () => {}, + [ModuleKind.CommonJS]() { }, }; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f54906d85ee..163ddfa36c1 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1063,6 +1063,11 @@ namespace ts { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } + // Cannot specify module gen that isn't amd, umd, or system with --out + if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.UMD && options.module !== ModuleKind.System) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_umd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } + if (options.noEmit) { if (options.out) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); From 145fa0cdf6b8351b2f3fd6d666bb3ec815d87e0e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 17:11:03 -0700 Subject: [PATCH 024/140] Accept baselines --- .../baselines/reference/out-flag2.errors.txt | 10 +++++ tests/baselines/reference/out-flag2.symbols | 9 ---- tests/baselines/reference/out-flag2.types | 9 ---- .../baselines/reference/out-flag3.errors.txt | 2 + .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...thModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...athMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...lutePathSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...PathSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...ePathSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...thModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 33 ++++++++++++++ .../node/bin/test.js | 33 ++++++++++++++ ...athMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...tivePathSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...PathSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...ePathSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...rlModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...UrlMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...prootUrlSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...tUrlSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...otUrlSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...rlModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...UrlMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...erootUrlSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...tUrlSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...otUrlSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.d.ts | 13 ++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.d.ts | 13 ++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.d.ts | 0 ...utModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...outMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../outSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ .../outSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ .../outSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../prologueEmit/node/prologueEmit.errors.txt | 14 ++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...thModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...athMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...lutePathSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...PathSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...ePathSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...thModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...athMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...tivePathSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...PathSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...ePathSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...apModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...mapMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...ourcemapSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...emapSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...cemapSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ .../amd/bin/test.js | 37 +++++++++++++++ .../node/bin/test.js | 23 ++++++++++ ...MixedSubfolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ .../amd/bin/outAndOutDirFile.js | 37 +++++++++++++++ .../node/bin/outAndOutDirFile.js | 23 ++++++++++ ...ifyOutputFileAndOutputDirectory.errors.txt | 36 +++++++++++++++ .../amd/bin/test.js | 45 +++++++++++++++++++ .../node/bin/test.js | 1 + ...uleMultifolderSpecifyOutputFile.errors.txt | 39 ++++++++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...rlModuleSimpleSpecifyOutputFile.errors.txt | 27 +++++++++++ .../amd/bin/test.js | 30 +++++++++++++ .../node/bin/test.js | 1 + ...oduleSubfolderSpecifyOutputFile.errors.txt | 27 +++++++++++ ...UrlMultifolderSpecifyOutputFile.errors.txt | 36 +++++++++++++++ ...erootUrlSimpleSpecifyOutputFile.errors.txt | 25 +++++++++++ ...tUrlSingleFileSpecifyOutputFile.errors.txt | 14 ++++++ ...otUrlSubfolderSpecifyOutputFile.errors.txt | 25 +++++++++++ 173 files changed, 4327 insertions(+), 18 deletions(-) create mode 100644 tests/baselines/reference/out-flag2.errors.txt delete mode 100644 tests/baselines/reference/out-flag2.symbols delete mode 100644 tests/baselines/reference/out-flag2.types create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt create mode 100644 tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt diff --git a/tests/baselines/reference/out-flag2.errors.txt b/tests/baselines/reference/out-flag2.errors.txt new file mode 100644 index 00000000000..755019b52b0 --- /dev/null +++ b/tests/baselines/reference/out-flag2.errors.txt @@ -0,0 +1,10 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== tests/cases/compiler/a.ts (0 errors) ==== + + class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + class B { } \ No newline at end of file diff --git a/tests/baselines/reference/out-flag2.symbols b/tests/baselines/reference/out-flag2.symbols deleted file mode 100644 index 1bca057c580..00000000000 --- a/tests/baselines/reference/out-flag2.symbols +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/a.ts === - -class A { } ->A : Symbol(A, Decl(a.ts, 0, 0)) - -=== tests/cases/compiler/b.ts === -class B { } ->B : Symbol(B, Decl(b.ts, 0, 0)) - diff --git a/tests/baselines/reference/out-flag2.types b/tests/baselines/reference/out-flag2.types deleted file mode 100644 index 5a13642f99f..00000000000 --- a/tests/baselines/reference/out-flag2.types +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/a.ts === - -class A { } ->A : A - -=== tests/cases/compiler/b.ts === -class B { } ->B : B - diff --git a/tests/baselines/reference/out-flag3.errors.txt b/tests/baselines/reference/out-flag3.errors.txt index 6b7dda7c962..ab44f4e94fd 100644 --- a/tests/baselines/reference/out-flag3.errors.txt +++ b/tests/baselines/reference/out-flag3.errors.txt @@ -1,7 +1,9 @@ error TS5053: Option 'out' cannot be specified with option 'outFile'. +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --out. !!! error TS5053: Option 'out' cannot be specified with option 'outFile'. +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --out. ==== tests/cases/compiler/a.ts (0 errors) ==== // --out and --outFile error diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..af837fd2031 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..7ef36232b8d --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..de704afeedb --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..fc53d59d7cb --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..25cd156c4ab --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..18e06e5bc50 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..d3d9bd9dc85 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..f6e3eb542f4 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..176c3f78407 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..7ff280253f1 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..bd14cd07502 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..c4c79e0454b --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..59405bccb9c --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..c0138423cae --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../mapFiles/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..8b109433561 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..f359cef4be2 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..8ff2bbdb75b --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..58e831a041d --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..ccc0a7b503b --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..58e831a041d --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..acd2d113c02 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,33 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +var m2_a1 = 10; +var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; +})(); +var m2_instance1 = new m2_c1(); +function m2_f1() { + return m2_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..acd2d113c02 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,33 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +var m2_a1 = 10; +var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; +})(); +var m2_instance1 = new m2_c1(); +function m2_f1() { + return m2_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=../../../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..6fbac81a12d --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..af0071d7e46 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..8c16871c4a7 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..2ebe138ffda --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..0734d350e11 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..77db9e80a53 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..10c38a74411 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..6fbac81a12d --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..af0071d7e46 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..8c16871c4a7 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..2ebe138ffda --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=http://www.typescriptlang.org/outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..0734d350e11 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..77db9e80a53 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..10c38a74411 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..52f1b822100 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt new file mode 100644 index 00000000000..5225c47ee97 --- /dev/null +++ b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== globalThisCapture.ts (0 errors) ==== + // Add a lambda to ensure global 'this' capture is triggered + (()=>this.window); + +==== __extends.ts (0 errors) ==== + // class inheritance to ensure __extends is emitted + module m { + export class base {} + export class child extends base {} + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..13e9de8f87f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..5af28cf8560 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..81bb710c580 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..1750a5975ae --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..994e21ca032 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..f385e49ecd1 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..18d212c7e69 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..13e9de8f87f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..5af28cf8560 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..81bb710c580 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..1750a5975ae --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..994e21ca032 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..f385e49ecd1 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..18d212c7e69 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..13e9de8f87f --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..5af28cf8560 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..81bb710c580 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..1750a5975ae --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..994e21ca032 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..f385e49ecd1 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..18d212c7e69 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..13e9de8f87f --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..5af28cf8560 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..81bb710c580 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js @@ -0,0 +1,37 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +define("ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js new file mode 100644 index 00000000000..1750a5975ae --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js @@ -0,0 +1,23 @@ +var m1_a1 = 10; +var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; +})(); +var m1_instance1 = new m1_c1(); +function m1_f1() { + return m1_instance1; +} +/// +/// +var a1 = 10; +var c1 = (function () { + function c1() { + } + return c1; +})(); +var instance1 = new c1(); +function f1() { + return instance1; +} +//# sourceMappingURL=outAndOutDirFile.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt new file mode 100644 index 00000000000..9674c11863f --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..994e21ca032 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,45 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) { + exports.m2_a1 = 10; + var m2_c1 = (function () { + function m2_c1() { + } + return m2_c1; + })(); + exports.m2_c1 = m2_c1; + exports.m2_instance1 = new m2_c1(); + function m2_f1() { + return exports.m2_instance1; + } + exports.m2_f1 = m2_f1; +}); +define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; + exports.a3 = m2.m2_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..ea8c2e58ae5 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,39 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== + export var m2_a1 = 10; + export class m2_c1 { + public m2_c1_p1: number; + } + + export var m2_instance1 = new m2_c1(); + export function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; + export var a3 = m2.m2_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..f385e49ecd1 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..0d918d5b2a0 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js new file mode 100644 index 00000000000..18d212c7e69 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.js @@ -0,0 +1,30 @@ +define("ref/m1", ["require", "exports"], function (require, exports) { + exports.m1_a1 = 10; + var m1_c1 = (function () { + function m1_c1() { + } + return m1_c1; + })(); + exports.m1_c1 = m1_c1; + exports.m1_instance1 = new m1_c1(); + function m1_f1() { + return exports.m1_instance1; + } + exports.m1_f1 = m1_f1; +}); +define("test", ["require", "exports", "ref/m1"], function (require, exports, m1) { + exports.a1 = 10; + var c1 = (function () { + function c1() { + } + return c1; + })(); + exports.c1 = c1; + exports.instance1 = new c1(); + function f1() { + return exports.instance1; + } + exports.f1 = f1; + exports.a2 = m1.m1_c1; +}); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js new file mode 100644 index 00000000000..6f3fefb9498 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..2468ab068e2 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,27 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + export var m1_a1 = 10; + export class m1_c1 { + public m1_c1_p1: number; + } + + export var m1_instance1 = new m1_c1(); + export function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + import m1 = require("ref/m1"); + export var a1 = 10; + export class c1 { + public p1: number; + } + + export var instance1 = new c1(); + export function f1() { + return instance1; + } + + export var a2 = m1.m1_c1; \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..8deca814d80 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -0,0 +1,36 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== + var m2_a1 = 10; + class m2_c1 { + public m2_c1_p1: number; + } + + var m2_instance1 = new m2_c1(); + function m2_f1() { + return m2_instance1; + } +==== test.ts (0 errors) ==== + /// + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..edf8d0637e2 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3413d4675e7 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt @@ -0,0 +1,14 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== test.ts (0 errors) ==== + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt new file mode 100644 index 00000000000..3a508fede30 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -0,0 +1,25 @@ +error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +==== ref/m1.ts (0 errors) ==== + var m1_a1 = 10; + class m1_c1 { + public m1_c1_p1: number; + } + + var m1_instance1 = new m1_c1(); + function m1_f1() { + return m1_instance1; + } +==== test.ts (0 errors) ==== + /// + var a1 = 10; + class c1 { + public p1: number; + } + + var instance1 = new c1(); + function f1() { + return instance1; + } \ No newline at end of file From 03256e7c8627e1af66f9704ecfa3a89956e42f2a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 17:43:58 -0700 Subject: [PATCH 025/140] cusotm tests, forbid umd --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/emitter.ts | 10 +++++----- src/compiler/program.ts | 4 ++-- tests/cases/compiler/outModuleConcatAmd.ts | 12 ++++++++++++ tests/cases/compiler/outModuleConcatCommonjs.ts | 14 ++++++++++++++ tests/cases/compiler/outModuleConcatES6.ts | 14 ++++++++++++++ tests/cases/compiler/outModuleConcatSystem.ts | 12 ++++++++++++ tests/cases/compiler/outModuleConcatUmd.ts | 14 ++++++++++++++ 8 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 tests/cases/compiler/outModuleConcatAmd.ts create mode 100644 tests/cases/compiler/outModuleConcatCommonjs.ts create mode 100644 tests/cases/compiler/outModuleConcatES6.ts create mode 100644 tests/cases/compiler/outModuleConcatSystem.ts create mode 100644 tests/cases/compiler/outModuleConcatUmd.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0685eb44304..a222aa6a344 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2302,7 +2302,7 @@ "category": "Message", "code": 6081 }, - "Only 'amd', 'umd', and 'system' modules are supported alongside --{0}.": { + "Only 'amd' and 'system' modules are supported alongside --{0}.": { "category": "Error", "code": 6082 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 7e4a1714d51..4ce0a39eb07 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -457,11 +457,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi }; let bundleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = { - [ModuleKind.ES6]() { }, + [ModuleKind.ES6]() {}, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, - [ModuleKind.UMD]: emitUMDModule, - [ModuleKind.CommonJS]() { }, + [ModuleKind.UMD]() {}, + [ModuleKind.CommonJS]() {}, }; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { @@ -6827,11 +6827,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitExportEquals(/*emitAsReturn*/ false); } - function emitUMDModule(node: SourceFile, startIndex: number, resolvePath?: boolean) { + function emitUMDModule(node: SourceFile, startIndex: number) { emitEmitHelpers(node); collectExternalModuleInfo(node); - let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false, resolvePath); + let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false); // Module is detected first to support Browserify users that load into a browser with an AMD loader writeLines(`(function (factory) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 163ddfa36c1..0cdcddbb0ed 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1064,8 +1064,8 @@ namespace ts { } // Cannot specify module gen that isn't amd, umd, or system with --out - if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.UMD && options.module !== ModuleKind.System) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_umd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.System) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } if (options.noEmit) { diff --git a/tests/cases/compiler/outModuleConcatAmd.ts b/tests/cases/compiler/outModuleConcatAmd.ts new file mode 100644 index 00000000000..411a13e72a2 --- /dev/null +++ b/tests/cases/compiler/outModuleConcatAmd.ts @@ -0,0 +1,12 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: amd +// @outFile: all.js + +// @Filename: ref/a.ts +export class A { } + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } \ No newline at end of file diff --git a/tests/cases/compiler/outModuleConcatCommonjs.ts b/tests/cases/compiler/outModuleConcatCommonjs.ts new file mode 100644 index 00000000000..0cb57bd11e7 --- /dev/null +++ b/tests/cases/compiler/outModuleConcatCommonjs.ts @@ -0,0 +1,14 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: commonjs +// @outFile: all.js + +// This should be an error + +// @Filename: ref/a.ts +export class A { } + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } \ No newline at end of file diff --git a/tests/cases/compiler/outModuleConcatES6.ts b/tests/cases/compiler/outModuleConcatES6.ts new file mode 100644 index 00000000000..e98514e9adc --- /dev/null +++ b/tests/cases/compiler/outModuleConcatES6.ts @@ -0,0 +1,14 @@ +// @target: ES6 +// @sourcemap: true +// @declaration: true +// @module: es6 +// @outFile: all.js + +// This should be an error + +// @Filename: ref/a.ts +export class A { } + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } \ No newline at end of file diff --git a/tests/cases/compiler/outModuleConcatSystem.ts b/tests/cases/compiler/outModuleConcatSystem.ts new file mode 100644 index 00000000000..c8d9b4e9737 --- /dev/null +++ b/tests/cases/compiler/outModuleConcatSystem.ts @@ -0,0 +1,12 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: system +// @outFile: all.js + +// @Filename: ref/a.ts +export class A { } + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } \ No newline at end of file diff --git a/tests/cases/compiler/outModuleConcatUmd.ts b/tests/cases/compiler/outModuleConcatUmd.ts new file mode 100644 index 00000000000..fa4a4a519c6 --- /dev/null +++ b/tests/cases/compiler/outModuleConcatUmd.ts @@ -0,0 +1,14 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: umd +// @outFile: all.js + +// This should error + +// @Filename: ref/a.ts +export class A { } + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } \ No newline at end of file From 3c73a66ba70baa710cf0de15ca0fa8ced6e09f26 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 17:51:59 -0700 Subject: [PATCH 026/140] removed umd as allowed, accepted new baselines --- .../baselines/reference/out-flag2.errors.txt | 4 +- .../baselines/reference/out-flag3.errors.txt | 4 +- .../baselines/reference/outModuleConcatAmd.js | 69 ++++ .../reference/outModuleConcatAmd.js.map | 4 + .../outModuleConcatAmd.sourcemap.txt | 333 +++++++++++++++++ .../reference/outModuleConcatAmd.symbols | 13 + .../reference/outModuleConcatAmd.types | 13 + .../outModuleConcatCommonjs.errors.txt | 13 + .../reference/outModuleConcatCommonjs.js | 52 +++ .../reference/outModuleConcatCommonjs.js.map | 4 + .../outModuleConcatCommonjs.sourcemap.txt | 220 +++++++++++ .../reference/outModuleConcatES6.errors.txt | 13 + .../baselines/reference/outModuleConcatES6.js | 32 ++ .../reference/outModuleConcatES6.js.map | 4 + .../outModuleConcatES6.sourcemap.txt | 118 ++++++ .../reference/outModuleConcatSystem.js | 101 +++++ .../reference/outModuleConcatSystem.js.map | 4 + .../outModuleConcatSystem.sourcemap.txt | 353 ++++++++++++++++++ .../reference/outModuleConcatSystem.symbols | 13 + .../reference/outModuleConcatSystem.types | 13 + .../reference/outModuleConcatUmd.errors.txt | 13 + .../baselines/reference/outModuleConcatUmd.js | 70 ++++ .../reference/outModuleConcatUmd.js.map | 4 + .../outModuleConcatUmd.sourcemap.txt | 237 ++++++++++++ .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...thModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...athMultifolderSpecifyOutputFile.errors.txt | 4 +- ...lutePathSimpleSpecifyOutputFile.errors.txt | 4 +- ...PathSingleFileSpecifyOutputFile.errors.txt | 4 +- ...ePathSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...thModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 18 + .../node/bin/test.d.ts | 18 + ...athMultifolderSpecifyOutputFile.errors.txt | 4 +- ...tivePathSimpleSpecifyOutputFile.errors.txt | 4 +- ...PathSingleFileSpecifyOutputFile.errors.txt | 4 +- ...ePathSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...rlModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...UrlMultifolderSpecifyOutputFile.errors.txt | 4 +- ...prootUrlSimpleSpecifyOutputFile.errors.txt | 4 +- ...tUrlSingleFileSpecifyOutputFile.errors.txt | 4 +- ...otUrlSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...rlModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...UrlMultifolderSpecifyOutputFile.errors.txt | 4 +- ...erootUrlSimpleSpecifyOutputFile.errors.txt | 4 +- ...tUrlSingleFileSpecifyOutputFile.errors.txt | 4 +- ...otUrlSubfolderSpecifyOutputFile.errors.txt | 4 +- ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- ...utModuleSimpleSpecifyOutputFile.errors.txt | 4 +- ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...outMultifolderSpecifyOutputFile.errors.txt | 4 +- .../outSimpleSpecifyOutputFile.errors.txt | 4 +- .../outSingleFileSpecifyOutputFile.errors.txt | 4 +- .../outSubfolderSpecifyOutputFile.errors.txt | 4 +- .../prologueEmit/node/prologueEmit.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...thModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...athMultifolderSpecifyOutputFile.errors.txt | 4 +- ...lutePathSimpleSpecifyOutputFile.errors.txt | 4 +- ...PathSingleFileSpecifyOutputFile.errors.txt | 4 +- ...ePathSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...thModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...athMultifolderSpecifyOutputFile.errors.txt | 4 +- ...tivePathSimpleSpecifyOutputFile.errors.txt | 4 +- ...PathSingleFileSpecifyOutputFile.errors.txt | 4 +- ...ePathSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...apModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...mapMultifolderSpecifyOutputFile.errors.txt | 4 +- ...ourcemapSimpleSpecifyOutputFile.errors.txt | 4 +- ...emapSingleFileSpecifyOutputFile.errors.txt | 4 +- ...cemapSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 13 + .../node/bin/test.d.ts | 13 + ...MixedSubfolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/outAndOutDirFile.d.ts | 13 + .../node/bin/outAndOutDirFile.d.ts | 13 + ...ifyOutputFileAndOutputDirectory.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...uleMultifolderSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...rlModuleSimpleSpecifyOutputFile.errors.txt | 4 +- .../amd/bin/test.d.ts | 0 .../node/bin/test.d.ts | 0 ...oduleSubfolderSpecifyOutputFile.errors.txt | 4 +- ...UrlMultifolderSpecifyOutputFile.errors.txt | 4 +- ...erootUrlSimpleSpecifyOutputFile.errors.txt | 4 +- ...tUrlSingleFileSpecifyOutputFile.errors.txt | 4 +- ...otUrlSubfolderSpecifyOutputFile.errors.txt | 4 +- 188 files changed, 2316 insertions(+), 168 deletions(-) create mode 100644 tests/baselines/reference/outModuleConcatAmd.js create mode 100644 tests/baselines/reference/outModuleConcatAmd.js.map create mode 100644 tests/baselines/reference/outModuleConcatAmd.sourcemap.txt create mode 100644 tests/baselines/reference/outModuleConcatAmd.symbols create mode 100644 tests/baselines/reference/outModuleConcatAmd.types create mode 100644 tests/baselines/reference/outModuleConcatCommonjs.errors.txt create mode 100644 tests/baselines/reference/outModuleConcatCommonjs.js create mode 100644 tests/baselines/reference/outModuleConcatCommonjs.js.map create mode 100644 tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt create mode 100644 tests/baselines/reference/outModuleConcatES6.errors.txt create mode 100644 tests/baselines/reference/outModuleConcatES6.js create mode 100644 tests/baselines/reference/outModuleConcatES6.js.map create mode 100644 tests/baselines/reference/outModuleConcatES6.sourcemap.txt create mode 100644 tests/baselines/reference/outModuleConcatSystem.js create mode 100644 tests/baselines/reference/outModuleConcatSystem.js.map create mode 100644 tests/baselines/reference/outModuleConcatSystem.sourcemap.txt create mode 100644 tests/baselines/reference/outModuleConcatSystem.symbols create mode 100644 tests/baselines/reference/outModuleConcatSystem.types create mode 100644 tests/baselines/reference/outModuleConcatUmd.errors.txt create mode 100644 tests/baselines/reference/outModuleConcatUmd.js create mode 100644 tests/baselines/reference/outModuleConcatUmd.js.map create mode 100644 tests/baselines/reference/outModuleConcatUmd.sourcemap.txt create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts create mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts diff --git a/tests/baselines/reference/out-flag2.errors.txt b/tests/baselines/reference/out-flag2.errors.txt index 755019b52b0..ea6fed45bd0 100644 --- a/tests/baselines/reference/out-flag2.errors.txt +++ b/tests/baselines/reference/out-flag2.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== tests/cases/compiler/a.ts (0 errors) ==== class A { } diff --git a/tests/baselines/reference/out-flag3.errors.txt b/tests/baselines/reference/out-flag3.errors.txt index ab44f4e94fd..c01cef151f3 100644 --- a/tests/baselines/reference/out-flag3.errors.txt +++ b/tests/baselines/reference/out-flag3.errors.txt @@ -1,9 +1,9 @@ error TS5053: Option 'out' cannot be specified with option 'outFile'. -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --out. +error TS6082: Only 'amd' and 'system' modules are supported alongside --out. !!! error TS5053: Option 'out' cannot be specified with option 'outFile'. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --out. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. ==== tests/cases/compiler/a.ts (0 errors) ==== // --out and --outFile error diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js new file mode 100644 index 00000000000..f6af61005e9 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -0,0 +1,69 @@ +//// [tests/cases/compiler/outModuleConcatAmd.ts] //// + +//// [a.ts] + +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + +//// [a.js] +define(["require", "exports"], function (require, exports) { + var A = (function () { + function A() { + } + return A; + })(); + exports.A = A; +}); +//# sourceMappingURL=a.js.map//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +define(["require", "exports", "./ref/a"], function (require, exports, a_1) { + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports.B = B; +}); +//# sourceMappingURL=b.js.map//// [all.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { + var A = (function () { + function A() { + } + return A; + })(); + exports.A = A; +}); +define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports.B = B; +}); +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] diff --git a/tests/baselines/reference/outModuleConcatAmd.js.map b/tests/baselines/reference/outModuleConcatAmd.js.map new file mode 100644 index 00000000000..88e6fa81885 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatAmd.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";IACA;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;IACA;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":";;;;;;IACA;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA;;;ICAlB;QAAuBE,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt new file mode 100644 index 00000000000..4ec8e34e8e1 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -0,0 +1,333 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>define(["require", "exports"], function (require, exports) { +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(2, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(3, 9) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(4, 9) Source(2, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(4, 10) Source(2, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 9) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(5, 17) Source(2, 19) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { } +1 >Emitted(6, 5) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(6, 6) Source(2, 19) + SourceIndex(0) name (A) +3 >Emitted(6, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(6, 10) Source(2, 19) + SourceIndex(0) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > { } +4 > +1->Emitted(7, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(7, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(7, 18) Source(2, 19) + SourceIndex(0) +4 >Emitted(7, 19) Source(2, 19) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=a.js.map=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>define(["require", "exports", "./ref/a"], function (require, exports, a_1) { +>>> var B = (function (_super) { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(7, 5) Source(2, 1) + SourceIndex(0) +--- +>>> __extends(B, _super); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(8, 9) Source(2, 24) + SourceIndex(0) name (B) +2 >Emitted(8, 30) Source(2, 25) + SourceIndex(0) name (B) +--- +>>> function B() { +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(9, 9) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(10, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) +2 >Emitted(10, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(11, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) +2 >Emitted(11, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(12, 9) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(12, 17) Source(2, 29) + SourceIndex(0) name (B) +--- +>>> })(a_1.A); +1 >^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(13, 5) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(13, 6) Source(2, 29) + SourceIndex(0) name (B) +3 >Emitted(13, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(13, 8) Source(2, 24) + SourceIndex(0) +5 >Emitted(13, 13) Source(2, 25) + SourceIndex(0) +6 >Emitted(13, 15) Source(2, 29) + SourceIndex(0) +--- +>>> exports.B = B; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > B +3 > extends A { } +4 > +1->Emitted(14, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(14, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(14, 18) Source(2, 29) + SourceIndex(0) +4 >Emitted(14, 19) Source(2, 29) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=b.js.map=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 5) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(8, 9) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(9, 9) Source(2, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(9, 10) Source(2, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(10, 9) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(10, 17) Source(2, 19) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { } +1 >Emitted(11, 5) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(11, 6) Source(2, 19) + SourceIndex(0) name (A) +3 >Emitted(11, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(11, 10) Source(2, 19) + SourceIndex(0) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > { } +4 > +1->Emitted(12, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(12, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(12, 18) Source(2, 19) + SourceIndex(0) +4 >Emitted(12, 19) Source(2, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>}); +>>>define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +>>> var B = (function (_super) { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(15, 5) Source(2, 1) + SourceIndex(1) +--- +>>> __extends(B, _super); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(16, 9) Source(2, 24) + SourceIndex(1) name (B) +2 >Emitted(16, 30) Source(2, 25) + SourceIndex(1) name (B) +--- +>>> function B() { +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(17, 9) Source(2, 1) + SourceIndex(1) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(18, 13) Source(2, 24) + SourceIndex(1) name (B.constructor) +2 >Emitted(18, 43) Source(2, 25) + SourceIndex(1) name (B.constructor) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(19, 9) Source(2, 28) + SourceIndex(1) name (B.constructor) +2 >Emitted(19, 10) Source(2, 29) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(2, 28) + SourceIndex(1) name (B) +2 >Emitted(20, 17) Source(2, 29) + SourceIndex(1) name (B) +--- +>>> })(a_1.A); +1 >^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(21, 5) Source(2, 28) + SourceIndex(1) name (B) +2 >Emitted(21, 6) Source(2, 29) + SourceIndex(1) name (B) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(21, 8) Source(2, 24) + SourceIndex(1) +5 >Emitted(21, 13) Source(2, 25) + SourceIndex(1) +6 >Emitted(21, 15) Source(2, 29) + SourceIndex(1) +--- +>>> exports.B = B; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > B +3 > extends A { } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(22, 14) Source(2, 15) + SourceIndex(1) +3 >Emitted(22, 18) Source(2, 29) + SourceIndex(1) +4 >Emitted(22, 19) Source(2, 29) + SourceIndex(1) +--- +>>>}); +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.symbols b/tests/baselines/reference/outModuleConcatAmd.symbols new file mode 100644 index 00000000000..349de40815a --- /dev/null +++ b/tests/baselines/reference/outModuleConcatAmd.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/ref/a.ts === + +export class A { } +>A : Symbol(A, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : Symbol(A, Decl(b.ts, 0, 8)) + +export class B extends A { } +>B : Symbol(B, Decl(b.ts, 0, 26)) +>A : Symbol(A, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/outModuleConcatAmd.types b/tests/baselines/reference/outModuleConcatAmd.types new file mode 100644 index 00000000000..6e0d9398853 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatAmd.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/ref/a.ts === + +export class A { } +>A : A + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : typeof A + +export class B extends A { } +>B : B +>A : A + diff --git a/tests/baselines/reference/outModuleConcatCommonjs.errors.txt b/tests/baselines/reference/outModuleConcatCommonjs.errors.txt new file mode 100644 index 00000000000..d1a2adbc93f --- /dev/null +++ b/tests/baselines/reference/outModuleConcatCommonjs.errors.txt @@ -0,0 +1,13 @@ +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. +==== tests/cases/compiler/ref/a.ts (0 errors) ==== + + // This should be an error + + export class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + import {A} from "./ref/a"; + export class B extends A { } \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js b/tests/baselines/reference/outModuleConcatCommonjs.js new file mode 100644 index 00000000000..ed19f93f702 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatCommonjs.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/outModuleConcatCommonjs.ts] //// + +//// [a.ts] + +// This should be an error + +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + +//// [a.js] +// This should be an error +var A = (function () { + function A() { + } + return A; +})(); +exports.A = A; +//# sourceMappingURL=a.js.map//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var a_1 = require("./ref/a"); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +})(a_1.A); +exports.B = B; +//# sourceMappingURL=b.js.map//// [all.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +// This should be an error +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js.map b/tests/baselines/reference/outModuleConcatCommonjs.js.map new file mode 100644 index 00000000000..babde662bc1 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatCommonjs.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":"AACA,0BAA0B;AAE1B;IAAAA;IAAiBC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAlB,IAAkB;AAAL,SAAC,IAAI,CAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;AAAA,kBAAgB,SAAS,CAAC,CAAA;AAC1B;IAAuBA,qBAACA;IAAxBA;QAAuBC,8BAACA;IAAGA,CAACA;IAADD,QAACA;AAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;AAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AACA,0BAA0B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt b/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt new file mode 100644 index 00000000000..22dda7ae4bf --- /dev/null +++ b/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt @@ -0,0 +1,220 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>// This should be an error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 >// This should be an error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 27) Source(2, 27) + SourceIndex(0) +--- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(4, 5) Source(4, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(4, 6) Source(4, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 18) + SourceIndex(0) name (A) +2 >Emitted(5, 13) Source(4, 19) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 >} +3 > +4 > export class A { } +1 >Emitted(6, 1) Source(4, 18) + SourceIndex(0) name (A) +2 >Emitted(6, 2) Source(4, 19) + SourceIndex(0) name (A) +3 >Emitted(6, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 19) + SourceIndex(0) +--- +>>>exports.A = A; +1-> +2 >^^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 >A +3 > { } +4 > +1->Emitted(7, 1) Source(4, 14) + SourceIndex(0) +2 >Emitted(7, 10) Source(4, 15) + SourceIndex(0) +3 >Emitted(7, 14) Source(4, 19) + SourceIndex(0) +4 >Emitted(7, 15) Source(4, 19) + SourceIndex(0) +--- +>>>//# sourceMappingURL=a.js.map=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>var a_1 = require("./ref/a"); +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^ +4 > ^ +5 > ^ +1 > +2 >import {A} from +3 > "./ref/a" +4 > ; +5 > +1 >Emitted(6, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(6, 19) Source(1, 17) + SourceIndex(0) +3 >Emitted(6, 28) Source(1, 26) + SourceIndex(0) +4 >Emitted(6, 29) Source(1, 27) + SourceIndex(0) +5 >Emitted(6, 30) Source(1, 27) + SourceIndex(0) +--- +>>>var B = (function (_super) { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(2, 1) + SourceIndex(0) +--- +>>> __extends(B, _super); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(8, 5) Source(2, 24) + SourceIndex(0) name (B) +2 >Emitted(8, 26) Source(2, 25) + SourceIndex(0) name (B) +--- +>>> function B() { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(10, 9) Source(2, 24) + SourceIndex(0) name (B.constructor) +2 >Emitted(10, 39) Source(2, 25) + SourceIndex(0) name (B.constructor) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(11, 5) Source(2, 28) + SourceIndex(0) name (B.constructor) +2 >Emitted(11, 6) Source(2, 29) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(12, 5) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(12, 13) Source(2, 29) + SourceIndex(0) name (B) +--- +>>>})(a_1.A); +1 > +2 >^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 >} +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(13, 1) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(13, 2) Source(2, 29) + SourceIndex(0) name (B) +3 >Emitted(13, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(13, 4) Source(2, 24) + SourceIndex(0) +5 >Emitted(13, 9) Source(2, 25) + SourceIndex(0) +6 >Emitted(13, 11) Source(2, 29) + SourceIndex(0) +--- +>>>exports.B = B; +1-> +2 >^^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^-> +1-> +2 >B +3 > extends A { } +4 > +1->Emitted(14, 1) Source(2, 14) + SourceIndex(0) +2 >Emitted(14, 10) Source(2, 15) + SourceIndex(0) +3 >Emitted(14, 14) Source(2, 29) + SourceIndex(0) +4 >Emitted(14, 15) Source(2, 29) + SourceIndex(0) +--- +>>>//# sourceMappingURL=b.js.map=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>// This should be an error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^-> +1 > + > +2 >// This should be an error +1 >Emitted(6, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(6, 27) Source(2, 27) + SourceIndex(0) +--- +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatES6.errors.txt b/tests/baselines/reference/outModuleConcatES6.errors.txt new file mode 100644 index 00000000000..d1a2adbc93f --- /dev/null +++ b/tests/baselines/reference/outModuleConcatES6.errors.txt @@ -0,0 +1,13 @@ +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. +==== tests/cases/compiler/ref/a.ts (0 errors) ==== + + // This should be an error + + export class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + import {A} from "./ref/a"; + export class B extends A { } \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatES6.js b/tests/baselines/reference/outModuleConcatES6.js new file mode 100644 index 00000000000..91aa1bb90e4 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatES6.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/outModuleConcatES6.ts] //// + +//// [a.ts] + +// This should be an error + +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + +//// [a.js] +// This should be an error +export class A { +} +//# sourceMappingURL=a.js.map//// [b.js] +import { A } from "./ref/a"; +export class B extends A { +} +//# sourceMappingURL=b.js.map//// [all.js] +// This should be an error +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] diff --git a/tests/baselines/reference/outModuleConcatES6.js.map b/tests/baselines/reference/outModuleConcatES6.js.map new file mode 100644 index 00000000000..347b15b38f3 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatES6.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A"],"mappings":"AACA,0BAA0B;AAE1B;AAAiBA,CAACA;AAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B"],"mappings":"OAAO,EAAC,CAAC,EAAC,MAAM,SAAS;AACzB,uBAAuB,CAAC;AAAGA,CAACA;AAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AACA,0BAA0B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatES6.sourcemap.txt b/tests/baselines/reference/outModuleConcatES6.sourcemap.txt new file mode 100644 index 00000000000..239dff14456 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatES6.sourcemap.txt @@ -0,0 +1,118 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>// This should be an error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 >// This should be an error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 27) Source(2, 27) + SourceIndex(0) +--- +>>>export class A { +1 > +2 >^^-> +1 > + > + > +1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) +--- +>>>} +1-> +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->export class A { +2 >} +1->Emitted(3, 1) Source(4, 18) + SourceIndex(0) name (A) +2 >Emitted(3, 2) Source(4, 19) + SourceIndex(0) name (A) +--- +>>>//# sourceMappingURL=a.js.map1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(4, 1) Source(4, 19) + SourceIndex(0) +--- +=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>import { A } from "./ref/a"; +1 >^^^^^^^ +2 > ^^ +3 > ^ +4 > ^^ +5 > ^^^^^^ +6 > ^^^^^^^^^ +1 >import +2 > { +3 > A +4 > } +5 > from +6 > "./ref/a" +1 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +2 >Emitted(1, 10) Source(1, 9) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 19) Source(1, 17) + SourceIndex(0) +6 >Emitted(1, 28) Source(1, 26) + SourceIndex(0) +--- +>>>export class B extends A { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +1 >; + > +2 >export class B extends +3 > A +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 24) Source(2, 24) + SourceIndex(0) +3 >Emitted(2, 25) Source(2, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { +2 >} +1 >Emitted(3, 1) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(3, 2) Source(2, 29) + SourceIndex(0) name (B) +--- +>>>//# sourceMappingURL=b.js.map1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(4, 1) Source(2, 29) + SourceIndex(0) +--- +=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>// This should be an error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^-> +1 > + > +2 >// This should be an error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 27) Source(2, 27) + SourceIndex(0) +--- +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js new file mode 100644 index 00000000000..92c8772378f --- /dev/null +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -0,0 +1,101 @@ +//// [tests/cases/compiler/outModuleConcatSystem.ts] //// + +//// [a.ts] + +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + +//// [a.js] +System.register([], function(exports_1) { + var A; + return { + setters:[], + execute: function() { + A = (function () { + function A() { + } + return A; + })(); + exports_1("A", A); + } + } +}); +//# sourceMappingURL=a.js.map//// [b.js] +System.register(["./ref/a"], function(exports_1) { + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var a_1; + var B; + return { + setters:[ + function (a_1_1) { + a_1 = a_1_1; + }], + execute: function() { + B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports_1("B", B); + } + } +}); +//# sourceMappingURL=b.js.map//// [all.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +System.register("tests/cases/compiler/ref/a", [], function(exports_1) { + var A; + return { + setters:[], + execute: function() { + A = (function () { + function A() { + } + return A; + })(); + exports_1("A", A); + } + } +}); +System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) { + var a_1; + var B; + return { + setters:[ + function (a_1_1) { + a_1 = a_1_1; + }], + execute: function() { + B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports_2("B", B); + } + } +}); +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map new file mode 100644 index 00000000000..a74b131da99 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";;;;;YACA;gBAAAA;gBAAiBC,CAACA;gBAADD,QAACA;YAADA,CAACA,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;;;;;;;;;YACA;gBAAuBA,qBAACA;gBAAxBA;oBAAuBC,8BAACA;gBAAGA,CAACA;gBAADD,QAACA;YAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;YAA5B,iBAA4B,CAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":";;;;;;;;;;YACA;gBAAAA;gBAAiBC,CAACA;gBAADD,QAACA;YAADA,CAACA,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA;;;;;;;;;;;;;YCAlB;gBAAuBE,qBAACA;gBAAxBA;oBAAuBC,8BAACA;gBAAGA,CAACA;gBAADD,QAACA;YAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;YAA5B,iBAA4B,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt new file mode 100644 index 00000000000..e717c3f677b --- /dev/null +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -0,0 +1,353 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>System.register([], function(exports_1) { +>>> var A; +>>> return { +>>> setters:[], +>>> execute: function() { +>>> A = (function () { +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(6, 13) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(7, 17) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(8, 17) Source(2, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(9, 17) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(9, 25) Source(2, 19) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^^^^^^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { } +1 >Emitted(10, 13) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(10, 14) Source(2, 19) + SourceIndex(0) name (A) +3 >Emitted(10, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(10, 18) Source(2, 19) + SourceIndex(0) +--- +>>> exports_1("A", A); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^ +1-> +2 > export class A { } +3 > +1->Emitted(11, 13) Source(2, 1) + SourceIndex(0) +2 >Emitted(11, 30) Source(2, 19) + SourceIndex(0) +3 >Emitted(11, 31) Source(2, 19) + SourceIndex(0) +--- +>>> } +>>> } +>>>}); +>>>//# sourceMappingURL=a.js.map=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>System.register(["./ref/a"], function(exports_1) { +>>> var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>> var a_1; +>>> var B; +>>> return { +>>> setters:[ +>>> function (a_1_1) { +>>> a_1 = a_1_1; +>>> }], +>>> execute: function() { +>>> B = (function (_super) { +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(15, 13) Source(2, 1) + SourceIndex(0) +--- +>>> __extends(B, _super); +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(16, 17) Source(2, 24) + SourceIndex(0) name (B) +2 >Emitted(16, 38) Source(2, 25) + SourceIndex(0) name (B) +--- +>>> function B() { +1 >^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(17, 17) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(18, 21) Source(2, 24) + SourceIndex(0) name (B.constructor) +2 >Emitted(18, 51) Source(2, 25) + SourceIndex(0) name (B.constructor) +--- +>>> } +1 >^^^^^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(19, 17) Source(2, 28) + SourceIndex(0) name (B.constructor) +2 >Emitted(19, 18) Source(2, 29) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(20, 17) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(20, 25) Source(2, 29) + SourceIndex(0) name (B) +--- +>>> })(a_1.A); +1 >^^^^^^^^^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(21, 13) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(21, 14) Source(2, 29) + SourceIndex(0) name (B) +3 >Emitted(21, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(21, 16) Source(2, 24) + SourceIndex(0) +5 >Emitted(21, 21) Source(2, 25) + SourceIndex(0) +6 >Emitted(21, 23) Source(2, 29) + SourceIndex(0) +--- +>>> exports_1("B", B); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^ +1-> +2 > export class B extends A { } +3 > +1->Emitted(22, 13) Source(2, 1) + SourceIndex(0) +2 >Emitted(22, 30) Source(2, 29) + SourceIndex(0) +3 >Emitted(22, 31) Source(2, 29) + SourceIndex(0) +--- +>>> } +>>> } +>>>}); +>>>//# sourceMappingURL=b.js.map=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>System.register("tests/cases/compiler/ref/a", [], function(exports_1) { +>>> var A; +>>> return { +>>> setters:[], +>>> execute: function() { +>>> A = (function () { +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(11, 13) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(12, 17) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(13, 17) Source(2, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(13, 18) Source(2, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(14, 17) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(14, 25) Source(2, 19) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^^^^^^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { } +1 >Emitted(15, 13) Source(2, 18) + SourceIndex(0) name (A) +2 >Emitted(15, 14) Source(2, 19) + SourceIndex(0) name (A) +3 >Emitted(15, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(15, 18) Source(2, 19) + SourceIndex(0) +--- +>>> exports_1("A", A); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^ +1-> +2 > export class A { } +3 > +1->Emitted(16, 13) Source(2, 1) + SourceIndex(0) +2 >Emitted(16, 30) Source(2, 19) + SourceIndex(0) +3 >Emitted(16, 31) Source(2, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>> } +>>> } +>>>}); +>>>System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) { +>>> var a_1; +>>> var B; +>>> return { +>>> setters:[ +>>> function (a_1_1) { +>>> a_1 = a_1_1; +>>> }], +>>> execute: function() { +>>> B = (function (_super) { +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(29, 13) Source(2, 1) + SourceIndex(1) +--- +>>> __extends(B, _super); +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(30, 17) Source(2, 24) + SourceIndex(1) name (B) +2 >Emitted(30, 38) Source(2, 25) + SourceIndex(1) name (B) +--- +>>> function B() { +1 >^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(31, 17) Source(2, 1) + SourceIndex(1) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(32, 21) Source(2, 24) + SourceIndex(1) name (B.constructor) +2 >Emitted(32, 51) Source(2, 25) + SourceIndex(1) name (B.constructor) +--- +>>> } +1 >^^^^^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(33, 17) Source(2, 28) + SourceIndex(1) name (B.constructor) +2 >Emitted(33, 18) Source(2, 29) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(34, 17) Source(2, 28) + SourceIndex(1) name (B) +2 >Emitted(34, 25) Source(2, 29) + SourceIndex(1) name (B) +--- +>>> })(a_1.A); +1 >^^^^^^^^^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(35, 13) Source(2, 28) + SourceIndex(1) name (B) +2 >Emitted(35, 14) Source(2, 29) + SourceIndex(1) name (B) +3 >Emitted(35, 14) Source(2, 1) + SourceIndex(1) +4 >Emitted(35, 16) Source(2, 24) + SourceIndex(1) +5 >Emitted(35, 21) Source(2, 25) + SourceIndex(1) +6 >Emitted(35, 23) Source(2, 29) + SourceIndex(1) +--- +>>> exports_2("B", B); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^ +1-> +2 > export class B extends A { } +3 > +1->Emitted(36, 13) Source(2, 1) + SourceIndex(1) +2 >Emitted(36, 30) Source(2, 29) + SourceIndex(1) +3 >Emitted(36, 31) Source(2, 29) + SourceIndex(1) +--- +>>> } +>>> } +>>>}); +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.symbols b/tests/baselines/reference/outModuleConcatSystem.symbols new file mode 100644 index 00000000000..349de40815a --- /dev/null +++ b/tests/baselines/reference/outModuleConcatSystem.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/ref/a.ts === + +export class A { } +>A : Symbol(A, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : Symbol(A, Decl(b.ts, 0, 8)) + +export class B extends A { } +>B : Symbol(B, Decl(b.ts, 0, 26)) +>A : Symbol(A, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/outModuleConcatSystem.types b/tests/baselines/reference/outModuleConcatSystem.types new file mode 100644 index 00000000000..6e0d9398853 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatSystem.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/ref/a.ts === + +export class A { } +>A : A + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : typeof A + +export class B extends A { } +>B : B +>A : A + diff --git a/tests/baselines/reference/outModuleConcatUmd.errors.txt b/tests/baselines/reference/outModuleConcatUmd.errors.txt new file mode 100644 index 00000000000..8695199c7eb --- /dev/null +++ b/tests/baselines/reference/outModuleConcatUmd.errors.txt @@ -0,0 +1,13 @@ +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. +==== tests/cases/compiler/ref/a.ts (0 errors) ==== + + // This should error + + export class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + import {A} from "./ref/a"; + export class B extends A { } \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatUmd.js b/tests/baselines/reference/outModuleConcatUmd.js new file mode 100644 index 00000000000..6ff5e848aa2 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatUmd.js @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/outModuleConcatUmd.ts] //// + +//// [a.ts] + +// This should error + +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + +//// [a.js] +// This should error +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + var A = (function () { + function A() { + } + return A; + })(); + exports.A = A; +}); +//# sourceMappingURL=a.js.map//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports", "./ref/a"], factory); + } +})(function (require, exports) { + var a_1 = require("./ref/a"); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports.B = B; +}); +//# sourceMappingURL=b.js.map//// [all.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +// This should error +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] diff --git a/tests/baselines/reference/outModuleConcatUmd.js.map b/tests/baselines/reference/outModuleConcatUmd.js.map new file mode 100644 index 00000000000..b00a2c1c187 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatUmd.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":"AACA,oBAAoB;;;;;;;;;IAEpB;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;;;;;;;;IAAA,kBAAgB,SAAS,CAAC,CAAA;IAC1B;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AACA,oBAAoB"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt new file mode 100644 index 00000000000..9749e38cc40 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt @@ -0,0 +1,237 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>// This should error +1 > +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^-> +1 > + > +2 >// This should error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>(function (factory) { +>>> if (typeof module === 'object' && typeof module.exports === 'object') { +>>> var v = factory(require, exports); if (v !== undefined) module.exports = v; +>>> } +>>> else if (typeof define === 'function' && define.amd) { +>>> define(["require", "exports"], factory); +>>> } +>>>})(function (require, exports) { +>>> var A = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(10, 5) Source(4, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(11, 9) Source(4, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { +2 > } +1->Emitted(12, 9) Source(4, 18) + SourceIndex(0) name (A.constructor) +2 >Emitted(12, 10) Source(4, 19) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(13, 9) Source(4, 18) + SourceIndex(0) name (A) +2 >Emitted(13, 17) Source(4, 19) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { } +1 >Emitted(14, 5) Source(4, 18) + SourceIndex(0) name (A) +2 >Emitted(14, 6) Source(4, 19) + SourceIndex(0) name (A) +3 >Emitted(14, 6) Source(4, 1) + SourceIndex(0) +4 >Emitted(14, 10) Source(4, 19) + SourceIndex(0) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > { } +4 > +1->Emitted(15, 5) Source(4, 14) + SourceIndex(0) +2 >Emitted(15, 14) Source(4, 15) + SourceIndex(0) +3 >Emitted(15, 18) Source(4, 19) + SourceIndex(0) +4 >Emitted(15, 19) Source(4, 19) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=a.js.map=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>(function (factory) { +>>> if (typeof module === 'object' && typeof module.exports === 'object') { +>>> var v = factory(require, exports); if (v !== undefined) module.exports = v; +>>> } +>>> else if (typeof define === 'function' && define.amd) { +>>> define(["require", "exports", "./ref/a"], factory); +>>> } +>>>})(function (require, exports) { +>>> var a_1 = require("./ref/a"); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^ +4 > ^ +5 > ^ +1 > +2 > import {A} from +3 > "./ref/a" +4 > ; +5 > +1 >Emitted(14, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(14, 23) Source(1, 17) + SourceIndex(0) +3 >Emitted(14, 32) Source(1, 26) + SourceIndex(0) +4 >Emitted(14, 33) Source(1, 27) + SourceIndex(0) +5 >Emitted(14, 34) Source(1, 27) + SourceIndex(0) +--- +>>> var B = (function (_super) { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(15, 5) Source(2, 1) + SourceIndex(0) +--- +>>> __extends(B, _super); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(16, 9) Source(2, 24) + SourceIndex(0) name (B) +2 >Emitted(16, 30) Source(2, 25) + SourceIndex(0) name (B) +--- +>>> function B() { +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(17, 9) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(18, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) +2 >Emitted(18, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(19, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) +2 >Emitted(19, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(20, 9) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(20, 17) Source(2, 29) + SourceIndex(0) name (B) +--- +>>> })(a_1.A); +1 >^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(21, 5) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(21, 6) Source(2, 29) + SourceIndex(0) name (B) +3 >Emitted(21, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(21, 8) Source(2, 24) + SourceIndex(0) +5 >Emitted(21, 13) Source(2, 25) + SourceIndex(0) +6 >Emitted(21, 15) Source(2, 29) + SourceIndex(0) +--- +>>> exports.B = B; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > B +3 > extends A { } +4 > +1->Emitted(22, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(22, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(22, 18) Source(2, 29) + SourceIndex(0) +4 >Emitted(22, 19) Source(2, 29) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=b.js.map=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>// This should error +1 > +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^-> +1 > + > +2 >// This should error +1 >Emitted(6, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(6, 21) Source(2, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d75277ac607 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var m2_a1: number; +declare class m2_c1 { + m2_c1_p1: number; +} +declare var m2_instance1: m2_c1; +declare function m2_f1(): m2_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d75277ac607 --- /dev/null +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var m2_a1: number; +declare class m2_c1 { + m2_c1_p1: number; +} +declare var m2_instance1: m2_c1; +declare function m2_f1(): m2_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt index 5225c47ee97..ef77af7372e 100644 --- a/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt +++ b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== globalThisCapture.ts (0 errors) ==== // Add a lambda to ensure global 'this' capture is triggered (()=>this.window); diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..d61b4c3b876 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts new file mode 100644 index 00000000000..9b9cdd4a214 --- /dev/null +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -0,0 +1,13 @@ +/// +declare var m1_a1: number; +declare class m1_c1 { + m1_c1_p1: number; +} +declare var m1_instance1: m1_c1; +declare function m1_f1(): m1_c1; +declare var a1: number; +declare class c1 { + p1: number; +} +declare var instance1: c1; +declare function f1(): c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 9674c11863f..51edf2991ad 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index ea8c2e58ae5..20fc9c39de5 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0d918d5b2a0..12592331fb5 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 2468ab068e2..bbe6b1772ae 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt index 8deca814d80..664beb97bc2 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt index edf8d0637e2..53fc18f86c7 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt index 3413d4675e7..eb358c3b79d 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== test.ts (0 errors) ==== var a1 = 10; class c1 { diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt index 3a508fede30..110e3849820 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -1,7 +1,7 @@ -error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -!!! error TS6082: Only 'amd', 'umd', and 'system' modules are supported alongside --outFile. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. ==== ref/m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { From 613c51d6b50b8f5224700ae4715fe1c45ed24879 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 5 Oct 2015 10:43:54 -0700 Subject: [PATCH 027/140] Fix jakefile rules build --- Jakefile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jakefile.js b/Jakefile.js index 84f2d527857..4c5287d6760 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -247,6 +247,8 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu if (!noOutFile) { options += " --out " + outFile; + } else { + options += " --module commonjs" } if(noResolve) { From 05dc9daf7da3a33bece3c3b390f3e1af363d93f8 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 5 Oct 2015 13:22:42 -0700 Subject: [PATCH 028/140] concatenated type emit --- src/compiler/declarationEmitter.ts | 54 ++++++++++++++++++++++++++++-- src/compiler/emitter.ts | 24 ++----------- src/compiler/utilities.ts | 18 ++++++++++ 3 files changed, 72 insertions(+), 24 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 00085f16086..d66c4110336 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -104,6 +104,7 @@ namespace ts { else { // Emit references corresponding to this file let emittedReferencedFiles: SourceFile[] = []; + let prevModuleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[] = []; forEach(host.getSourceFiles(), sourceFile => { if (!isExternalModuleOrDeclarationFile(sourceFile)) { // Check what references need to be added @@ -123,7 +124,42 @@ namespace ts { emitSourceFile(sourceFile); } + else if (isExternalModule(sourceFile)) { + currentSourceFile = sourceFile; + write(`declare module "${sourceFile.moduleName}"`); + + let prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = sourceFile; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(sourceFile.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + + // create asynchronous output for the importDeclarations + if (moduleElementDeclarationEmitInfo.length) { + let oldWriter = writer; + forEach(moduleElementDeclarationEmitInfo, aliasEmitInfo => { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + Debug.assert(aliasEmitInfo.node.kind === SyntaxKind.ImportDeclaration); + createAndSetNewTextWriterWithSymbolWriter(); + Debug.assert(aliasEmitInfo.indent === 1); + increaseIndent(); + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + decreaseIndent(); + } + }); + setWriter(oldWriter); + } + prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } }); + moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); } return { @@ -601,7 +637,7 @@ namespace ts { if (node.flags & NodeFlags.Default) { write("default "); } - else if (node.kind !== SyntaxKind.InterfaceDeclaration) { + else if (node.kind !== SyntaxKind.InterfaceDeclaration && root) { write("declare "); } } @@ -696,7 +732,13 @@ namespace ts { } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + let match: RegExpMatchArray; + if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { + write(makeModulePathSemiabsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); + } + else { + writeTextOfNode(currentSourceFile, node.moduleSpecifier); + } write(";"); writer.writeLine(); } @@ -732,7 +774,13 @@ namespace ts { } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + let match: RegExpMatchArray; + if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { + write(makeModulePathSemiabsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); + } + else { + writeTextOfNode(currentSourceFile, node.moduleSpecifier); + } } write(";"); writer.writeLine(); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4ce0a39eb07..1b0492643bf 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -499,18 +499,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitConcatenatedModule(sourceFile: SourceFile): void { currentSourceFile = sourceFile; exportFunctionForFile = undefined; - let canonicalName = resolveToSemiabsolutePath(sourceFile.fileName); + let canonicalName = resolveToSemiabsolutePath(host, sourceFile.fileName); sourceFile.moduleName = sourceFile.moduleName || canonicalName; emit(sourceFile); } - function resolveToSemiabsolutePath(path: string): string { - let dir = host.getCurrentDirectory(); - return removeFileExtension( - getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/false) - ); - } - function isUniqueName(name: string): boolean { return !resolver.hasGlobalName(name) && !hasProperty(currentSourceFile.identifiers, name) && @@ -6681,7 +6674,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (resolvePath) { - text = makeModulePathSemiabsolute(text); + text = makeModulePathSemiabsolute(host, currentSourceFile, text); } write(text); } @@ -6702,17 +6695,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi importAliasNames: string[]; } - function makeModulePathSemiabsolute(externalModuleName: string): string { - let quotemark = externalModuleName.charAt(0); - let unquotedModuleName = externalModuleName.substring(1, externalModuleName.length - 1); - let resolvedFileName = host.resolveModuleName(unquotedModuleName, currentSourceFile.fileName); - if (resolvedFileName) { - let semiabsoluteName = resolveToSemiabsolutePath(resolvedFileName); - externalModuleName = quoteString(semiabsoluteName, quotemark); - } - return externalModuleName; - } - function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, resolvePath?: boolean): AMDDependencyNames { // names of modules with corresponding parameter in the factory function let aliasedModuleNames: string[] = []; @@ -6738,7 +6720,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalModuleName = getExternalModuleNameText(importNode); if (resolvePath) { - externalModuleName = makeModulePathSemiabsolute(externalModuleName); + externalModuleName = makeModulePathSemiabsolute(host, currentSourceFile, externalModuleName); } // Find the name of the module alias, if there is one diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9ae65af046e..db30e4ca68e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1775,6 +1775,24 @@ namespace ts { }; } + export function makeModulePathSemiabsolute(host: EmitHost, currentSourceFile: SourceFile, externalModuleName: string): string { + let quotemark = externalModuleName.charAt(0); + let unquotedModuleName = externalModuleName.substring(1, externalModuleName.length - 1); + let resolvedFileName = host.resolveModuleName(unquotedModuleName, currentSourceFile.fileName); + if (resolvedFileName) { + let semiabsoluteName = resolveToSemiabsolutePath(host, resolvedFileName); + externalModuleName = quoteString(semiabsoluteName, quotemark); + } + return externalModuleName; + } + + export function resolveToSemiabsolutePath(host: EmitHost, path: string): string { + let dir = host.getCurrentDirectory(); + return removeFileExtension( + getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/false) + ); + } + export function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string) { let compilerOptions = host.getCompilerOptions(); let emitOutputFilePathWithoutExtension: string; From d07e33dd9800b629d4e1e5335bb84fa08200ec06 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 5 Oct 2015 14:06:34 -0700 Subject: [PATCH 029/140] Correct output, accept new baselines --- src/compiler/declarationEmitter.ts | 15 ++++------ .../baselines/reference/outModuleConcatAmd.js | 9 ++++++ .../reference/outModuleConcatCommonjs.js | 9 ++++++ .../baselines/reference/outModuleConcatES6.js | 9 ++++++ .../reference/outModuleConcatSystem.js | 9 ++++++ .../baselines/reference/outModuleConcatUmd.js | 9 ++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 8 ++++++ .../node/bin/test.d.ts | 8 ++++++ .../amd/bin/outAndOutDirFile.d.ts | 8 ++++++ .../node/bin/outAndOutDirFile.d.ts | 8 ++++++ .../amd/bin/test.d.ts | 28 +++++++++++++++++++ .../node/bin/test.d.ts | 28 +++++++++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ .../amd/bin/test.d.ts | 18 ++++++++++++ .../node/bin/test.d.ts | 18 ++++++++++++ 96 files changed, 1491 insertions(+), 9 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index d66c4110336..277a1bf169a 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -55,6 +55,7 @@ namespace ts { let errorNameNode: DeclarationName; let emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; let emit = compilerOptions.stripInternal ? stripInternal : emitNode; + let noDeclare = !root; let moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[] = []; let asynchronousSubModuleDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[]; @@ -107,6 +108,7 @@ namespace ts { let prevModuleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[] = []; forEach(host.getSourceFiles(), sourceFile => { if (!isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; // Check what references need to be added if (!compilerOptions.noResolve) { forEach(sourceFile.referencedFiles, fileReference => { @@ -125,19 +127,14 @@ namespace ts { emitSourceFile(sourceFile); } else if (isExternalModule(sourceFile)) { - currentSourceFile = sourceFile; - write(`declare module "${sourceFile.moduleName}"`); - - let prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = sourceFile; - write(" {"); + noDeclare = true; + write(`declare module "${sourceFile.moduleName}" {`); writeLine(); increaseIndent(); - emitLines(sourceFile.statements); + emitSourceFile(sourceFile) decreaseIndent(); write("}"); writeLine(); - enclosingDeclaration = prevEnclosingDeclaration; // create asynchronous output for the importDeclarations if (moduleElementDeclarationEmitInfo.length) { @@ -637,7 +634,7 @@ namespace ts { if (node.flags & NodeFlags.Default) { write("default "); } - else if (node.kind !== SyntaxKind.InterfaceDeclaration && root) { + else if (node.kind !== SyntaxKind.InterfaceDeclaration && !noDeclare) { write("declare "); } } diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index f6af61005e9..5d825757b71 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -67,3 +67,12 @@ import { A } from "./ref/a"; export declare class B extends A { } //// [all.d.ts] +declare module "tests/cases/compiler/ref/a" { + export class A { + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js b/tests/baselines/reference/outModuleConcatCommonjs.js index ed19f93f702..0f83b4fbe99 100644 --- a/tests/baselines/reference/outModuleConcatCommonjs.js +++ b/tests/baselines/reference/outModuleConcatCommonjs.js @@ -50,3 +50,12 @@ import { A } from "./ref/a"; export declare class B extends A { } //// [all.d.ts] +declare module "tests/cases/compiler/ref/a" { + export class A { + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatES6.js b/tests/baselines/reference/outModuleConcatES6.js index 91aa1bb90e4..c8db9e083b6 100644 --- a/tests/baselines/reference/outModuleConcatES6.js +++ b/tests/baselines/reference/outModuleConcatES6.js @@ -30,3 +30,12 @@ import { A } from "./ref/a"; export declare class B extends A { } //// [all.d.ts] +declare module "tests/cases/compiler/ref/a" { + export class A { + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index 92c8772378f..970ea4b3d6d 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -99,3 +99,12 @@ import { A } from "./ref/a"; export declare class B extends A { } //// [all.d.ts] +declare module "tests/cases/compiler/ref/a" { + export class A { + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatUmd.js b/tests/baselines/reference/outModuleConcatUmd.js index 6ff5e848aa2..b94617a19d8 100644 --- a/tests/baselines/reference/outModuleConcatUmd.js +++ b/tests/baselines/reference/outModuleConcatUmd.js @@ -68,3 +68,12 @@ import { A } from "./ref/a"; export declare class B extends A { } //// [all.d.ts] +declare module "tests/cases/compiler/ref/a" { + export class A { + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index d61b4c3b876..bc9ccf61daf 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 9b9cdd4a214..375869ffc94 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -5,6 +5,14 @@ declare class m1_c1 { } declare var m1_instance1: m1_c1; declare function m1_f1(): m1_c1; +declare module "ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} declare var a1: number; declare class c1 { p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..9b6af66589a 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,28 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "../outputdir_module_multifolder_ref/m2" { + export var m2_a1: number; + export class m2_c1 { + m2_c1_p1: number; + } + export var m2_instance1: m2_c1; + export function m2_f1(): m2_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + import m2 = require("../outputdir_module_multifolder_ref/m2"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; + export var a3: typeof m2.m2_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..df062274b3e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts index e69de29bb2d..18eee0fd4df 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -0,0 +1,18 @@ +declare module "ref/m1" { + export var m1_a1: number; + export class m1_c1 { + m1_c1_p1: number; + } + export var m1_instance1: m1_c1; + export function m1_f1(): m1_c1; +} +declare module "test" { + import m1 = require("ref/m1"); + export var a1: number; + export class c1 { + p1: number; + } + export var instance1: c1; + export function f1(): c1; + export var a2: typeof m1.m1_c1; +} From 6c1f3effcbd7d18c4c55407100e9ee093dced763 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 5 Oct 2015 14:14:00 -0700 Subject: [PATCH 030/140] m'lint --- src/compiler/declarationEmitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 277a1bf169a..c3d611f131c 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -131,7 +131,7 @@ namespace ts { write(`declare module "${sourceFile.moduleName}" {`); writeLine(); increaseIndent(); - emitSourceFile(sourceFile) + emitSourceFile(sourceFile); decreaseIndent(); write("}"); writeLine(); From 732ec343fc0ad08c5615d9e496b9dd0549e2a65a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 5 Oct 2015 14:25:48 -0700 Subject: [PATCH 031/140] update comment --- src/compiler/program.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0cdcddbb0ed..f8bb1e94da5 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1063,7 +1063,7 @@ namespace ts { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } - // Cannot specify module gen that isn't amd, umd, or system with --out + // Cannot specify module gen that isn't amd or system with --out if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.System) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } From 5bcd8b3afae3882feb35fa9257b720f266f770f5 Mon Sep 17 00:00:00 2001 From: Tingan Ho Date: Tue, 6 Oct 2015 19:03:01 +0800 Subject: [PATCH 032/140] Fixes instance of type exclusion in else clause --- src/compiler/checker.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 40db300d310..3dc9ee68d14 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6362,9 +6362,10 @@ namespace ts { function narrowTypeByInstanceof(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(expr.left) !== symbol) { return type; } + // Check that right operand is a function type with a prototype property let rightType = checkExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { @@ -6396,6 +6397,13 @@ namespace ts { } if (targetType) { + if (!assumeTrue) { + if (type.flags & TypeFlags.Union) { + return getUnionType(filter((type).types, t => !isTypeSubtypeOf(t, targetType))); + } + return type; + } + return getNarrowedType(type, targetType); } From dd54b7a36f15da93748282eab3298071943f2969 Mon Sep 17 00:00:00 2001 From: Tingan Ho Date: Tue, 6 Oct 2015 19:03:11 +0800 Subject: [PATCH 033/140] Adds tests --- .../reference/narrowTypeByInstanceof.types | 2 +- .../reference/typeGuardOfFormInstanceOf.js | 112 +++++++-- .../typeGuardOfFormInstanceOf.symbols | 190 +++++++++++---- .../reference/typeGuardOfFormInstanceOf.types | 221 +++++++++++++----- .../typeGuards/typeGuardOfFormInstanceOf.ts | 57 ++++- 5 files changed, 447 insertions(+), 135 deletions(-) diff --git a/tests/baselines/reference/narrowTypeByInstanceof.types b/tests/baselines/reference/narrowTypeByInstanceof.types index e6a3466b88f..8bc13d12ca1 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.types +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -63,7 +63,7 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) { } else if (elementA instanceof Match && elementB instanceof Match) { >elementA instanceof Match && elementB instanceof Match : boolean >elementA instanceof Match : boolean ->elementA : FileMatch | Match +>elementA : Match | FileMatch >Match : typeof Match >elementB instanceof Match : boolean >elementB : FileMatch | Match diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index cab04365c19..1431b4b9c60 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -14,21 +14,58 @@ class C2 { class D1 extends C1 { p3: number; } +class C3 { + p4: number; +} var str: string; var num: number; var strOrNum: string | number; -var c1Orc2: C1 | C2; -str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1 -num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2 -str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1 -num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1 +var ctor1: C1 | C2; +str = ctor1 instanceof C1 && ctor1.p1; // C1 +num = ctor1 instanceof C2 && ctor1.p2; // C2 +str = ctor1 instanceof D1 && ctor1.p1; // D1 +num = ctor1 instanceof D1 && ctor1.p3; // D1 -var c2Ord1: C2 | D1; -num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2 -num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1 -str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 -var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 +var ctor2: C2 | D1; +num = ctor2 instanceof C2 && ctor2.p2; // C2 +num = ctor2 instanceof D1 && ctor2.p3; // D1 +str = ctor2 instanceof D1 && ctor2.p1; // D1 +var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1 + +var ctor3: C1 | C2; +if (ctor3 instanceof C1) { + ctor3.p1; // C1 +} +else { + ctor3.p2; // C2 +} + +var ctor4: C1 | C2 | C3; +if (ctor4 instanceof C1) { + ctor4.p1; // C1 +} +else if (ctor4 instanceof C2) { + ctor4.p2; // C2 +} +else { + ctor4.p4; // C3 +} + +var ctor5: C1 | D1 | C2; +if (ctor5 instanceof C1) { + ctor5.p1; // C1 +} +else { + ctor5.p2; // C2 +} + +var ctor6: C1 | C2 | C3; +if (ctor6 instanceof C1 || ctor6 instanceof C2) { +} +else { + ctor6.p4; // C3 +} //// [typeGuardOfFormInstanceOf.js] // A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function' @@ -58,16 +95,51 @@ var D1 = (function (_super) { } return D1; })(C1); +var C3 = (function () { + function C3() { + } + return C3; +})(); var str; var num; var strOrNum; -var c1Orc2; -str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1 -num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2 -str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1 -num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1 -var c2Ord1; -num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2 -num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1 -str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 -var r2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 +var ctor1; +str = ctor1 instanceof C1 && ctor1.p1; // C1 +num = ctor1 instanceof C2 && ctor1.p2; // C2 +str = ctor1 instanceof D1 && ctor1.p1; // D1 +num = ctor1 instanceof D1 && ctor1.p3; // D1 +var ctor2; +num = ctor2 instanceof C2 && ctor2.p2; // C2 +num = ctor2 instanceof D1 && ctor2.p3; // D1 +str = ctor2 instanceof D1 && ctor2.p1; // D1 +var r2 = ctor2 instanceof C1 && ctor2; // C2 | D1 +var ctor3; +if (ctor3 instanceof C1) { + ctor3.p1; // C1 +} +else { + ctor3.p2; // C2 +} +var ctor4; +if (ctor4 instanceof C1) { + ctor4.p1; // C1 +} +else if (ctor4 instanceof C2) { + ctor4.p2; // C2 +} +else { + ctor4.p4; // C3 +} +var ctor5; +if (ctor5 instanceof C1) { + ctor5.p1; // C1 +} +else { + ctor5.p2; // C2 +} +var ctor6; +if (ctor6 instanceof C1 || ctor6 instanceof C2) { +} +else { + ctor6.p4; // C3 +} diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols b/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols index 7a48d87e963..0dd2844f6ad 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols @@ -24,86 +24,184 @@ class D1 extends C1 { p3: number; >p3 : Symbol(p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) } +class C3 { +>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1)) + + p4: number; +>p4 : Symbol(p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +} var str: string; ->str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3)) +>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3)) var num: number; ->num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3)) +>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) var strOrNum: string | number; ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormInstanceOf.ts, 17, 3)) +>strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormInstanceOf.ts, 20, 3)) -var c1Orc2: C1 | C2; ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +var ctor1: C1 | C2; +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) -str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1 ->str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +str = ctor1 instanceof C1 && ctor1.p1; // C1 +>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) ->c1Orc2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) -num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2 ->num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +num = ctor1 instanceof C2 && ctor1.p2; // C2 +>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) ->c1Orc2.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) -str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1 ->str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +str = ctor1 instanceof D1 && ctor1.p1; // D1 +>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) ->c1Orc2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) -num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1 ->num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +num = ctor1 instanceof D1 && ctor1.p3; // D1 +>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) ->c1Orc2.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) ->c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor1.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) +>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3)) >p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) -var c2Ord1: C2 | D1; ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +var ctor2: C2 | D1; +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) -num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2 ->num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +num = ctor2 instanceof C2 && ctor2.p2; // C2 +>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) ->c2Ord1.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +>ctor2.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) -num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1 ->num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +num = ctor2 instanceof D1 && ctor2.p3; // D1 +>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) ->c2Ord1.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +>ctor2.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) -str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 ->str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +str = ctor2 instanceof D1 && ctor2.p1; // D1 +>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) ->c2Ord1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +>ctor2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) -var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 ->r2 : Symbol(r2, Decl(typeGuardOfFormInstanceOf.ts, 29, 3)) +var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1 +>r2 : Symbol(r2, Decl(typeGuardOfFormInstanceOf.ts, 32, 3)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) ->c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3)) +>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3)) +var ctor3: C1 | C2; +>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) + +if (ctor3 instanceof C1) { +>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) + + ctor3.p1; // C1 +>ctor3.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +} +else { + ctor3.p2; // C2 +>ctor3.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +} + +var ctor4: C1 | C2 | C3; +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) +>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1)) + +if (ctor4 instanceof C1) { +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) + + ctor4.p1; // C1 +>ctor4.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +} +else if (ctor4 instanceof C2) { +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) + + ctor4.p2; // C2 +>ctor4.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +} +else { + ctor4.p4; // C3 +>ctor4.p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3)) +>p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +} + +var ctor5: C1 | D1 | C2; +>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) +>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) + +if (ctor5 instanceof C1) { +>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) + + ctor5.p1; // C1 +>ctor5.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +} +else { + ctor5.p2; // C2 +>ctor5.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +} + +var ctor6: C1 | C2 | C3; +>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) +>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1)) + +if (ctor6 instanceof C1 || ctor6 instanceof C2) { +>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3)) +>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) +>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3)) +>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) +} +else { + ctor6.p4; // C3 +>ctor6.p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3)) +>p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +} diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.types b/tests/baselines/reference/typeGuardOfFormInstanceOf.types index c824e907733..6b83b57dcb5 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.types @@ -24,6 +24,12 @@ class D1 extends C1 { p3: number; >p3 : number } +class C3 { +>C3 : C3 + + p4: number; +>p4 : number +} var str: string; >str : string @@ -33,100 +39,199 @@ var num: number; var strOrNum: string | number; >strOrNum : string | number -var c1Orc2: C1 | C2; ->c1Orc2 : C1 | C2 +var ctor1: C1 | C2; +>ctor1 : C1 | C2 >C1 : C1 >C2 : C2 -str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1 ->str = c1Orc2 instanceof C1 && c1Orc2.p1 : string +str = ctor1 instanceof C1 && ctor1.p1; // C1 +>str = ctor1 instanceof C1 && ctor1.p1 : string >str : string ->c1Orc2 instanceof C1 && c1Orc2.p1 : string ->c1Orc2 instanceof C1 : boolean ->c1Orc2 : C1 | C2 +>ctor1 instanceof C1 && ctor1.p1 : string +>ctor1 instanceof C1 : boolean +>ctor1 : C1 | C2 >C1 : typeof C1 ->c1Orc2.p1 : string ->c1Orc2 : C1 +>ctor1.p1 : string +>ctor1 : C1 >p1 : string -num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2 ->num = c1Orc2 instanceof C2 && c1Orc2.p2 : number +num = ctor1 instanceof C2 && ctor1.p2; // C2 +>num = ctor1 instanceof C2 && ctor1.p2 : number >num : number ->c1Orc2 instanceof C2 && c1Orc2.p2 : number ->c1Orc2 instanceof C2 : boolean ->c1Orc2 : C1 | C2 +>ctor1 instanceof C2 && ctor1.p2 : number +>ctor1 instanceof C2 : boolean +>ctor1 : C1 | C2 >C2 : typeof C2 ->c1Orc2.p2 : number ->c1Orc2 : C2 +>ctor1.p2 : number +>ctor1 : C2 >p2 : number -str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1 ->str = c1Orc2 instanceof D1 && c1Orc2.p1 : string +str = ctor1 instanceof D1 && ctor1.p1; // D1 +>str = ctor1 instanceof D1 && ctor1.p1 : string >str : string ->c1Orc2 instanceof D1 && c1Orc2.p1 : string ->c1Orc2 instanceof D1 : boolean ->c1Orc2 : C1 | C2 +>ctor1 instanceof D1 && ctor1.p1 : string +>ctor1 instanceof D1 : boolean +>ctor1 : C1 | C2 >D1 : typeof D1 ->c1Orc2.p1 : string ->c1Orc2 : D1 +>ctor1.p1 : string +>ctor1 : D1 >p1 : string -num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1 ->num = c1Orc2 instanceof D1 && c1Orc2.p3 : number +num = ctor1 instanceof D1 && ctor1.p3; // D1 +>num = ctor1 instanceof D1 && ctor1.p3 : number >num : number ->c1Orc2 instanceof D1 && c1Orc2.p3 : number ->c1Orc2 instanceof D1 : boolean ->c1Orc2 : C1 | C2 +>ctor1 instanceof D1 && ctor1.p3 : number +>ctor1 instanceof D1 : boolean +>ctor1 : C1 | C2 >D1 : typeof D1 ->c1Orc2.p3 : number ->c1Orc2 : D1 +>ctor1.p3 : number +>ctor1 : D1 >p3 : number -var c2Ord1: C2 | D1; ->c2Ord1 : C2 | D1 +var ctor2: C2 | D1; +>ctor2 : C2 | D1 >C2 : C2 >D1 : D1 -num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2 ->num = c2Ord1 instanceof C2 && c2Ord1.p2 : number +num = ctor2 instanceof C2 && ctor2.p2; // C2 +>num = ctor2 instanceof C2 && ctor2.p2 : number >num : number ->c2Ord1 instanceof C2 && c2Ord1.p2 : number ->c2Ord1 instanceof C2 : boolean ->c2Ord1 : C2 | D1 +>ctor2 instanceof C2 && ctor2.p2 : number +>ctor2 instanceof C2 : boolean +>ctor2 : C2 | D1 >C2 : typeof C2 ->c2Ord1.p2 : number ->c2Ord1 : C2 +>ctor2.p2 : number +>ctor2 : C2 >p2 : number -num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1 ->num = c2Ord1 instanceof D1 && c2Ord1.p3 : number +num = ctor2 instanceof D1 && ctor2.p3; // D1 +>num = ctor2 instanceof D1 && ctor2.p3 : number >num : number ->c2Ord1 instanceof D1 && c2Ord1.p3 : number ->c2Ord1 instanceof D1 : boolean ->c2Ord1 : C2 | D1 +>ctor2 instanceof D1 && ctor2.p3 : number +>ctor2 instanceof D1 : boolean +>ctor2 : C2 | D1 >D1 : typeof D1 ->c2Ord1.p3 : number ->c2Ord1 : D1 +>ctor2.p3 : number +>ctor2 : D1 >p3 : number -str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 ->str = c2Ord1 instanceof D1 && c2Ord1.p1 : string +str = ctor2 instanceof D1 && ctor2.p1; // D1 +>str = ctor2 instanceof D1 && ctor2.p1 : string >str : string ->c2Ord1 instanceof D1 && c2Ord1.p1 : string ->c2Ord1 instanceof D1 : boolean ->c2Ord1 : C2 | D1 +>ctor2 instanceof D1 && ctor2.p1 : string +>ctor2 instanceof D1 : boolean +>ctor2 : C2 | D1 >D1 : typeof D1 ->c2Ord1.p1 : string ->c2Ord1 : D1 +>ctor2.p1 : string +>ctor2 : D1 >p1 : string -var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 +var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1 >r2 : D1 | C2 >D1 : D1 >C2 : C2 ->c2Ord1 instanceof C1 && c2Ord1 : D1 ->c2Ord1 instanceof C1 : boolean ->c2Ord1 : C2 | D1 +>ctor2 instanceof C1 && ctor2 : D1 +>ctor2 instanceof C1 : boolean +>ctor2 : C2 | D1 >C1 : typeof C1 ->c2Ord1 : D1 +>ctor2 : D1 +var ctor3: C1 | C2; +>ctor3 : C1 | C2 +>C1 : C1 +>C2 : C2 + +if (ctor3 instanceof C1) { +>ctor3 instanceof C1 : boolean +>ctor3 : C1 | C2 +>C1 : typeof C1 + + ctor3.p1; // C1 +>ctor3.p1 : string +>ctor3 : C1 +>p1 : string +} +else { + ctor3.p2; // C2 +>ctor3.p2 : number +>ctor3 : C2 +>p2 : number +} + +var ctor4: C1 | C2 | C3; +>ctor4 : C1 | C2 | C3 +>C1 : C1 +>C2 : C2 +>C3 : C3 + +if (ctor4 instanceof C1) { +>ctor4 instanceof C1 : boolean +>ctor4 : C1 | C2 | C3 +>C1 : typeof C1 + + ctor4.p1; // C1 +>ctor4.p1 : string +>ctor4 : C1 +>p1 : string +} +else if (ctor4 instanceof C2) { +>ctor4 instanceof C2 : boolean +>ctor4 : C2 | C3 +>C2 : typeof C2 + + ctor4.p2; // C2 +>ctor4.p2 : number +>ctor4 : C2 +>p2 : number +} +else { + ctor4.p4; // C3 +>ctor4.p4 : number +>ctor4 : C3 +>p4 : number +} + +var ctor5: C1 | D1 | C2; +>ctor5 : C1 | D1 | C2 +>C1 : C1 +>D1 : D1 +>C2 : C2 + +if (ctor5 instanceof C1) { +>ctor5 instanceof C1 : boolean +>ctor5 : C1 | D1 | C2 +>C1 : typeof C1 + + ctor5.p1; // C1 +>ctor5.p1 : string +>ctor5 : C1 +>p1 : string +} +else { + ctor5.p2; // C2 +>ctor5.p2 : number +>ctor5 : C2 +>p2 : number +} + +var ctor6: C1 | C2 | C3; +>ctor6 : C1 | C2 | C3 +>C1 : C1 +>C2 : C2 +>C3 : C3 + +if (ctor6 instanceof C1 || ctor6 instanceof C2) { +>ctor6 instanceof C1 || ctor6 instanceof C2 : boolean +>ctor6 instanceof C1 : boolean +>ctor6 : C1 | C2 | C3 +>C1 : typeof C1 +>ctor6 instanceof C2 : boolean +>ctor6 : C2 | C3 +>C2 : typeof C2 +} +else { + ctor6.p4; // C3 +>ctor6.p4 : number +>ctor6 : C3 +>p4 : number +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts index 233909f44aa..31514fca749 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts @@ -13,18 +13,55 @@ class C2 { class D1 extends C1 { p3: number; } +class C3 { + p4: number; +} var str: string; var num: number; var strOrNum: string | number; -var c1Orc2: C1 | C2; -str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1 -num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2 -str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1 -num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1 +var ctor1: C1 | C2; +str = ctor1 instanceof C1 && ctor1.p1; // C1 +num = ctor1 instanceof C2 && ctor1.p2; // C2 +str = ctor1 instanceof D1 && ctor1.p1; // D1 +num = ctor1 instanceof D1 && ctor1.p3; // D1 + +var ctor2: C2 | D1; +num = ctor2 instanceof C2 && ctor2.p2; // C2 +num = ctor2 instanceof D1 && ctor2.p3; // D1 +str = ctor2 instanceof D1 && ctor2.p1; // D1 +var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1 -var c2Ord1: C2 | D1; -num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2 -num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1 -str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 -var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 \ No newline at end of file +var ctor3: C1 | C2; +if (ctor3 instanceof C1) { + ctor3.p1; // C1 +} +else { + ctor3.p2; // C2 +} + +var ctor4: C1 | C2 | C3; +if (ctor4 instanceof C1) { + ctor4.p1; // C1 +} +else if (ctor4 instanceof C2) { + ctor4.p2; // C2 +} +else { + ctor4.p4; // C3 +} + +var ctor5: C1 | D1 | C2; +if (ctor5 instanceof C1) { + ctor5.p1; // C1 +} +else { + ctor5.p2; // C2 +} + +var ctor6: C1 | C2 | C3; +if (ctor6 instanceof C1 || ctor6 instanceof C2) { +} +else { + ctor6.p4; // C3 +} \ No newline at end of file From f7a6ac7e0c0a03a3fd2d32a759e38b204f8cc5a5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 7 Oct 2015 15:38:24 -0700 Subject: [PATCH 034/140] Added more tests. --- .../stringLiteralTypesOverloads03.ts | 46 +++++++++++++++++++ ...tringLiteralTypesWithVariousOperators01.ts | 29 ++++++++++++ ...tringLiteralTypesWithVariousOperators02.ts | 19 ++++++++ 3 files changed, 94 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts new file mode 100644 index 00000000000..a675c2c0eae --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts @@ -0,0 +1,46 @@ +// @declaration: true + +interface Base { + x: string; + y: number; +} + +interface HelloOrWorld extends Base { + p1: boolean; +} + +interface JustHello extends Base { + p2: boolean; +} + +interface JustWorld extends Base { + p3: boolean; +} + +let hello: "hello"; +let world: "world"; +let helloOrWorld: "hello" | "world"; + +function f(p: "hello"): JustHello; +function f(p: "hello" | "world"): HelloOrWorld; +function f(p: "world"): JustWorld; +function f(p: string): Base; +function f(...args: any[]): any { + return undefined; +} + +let fResult1 = f(hello); +let fResult2 = f(world); +let fResult3 = f(helloOrWorld); + +function g(p: string): Base; +function g(p: "hello"): JustHello; +function g(p: "hello" | "world"): HelloOrWorld; +function g(p: "world"): JustWorld; +function g(...args: any[]): any { + return undefined; +} + +let gResult1 = g(hello); +let gResult2 = g(world); +let gResult3 = g(helloOrWorld); \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts new file mode 100644 index 00000000000..28c34d3c74a --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts @@ -0,0 +1,29 @@ +// @declaration: true + +let abc: "ABC" = "ABC"; +let xyz: "XYZ" = "XYZ"; +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; + +let a = "" + abc; +let b = abc + ""; +let c = 10 + abc; +let d = abc + 10; +let e = xyz + abc; +let f = abc + xyz; +let g = true + abc; +let h = abc + true; +let i = abc + abcOrXyz + xyz; +let j = abcOrXyz + abcOrXyz; +let k = +abcOrXyz; +let l = -abcOrXyz; +let m = abcOrXyzOrNumber + ""; +let n = "" + abcOrXyzOrNumber; +let o = abcOrXyzOrNumber + abcOrXyz; +let p = abcOrXyz + abcOrXyzOrNumber; +let q = !abcOrXyzOrNumber; +let r = ~abcOrXyzOrNumber; +let s = abcOrXyzOrNumber < abcOrXyzOrNumber; +let t = abcOrXyzOrNumber >= abcOrXyz; +let u = abc === abcOrXyz; +let v = abcOrXyz === abcOrXyzOrNumber; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts new file mode 100644 index 00000000000..cf66f66e47c --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts @@ -0,0 +1,19 @@ +// @declaration: true + +let abc: "ABC" = "ABC"; +let xyz: "XYZ" = "XYZ"; +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; + +let a = abcOrXyzOrNumber + 100; +let b = 100 + abcOrXyzOrNumber; +let c = abcOrXyzOrNumber + abcOrXyzOrNumber; +let d = abcOrXyzOrNumber + true; +let e = false + abcOrXyzOrNumber; +let f = abcOrXyzOrNumber++; +let g = --abcOrXyzOrNumber; +let h = abcOrXyzOrNumber ^ 10; +let i = abcOrXyzOrNumber | 10; +let j = abc < xyz; +let k = abc === xyz; +let l = abc != xyz; \ No newline at end of file From a440f06cac2f5265f321cf06ea147310d759afb6 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 14:10:15 -0700 Subject: [PATCH 035/140] Accepted baselines. --- .../stringLiteralTypesOverloads03.js | 104 ++++++++++++ .../stringLiteralTypesOverloads03.symbols | 131 +++++++++++++++ .../stringLiteralTypesOverloads03.types | 137 ++++++++++++++++ ...tringLiteralTypesWithVariousOperators01.js | 86 ++++++++++ ...LiteralTypesWithVariousOperators01.symbols | 116 +++++++++++++ ...ngLiteralTypesWithVariousOperators01.types | 152 ++++++++++++++++++ ...eralTypesWithVariousOperators02.errors.txt | 57 +++++++ ...tringLiteralTypesWithVariousOperators02.js | 56 +++++++ 8 files changed, 839 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads03.js create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads03.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads03.types create mode 100644 tests/baselines/reference/stringLiteralTypesWithVariousOperators01.js create mode 100644 tests/baselines/reference/stringLiteralTypesWithVariousOperators01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types create mode 100644 tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesWithVariousOperators02.js diff --git a/tests/baselines/reference/stringLiteralTypesOverloads03.js b/tests/baselines/reference/stringLiteralTypesOverloads03.js new file mode 100644 index 00000000000..c1e79160880 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads03.js @@ -0,0 +1,104 @@ +//// [stringLiteralTypesOverloads03.ts] + +interface Base { + x: string; + y: number; +} + +interface HelloOrWorld extends Base { + p1: boolean; +} + +interface JustHello extends Base { + p2: boolean; +} + +interface JustWorld extends Base { + p3: boolean; +} + +let hello: "hello"; +let world: "world"; +let helloOrWorld: "hello" | "world"; + +function f(p: "hello"): JustHello; +function f(p: "hello" | "world"): HelloOrWorld; +function f(p: "world"): JustWorld; +function f(p: string): Base; +function f(...args: any[]): any { + return undefined; +} + +let fResult1 = f(hello); +let fResult2 = f(world); +let fResult3 = f(helloOrWorld); + +function g(p: string): Base; +function g(p: "hello"): JustHello; +function g(p: "hello" | "world"): HelloOrWorld; +function g(p: "world"): JustWorld; +function g(...args: any[]): any { + return undefined; +} + +let gResult1 = g(hello); +let gResult2 = g(world); +let gResult3 = g(helloOrWorld); + +//// [stringLiteralTypesOverloads03.js] +var hello; +var world; +var helloOrWorld; +function f() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return undefined; +} +var fResult1 = f(hello); +var fResult2 = f(world); +var fResult3 = f(helloOrWorld); +function g() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return undefined; +} +var gResult1 = g(hello); +var gResult2 = g(world); +var gResult3 = g(helloOrWorld); + + +//// [stringLiteralTypesOverloads03.d.ts] +interface Base { + x: string; + y: number; +} +interface HelloOrWorld extends Base { + p1: boolean; +} +interface JustHello extends Base { + p2: boolean; +} +interface JustWorld extends Base { + p3: boolean; +} +declare let hello: "hello"; +declare let world: "world"; +declare let helloOrWorld: "hello" | "world"; +declare function f(p: "hello"): JustHello; +declare function f(p: "hello" | "world"): HelloOrWorld; +declare function f(p: "world"): JustWorld; +declare function f(p: string): Base; +declare let fResult1: JustHello; +declare let fResult2: JustWorld; +declare let fResult3: HelloOrWorld; +declare function g(p: string): Base; +declare function g(p: "hello"): JustHello; +declare function g(p: "hello" | "world"): HelloOrWorld; +declare function g(p: "world"): JustWorld; +declare let gResult1: JustHello; +declare let gResult2: JustWorld; +declare let gResult3: Base; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads03.symbols b/tests/baselines/reference/stringLiteralTypesOverloads03.symbols new file mode 100644 index 00000000000..a0a48de790f --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads03.symbols @@ -0,0 +1,131 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts === + +interface Base { +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + + x: string; +>x : Symbol(x, Decl(stringLiteralTypesOverloads03.ts, 1, 16)) + + y: number; +>y : Symbol(y, Decl(stringLiteralTypesOverloads03.ts, 2, 14)) +} + +interface HelloOrWorld extends Base { +>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1)) +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + + p1: boolean; +>p1 : Symbol(p1, Decl(stringLiteralTypesOverloads03.ts, 6, 37)) +} + +interface JustHello extends Base { +>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1)) +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + + p2: boolean; +>p2 : Symbol(p2, Decl(stringLiteralTypesOverloads03.ts, 10, 34)) +} + +interface JustWorld extends Base { +>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1)) +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + + p3: boolean; +>p3 : Symbol(p3, Decl(stringLiteralTypesOverloads03.ts, 14, 34)) +} + +let hello: "hello"; +>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3)) + +let world: "world"; +>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3)) + +let helloOrWorld: "hello" | "world"; +>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3)) + +function f(p: "hello"): JustHello; +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 22, 11)) +>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1)) + +function f(p: "hello" | "world"): HelloOrWorld; +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 23, 11)) +>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1)) + +function f(p: "world"): JustWorld; +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 24, 11)) +>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1)) + +function f(p: string): Base; +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 25, 11)) +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + +function f(...args: any[]): any { +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>args : Symbol(args, Decl(stringLiteralTypesOverloads03.ts, 26, 11)) + + return undefined; +>undefined : Symbol(undefined) +} + +let fResult1 = f(hello); +>fResult1 : Symbol(fResult1, Decl(stringLiteralTypesOverloads03.ts, 30, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3)) + +let fResult2 = f(world); +>fResult2 : Symbol(fResult2, Decl(stringLiteralTypesOverloads03.ts, 31, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3)) + +let fResult3 = f(helloOrWorld); +>fResult3 : Symbol(fResult3, Decl(stringLiteralTypesOverloads03.ts, 32, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloads03.ts, 20, 36), Decl(stringLiteralTypesOverloads03.ts, 22, 34), Decl(stringLiteralTypesOverloads03.ts, 23, 47), Decl(stringLiteralTypesOverloads03.ts, 24, 34), Decl(stringLiteralTypesOverloads03.ts, 25, 28)) +>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3)) + +function g(p: string): Base; +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 34, 11)) +>Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) + +function g(p: "hello"): JustHello; +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 35, 11)) +>JustHello : Symbol(JustHello, Decl(stringLiteralTypesOverloads03.ts, 8, 1)) + +function g(p: "hello" | "world"): HelloOrWorld; +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 36, 11)) +>HelloOrWorld : Symbol(HelloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 4, 1)) + +function g(p: "world"): JustWorld; +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads03.ts, 37, 11)) +>JustWorld : Symbol(JustWorld, Decl(stringLiteralTypesOverloads03.ts, 12, 1)) + +function g(...args: any[]): any { +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>args : Symbol(args, Decl(stringLiteralTypesOverloads03.ts, 38, 11)) + + return undefined; +>undefined : Symbol(undefined) +} + +let gResult1 = g(hello); +>gResult1 : Symbol(gResult1, Decl(stringLiteralTypesOverloads03.ts, 42, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>hello : Symbol(hello, Decl(stringLiteralTypesOverloads03.ts, 18, 3)) + +let gResult2 = g(world); +>gResult2 : Symbol(gResult2, Decl(stringLiteralTypesOverloads03.ts, 43, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>world : Symbol(world, Decl(stringLiteralTypesOverloads03.ts, 19, 3)) + +let gResult3 = g(helloOrWorld); +>gResult3 : Symbol(gResult3, Decl(stringLiteralTypesOverloads03.ts, 44, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloads03.ts, 32, 31), Decl(stringLiteralTypesOverloads03.ts, 34, 28), Decl(stringLiteralTypesOverloads03.ts, 35, 34), Decl(stringLiteralTypesOverloads03.ts, 36, 47), Decl(stringLiteralTypesOverloads03.ts, 37, 34)) +>helloOrWorld : Symbol(helloOrWorld, Decl(stringLiteralTypesOverloads03.ts, 20, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesOverloads03.types b/tests/baselines/reference/stringLiteralTypesOverloads03.types new file mode 100644 index 00000000000..643979ee987 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads03.types @@ -0,0 +1,137 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads03.ts === + +interface Base { +>Base : Base + + x: string; +>x : string + + y: number; +>y : number +} + +interface HelloOrWorld extends Base { +>HelloOrWorld : HelloOrWorld +>Base : Base + + p1: boolean; +>p1 : boolean +} + +interface JustHello extends Base { +>JustHello : JustHello +>Base : Base + + p2: boolean; +>p2 : boolean +} + +interface JustWorld extends Base { +>JustWorld : JustWorld +>Base : Base + + p3: boolean; +>p3 : boolean +} + +let hello: "hello"; +>hello : "hello" + +let world: "world"; +>world : "world" + +let helloOrWorld: "hello" | "world"; +>helloOrWorld : "hello" | "world" + +function f(p: "hello"): JustHello; +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>p : "hello" +>JustHello : JustHello + +function f(p: "hello" | "world"): HelloOrWorld; +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>p : "hello" | "world" +>HelloOrWorld : HelloOrWorld + +function f(p: "world"): JustWorld; +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>p : "world" +>JustWorld : JustWorld + +function f(p: string): Base; +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>p : string +>Base : Base + +function f(...args: any[]): any { +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>args : any[] + + return undefined; +>undefined : undefined +} + +let fResult1 = f(hello); +>fResult1 : JustHello +>f(hello) : JustHello +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>hello : "hello" + +let fResult2 = f(world); +>fResult2 : JustWorld +>f(world) : JustWorld +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>world : "world" + +let fResult3 = f(helloOrWorld); +>fResult3 : HelloOrWorld +>f(helloOrWorld) : HelloOrWorld +>f : { (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; (p: string): Base; } +>helloOrWorld : "hello" | "world" + +function g(p: string): Base; +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>p : string +>Base : Base + +function g(p: "hello"): JustHello; +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>p : "hello" +>JustHello : JustHello + +function g(p: "hello" | "world"): HelloOrWorld; +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>p : "hello" | "world" +>HelloOrWorld : HelloOrWorld + +function g(p: "world"): JustWorld; +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>p : "world" +>JustWorld : JustWorld + +function g(...args: any[]): any { +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>args : any[] + + return undefined; +>undefined : undefined +} + +let gResult1 = g(hello); +>gResult1 : JustHello +>g(hello) : JustHello +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>hello : "hello" + +let gResult2 = g(world); +>gResult2 : JustWorld +>g(world) : JustWorld +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>world : "world" + +let gResult3 = g(helloOrWorld); +>gResult3 : Base +>g(helloOrWorld) : Base +>g : { (p: string): Base; (p: "hello"): JustHello; (p: "hello" | "world"): HelloOrWorld; (p: "world"): JustWorld; } +>helloOrWorld : "hello" | "world" + diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.js b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.js new file mode 100644 index 00000000000..1576540e244 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.js @@ -0,0 +1,86 @@ +//// [stringLiteralTypesWithVariousOperators01.ts] + +let abc: "ABC" = "ABC"; +let xyz: "XYZ" = "XYZ"; +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; + +let a = "" + abc; +let b = abc + ""; +let c = 10 + abc; +let d = abc + 10; +let e = xyz + abc; +let f = abc + xyz; +let g = true + abc; +let h = abc + true; +let i = abc + abcOrXyz + xyz; +let j = abcOrXyz + abcOrXyz; +let k = +abcOrXyz; +let l = -abcOrXyz; +let m = abcOrXyzOrNumber + ""; +let n = "" + abcOrXyzOrNumber; +let o = abcOrXyzOrNumber + abcOrXyz; +let p = abcOrXyz + abcOrXyzOrNumber; +let q = !abcOrXyzOrNumber; +let r = ~abcOrXyzOrNumber; +let s = abcOrXyzOrNumber < abcOrXyzOrNumber; +let t = abcOrXyzOrNumber >= abcOrXyz; +let u = abc === abcOrXyz; +let v = abcOrXyz === abcOrXyzOrNumber; + +//// [stringLiteralTypesWithVariousOperators01.js] +var abc = "ABC"; +var xyz = "XYZ"; +var abcOrXyz = abc || xyz; +var abcOrXyzOrNumber = abcOrXyz || 100; +var a = "" + abc; +var b = abc + ""; +var c = 10 + abc; +var d = abc + 10; +var e = xyz + abc; +var f = abc + xyz; +var g = true + abc; +var h = abc + true; +var i = abc + abcOrXyz + xyz; +var j = abcOrXyz + abcOrXyz; +var k = +abcOrXyz; +var l = -abcOrXyz; +var m = abcOrXyzOrNumber + ""; +var n = "" + abcOrXyzOrNumber; +var o = abcOrXyzOrNumber + abcOrXyz; +var p = abcOrXyz + abcOrXyzOrNumber; +var q = !abcOrXyzOrNumber; +var r = ~abcOrXyzOrNumber; +var s = abcOrXyzOrNumber < abcOrXyzOrNumber; +var t = abcOrXyzOrNumber >= abcOrXyz; +var u = abc === abcOrXyz; +var v = abcOrXyz === abcOrXyzOrNumber; + + +//// [stringLiteralTypesWithVariousOperators01.d.ts] +declare let abc: "ABC"; +declare let xyz: "XYZ"; +declare let abcOrXyz: "ABC" | "XYZ"; +declare let abcOrXyzOrNumber: "ABC" | "XYZ" | number; +declare let a: string; +declare let b: string; +declare let c: string; +declare let d: string; +declare let e: string; +declare let f: string; +declare let g: string; +declare let h: string; +declare let i: string; +declare let j: string; +declare let k: number; +declare let l: number; +declare let m: string; +declare let n: string; +declare let o: string; +declare let p: string; +declare let q: boolean; +declare let r: number; +declare let s: boolean; +declare let t: boolean; +declare let u: boolean; +declare let v: boolean; diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.symbols b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.symbols new file mode 100644 index 00000000000..cc9c3aa842b --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.symbols @@ -0,0 +1,116 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts === + +let abc: "ABC" = "ABC"; +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let xyz: "XYZ" = "XYZ"; +>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3)) + +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) +>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3)) + +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let a = "" + abc; +>a : Symbol(a, Decl(stringLiteralTypesWithVariousOperators01.ts, 6, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let b = abc + ""; +>b : Symbol(b, Decl(stringLiteralTypesWithVariousOperators01.ts, 7, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let c = 10 + abc; +>c : Symbol(c, Decl(stringLiteralTypesWithVariousOperators01.ts, 8, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let d = abc + 10; +>d : Symbol(d, Decl(stringLiteralTypesWithVariousOperators01.ts, 9, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let e = xyz + abc; +>e : Symbol(e, Decl(stringLiteralTypesWithVariousOperators01.ts, 10, 3)) +>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let f = abc + xyz; +>f : Symbol(f, Decl(stringLiteralTypesWithVariousOperators01.ts, 11, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) +>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3)) + +let g = true + abc; +>g : Symbol(g, Decl(stringLiteralTypesWithVariousOperators01.ts, 12, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let h = abc + true; +>h : Symbol(h, Decl(stringLiteralTypesWithVariousOperators01.ts, 13, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) + +let i = abc + abcOrXyz + xyz; +>i : Symbol(i, Decl(stringLiteralTypesWithVariousOperators01.ts, 14, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) +>xyz : Symbol(xyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 2, 3)) + +let j = abcOrXyz + abcOrXyz; +>j : Symbol(j, Decl(stringLiteralTypesWithVariousOperators01.ts, 15, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let k = +abcOrXyz; +>k : Symbol(k, Decl(stringLiteralTypesWithVariousOperators01.ts, 16, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let l = -abcOrXyz; +>l : Symbol(l, Decl(stringLiteralTypesWithVariousOperators01.ts, 17, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let m = abcOrXyzOrNumber + ""; +>m : Symbol(m, Decl(stringLiteralTypesWithVariousOperators01.ts, 18, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let n = "" + abcOrXyzOrNumber; +>n : Symbol(n, Decl(stringLiteralTypesWithVariousOperators01.ts, 19, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let o = abcOrXyzOrNumber + abcOrXyz; +>o : Symbol(o, Decl(stringLiteralTypesWithVariousOperators01.ts, 20, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let p = abcOrXyz + abcOrXyzOrNumber; +>p : Symbol(p, Decl(stringLiteralTypesWithVariousOperators01.ts, 21, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let q = !abcOrXyzOrNumber; +>q : Symbol(q, Decl(stringLiteralTypesWithVariousOperators01.ts, 22, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let r = ~abcOrXyzOrNumber; +>r : Symbol(r, Decl(stringLiteralTypesWithVariousOperators01.ts, 23, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let s = abcOrXyzOrNumber < abcOrXyzOrNumber; +>s : Symbol(s, Decl(stringLiteralTypesWithVariousOperators01.ts, 24, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + +let t = abcOrXyzOrNumber >= abcOrXyz; +>t : Symbol(t, Decl(stringLiteralTypesWithVariousOperators01.ts, 25, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let u = abc === abcOrXyz; +>u : Symbol(u, Decl(stringLiteralTypesWithVariousOperators01.ts, 26, 3)) +>abc : Symbol(abc, Decl(stringLiteralTypesWithVariousOperators01.ts, 1, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) + +let v = abcOrXyz === abcOrXyzOrNumber; +>v : Symbol(v, Decl(stringLiteralTypesWithVariousOperators01.ts, 27, 3)) +>abcOrXyz : Symbol(abcOrXyz, Decl(stringLiteralTypesWithVariousOperators01.ts, 3, 3)) +>abcOrXyzOrNumber : Symbol(abcOrXyzOrNumber, Decl(stringLiteralTypesWithVariousOperators01.ts, 4, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types new file mode 100644 index 00000000000..90cb538b800 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types @@ -0,0 +1,152 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators01.ts === + +let abc: "ABC" = "ABC"; +>abc : "ABC" +>"ABC" : "ABC" + +let xyz: "XYZ" = "XYZ"; +>xyz : "XYZ" +>"XYZ" : "XYZ" + +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +>abcOrXyz : "ABC" | "XYZ" +>abc || xyz : "ABC" | "XYZ" +>abc : "ABC" +>xyz : "XYZ" + +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; +>abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyz || 100 : "ABC" | "XYZ" | number +>abcOrXyz : "ABC" | "XYZ" +>100 : number + +let a = "" + abc; +>a : string +>"" + abc : string +>"" : string +>abc : "ABC" + +let b = abc + ""; +>b : string +>abc + "" : string +>abc : "ABC" +>"" : string + +let c = 10 + abc; +>c : string +>10 + abc : string +>10 : number +>abc : "ABC" + +let d = abc + 10; +>d : string +>abc + 10 : string +>abc : "ABC" +>10 : number + +let e = xyz + abc; +>e : string +>xyz + abc : string +>xyz : "XYZ" +>abc : "ABC" + +let f = abc + xyz; +>f : string +>abc + xyz : string +>abc : "ABC" +>xyz : "XYZ" + +let g = true + abc; +>g : string +>true + abc : string +>true : boolean +>abc : "ABC" + +let h = abc + true; +>h : string +>abc + true : string +>abc : "ABC" +>true : boolean + +let i = abc + abcOrXyz + xyz; +>i : string +>abc + abcOrXyz + xyz : string +>abc + abcOrXyz : string +>abc : "ABC" +>abcOrXyz : "ABC" | "XYZ" +>xyz : "XYZ" + +let j = abcOrXyz + abcOrXyz; +>j : string +>abcOrXyz + abcOrXyz : string +>abcOrXyz : "ABC" | "XYZ" +>abcOrXyz : "ABC" | "XYZ" + +let k = +abcOrXyz; +>k : number +>+abcOrXyz : number +>abcOrXyz : "ABC" | "XYZ" + +let l = -abcOrXyz; +>l : number +>-abcOrXyz : number +>abcOrXyz : "ABC" | "XYZ" + +let m = abcOrXyzOrNumber + ""; +>m : string +>abcOrXyzOrNumber + "" : string +>abcOrXyzOrNumber : "ABC" | "XYZ" | number +>"" : string + +let n = "" + abcOrXyzOrNumber; +>n : string +>"" + abcOrXyzOrNumber : string +>"" : string +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + +let o = abcOrXyzOrNumber + abcOrXyz; +>o : string +>abcOrXyzOrNumber + abcOrXyz : string +>abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyz : "ABC" | "XYZ" + +let p = abcOrXyz + abcOrXyzOrNumber; +>p : string +>abcOrXyz + abcOrXyzOrNumber : string +>abcOrXyz : "ABC" | "XYZ" +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + +let q = !abcOrXyzOrNumber; +>q : boolean +>!abcOrXyzOrNumber : boolean +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + +let r = ~abcOrXyzOrNumber; +>r : number +>~abcOrXyzOrNumber : number +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + +let s = abcOrXyzOrNumber < abcOrXyzOrNumber; +>s : boolean +>abcOrXyzOrNumber < abcOrXyzOrNumber : boolean +>abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + +let t = abcOrXyzOrNumber >= abcOrXyz; +>t : boolean +>abcOrXyzOrNumber >= abcOrXyz : boolean +>abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyz : "ABC" | "XYZ" + +let u = abc === abcOrXyz; +>u : boolean +>abc === abcOrXyz : boolean +>abc : "ABC" +>abcOrXyz : "ABC" | "XYZ" + +let v = abcOrXyz === abcOrXyzOrNumber; +>v : boolean +>abcOrXyz === abcOrXyzOrNumber : boolean +>abcOrXyz : "ABC" | "XYZ" +>abcOrXyzOrNumber : "ABC" | "XYZ" | number + diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt new file mode 100644 index 00000000000..92afe67df0c --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(12,9): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ==== + + let abc: "ABC" = "ABC"; + let xyz: "XYZ" = "XYZ"; + let abcOrXyz: "ABC" | "XYZ" = abc || xyz; + let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; + + let a = abcOrXyzOrNumber + 100; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'. + let b = 100 + abcOrXyzOrNumber; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'. + let c = abcOrXyzOrNumber + abcOrXyzOrNumber; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'. + let d = abcOrXyzOrNumber + true; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'. + let e = false + abcOrXyzOrNumber; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'. + let f = abcOrXyzOrNumber++; + ~~~~~~~~~~~~~~~~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + let g = --abcOrXyzOrNumber; + ~~~~~~~~~~~~~~~~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + let h = abcOrXyzOrNumber ^ 10; + ~~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + let i = abcOrXyzOrNumber | 10; + ~~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + let j = abc < xyz; + ~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. + let k = abc === xyz; + ~~~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. + let l = abc != xyz; + ~~~~~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.js b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.js new file mode 100644 index 00000000000..4914ecf3d17 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.js @@ -0,0 +1,56 @@ +//// [stringLiteralTypesWithVariousOperators02.ts] + +let abc: "ABC" = "ABC"; +let xyz: "XYZ" = "XYZ"; +let abcOrXyz: "ABC" | "XYZ" = abc || xyz; +let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; + +let a = abcOrXyzOrNumber + 100; +let b = 100 + abcOrXyzOrNumber; +let c = abcOrXyzOrNumber + abcOrXyzOrNumber; +let d = abcOrXyzOrNumber + true; +let e = false + abcOrXyzOrNumber; +let f = abcOrXyzOrNumber++; +let g = --abcOrXyzOrNumber; +let h = abcOrXyzOrNumber ^ 10; +let i = abcOrXyzOrNumber | 10; +let j = abc < xyz; +let k = abc === xyz; +let l = abc != xyz; + +//// [stringLiteralTypesWithVariousOperators02.js] +var abc = "ABC"; +var xyz = "XYZ"; +var abcOrXyz = abc || xyz; +var abcOrXyzOrNumber = abcOrXyz || 100; +var a = abcOrXyzOrNumber + 100; +var b = 100 + abcOrXyzOrNumber; +var c = abcOrXyzOrNumber + abcOrXyzOrNumber; +var d = abcOrXyzOrNumber + true; +var e = false + abcOrXyzOrNumber; +var f = abcOrXyzOrNumber++; +var g = --abcOrXyzOrNumber; +var h = abcOrXyzOrNumber ^ 10; +var i = abcOrXyzOrNumber | 10; +var j = abc < xyz; +var k = abc === xyz; +var l = abc != xyz; + + +//// [stringLiteralTypesWithVariousOperators02.d.ts] +declare let abc: "ABC"; +declare let xyz: "XYZ"; +declare let abcOrXyz: "ABC" | "XYZ"; +declare let abcOrXyzOrNumber: "ABC" | "XYZ" | number; +declare let a: any; +declare let b: any; +declare let c: any; +declare let d: any; +declare let e: any; +declare let f: number; +declare let g: number; +declare let h: number; +declare let i: number; +declare let j: boolean; +declare let k: boolean; +declare let l: boolean; From d2e2a55a9ed8e212c1c196a33c9163f8c8bf7da8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 14:36:36 -0700 Subject: [PATCH 036/140] Added fourslash test. --- ...ickInfoDisplayPartsVarWithStringTypes01.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts diff --git a/tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts b/tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts new file mode 100644 index 00000000000..b48c7cfa3de --- /dev/null +++ b/tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts @@ -0,0 +1,41 @@ +/// + +////let /*1*/hello: "hello" | 'hello' = "hello"; +////let /*2*/world: 'world' = "world"; +////let /*3*/helloOrWorld: "hello" | 'world'; + +goTo.marker("1"); +verify.verifyQuickInfoDisplayParts("let", "", { start: test.markerByName('1').position, length: "hello".length }, [ + { text: "let", kind: "keyword" }, + { text: " ", kind: "space" }, + { text: "hello", kind: "localName" }, + { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: '"hello"', kind: "stringLiteral" }, ], + /*documentation*/ []); + +goTo.marker("2"); +verify.verifyQuickInfoDisplayParts("let", "", { start: test.markerByName('2').position, length: "world".length }, [ + { text: "let", kind: "keyword" }, + { text: " ", kind: "space" }, + { text: "world", kind: "localName" }, + { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: '"world"', kind: "stringLiteral" }, + ], + /*documentation*/[]); + +goTo.marker("3"); +verify.verifyQuickInfoDisplayParts("let", "", { start: test.markerByName('3').position, length: "helloOrWorld".length }, [ + { text: "let", kind: "keyword" }, + { text: " ", kind: "space" }, + { text: "helloOrWorld", kind: "localName" }, + { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: '"hello"', kind: "stringLiteral" }, + { text: " ", kind: "space" }, + { text: "|", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: '"world"', kind: "stringLiteral" }, + ], + /*documentation*/[]); \ No newline at end of file From 74ac57ddfcdca56e037ca7019f06b288560df43a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 15:26:00 -0700 Subject: [PATCH 037/140] Accepted post-merge baselines. --- .../parserErrorRecovery_IncompleteMemberVariable1.symbols | 6 +++--- .../parserErrorRecovery_IncompleteMemberVariable1.types | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols index db9cefbf642..7b8be05f923 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols @@ -27,9 +27,9 @@ module Shapes { // Instance member getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } >getDist : Symbol(getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 60)) ->Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, 620, 27)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11)) ->sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, 620, 27)) +>Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) >this.x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) >this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) >x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types index bb51151cfd7..b38bbbfe64d 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.types @@ -34,17 +34,17 @@ module Shapes { >this.x * this.x + this.y * this.y : number >this.x * this.x : number >this.x : number ->this : Point +>this : this >x : number >this.x : number ->this : Point +>this : this >x : number >this.y * this.y : number >this.y : number ->this : Point +>this : this >y : number >this.y : number ->this : Point +>this : this >y : number // Static member From 61ece765c74f7cf48a7b61c9137405e206bd1766 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 15:27:12 -0700 Subject: [PATCH 038/140] Return the string literal type itself instead of the union type. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bf8072bf2a5..3b43533e56b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10292,7 +10292,7 @@ namespace ts { if (contextualType.flags & TypeFlags.Union) { for (const type of (contextualType).types) { if (type.flags & TypeFlags.StringLiteral && (type).text === node.text) { - return contextualType; + return type; } } } From 84b64c4c670676b06cbf98891c85ab8c9f537182 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 15:34:46 -0700 Subject: [PATCH 039/140] Accepted baselines. --- tests/baselines/reference/stringLiteralTypesAndTuples01.types | 4 ++-- .../reference/stringLiteralTypesInUnionTypes01.types | 4 ++-- .../reference/stringLiteralTypesInUnionTypes02.types | 4 ++-- .../reference/stringLiteralTypesInUnionTypes04.types | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.types b/tests/baselines/reference/stringLiteralTypesAndTuples01.types index 740cf237412..c874973e3e5 100644 --- a/tests/baselines/reference/stringLiteralTypesAndTuples01.types +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.types @@ -20,10 +20,10 @@ let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; >a : "a" >dinosaur : "t-rex" | "raptor" >RexOrRaptor : "t-rex" | "raptor" ->['I\'m', 'a', 't-rex'] : ["I'm", "a", "t-rex" | "raptor"] +>['I\'m', 'a', 't-rex'] : ["I'm", "a", "t-rex"] >'I\'m' : "I'm" >'a' : "a" ->'t-rex' : "t-rex" | "raptor" +>'t-rex' : "t-rex" rawr(dinosaur); >rawr(dinosaur) : string diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types index b5a2d876bcc..e5ff509822b 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types @@ -5,12 +5,12 @@ type T = "foo" | "bar" | "baz"; var x: "foo" | "bar" | "baz" = "foo"; >x : "foo" | "bar" | "baz" ->"foo" : "foo" | "bar" | "baz" +>"foo" : "foo" var y: T = "bar"; >y : "foo" | "bar" | "baz" >T : "foo" | "bar" | "baz" ->"bar" : "foo" | "bar" | "baz" +>"bar" : "bar" if (x === "foo") { >x === "foo" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types index e3ac5ba4817..b468c620376 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types @@ -5,12 +5,12 @@ type T = string | "foo" | "bar" | "baz"; var x: "foo" | "bar" | "baz" | string = "foo"; >x : "foo" | "bar" | "baz" | string ->"foo" : "foo" | "bar" | "baz" | string +>"foo" : "foo" var y: T = "bar"; >y : string | "foo" | "bar" | "baz" >T : string | "foo" | "bar" | "baz" ->"bar" : string | "foo" | "bar" | "baz" +>"bar" : "bar" if (x === "foo") { >x === "foo" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types index 9a010b490cc..ad92dc360d0 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types @@ -6,12 +6,12 @@ type T = "" | "foo"; let x: T = ""; >x : "" | "foo" >T : "" | "foo" ->"" : "" | "foo" +>"" : "" let y: T = "foo"; >y : "" | "foo" >T : "" | "foo" ->"foo" : "" | "foo" +>"foo" : "foo" if (x === "") { >x === "" : boolean From 3788254fdc23e51f90d00444e02062671d89871d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 15:49:32 -0700 Subject: [PATCH 040/140] Semicolon. --- src/compiler/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5726d260876..dcc924d29b4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2366,7 +2366,7 @@ namespace ts { let node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); case SyntaxKind.StringLiteral: - return parseLiteralNode(/*internName*/ true) + return parseLiteralNode(/*internName*/ true); case SyntaxKind.VoidKeyword: case SyntaxKind.ThisKeyword: return parseTokenNode(); From ebc47d5e0213d31c7eee6111b7c9f09078c8f1ae Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 8 Oct 2015 16:04:09 -0700 Subject: [PATCH 041/140] Linting. --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3b43533e56b..be8a486cf65 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10286,7 +10286,7 @@ namespace ts { function checkStringLiteralExpression(node: LiteralExpression) { // TODO (drosen): Do we want to apply the same approach to no-sub template literals? - + let contextualType = getContextualType(node); if (contextualType) { if (contextualType.flags & TypeFlags.Union) { @@ -10435,7 +10435,7 @@ namespace ts { case SyntaxKind.StringLiteral: return checkStringLiteralExpression(node); case SyntaxKind.NoSubstitutionTemplateLiteral: - return stringType + return stringType; case SyntaxKind.RegularExpressionLiteral: return globalRegExpType; case SyntaxKind.ArrayLiteralExpression: From 1a36fce4c2304d87a6f49ba3ec580819b15a2722 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 14 Oct 2015 17:36:03 -0700 Subject: [PATCH 042/140] JavaScript LS scaffolding + JS module inference --- lib/lib.core.d.ts | 16 + lib/lib.core.es6.d.ts | 16 + lib/lib.d.ts | 16 + lib/lib.es6.d.ts | 16 + lib/tsc.js | 1 + src/compiler/binder.ts | 65 ++- src/compiler/checker.ts | 83 +++- src/compiler/core.ts | 7 +- src/compiler/parser.ts | 17 +- src/compiler/program.ts | 25 +- src/compiler/types.ts | 7 +- src/compiler/utilities.ts | 60 ++- src/harness/fourslash.ts | 32 +- src/harness/harness.ts | 2 +- src/harness/harnessLanguageService.ts | 2 +- src/lib/core.d.ts | 16 + src/server/editorServices.ts | 9 +- src/services/services.ts | 452 +++++++++++------- src/services/shims.ts | 3 +- src/services/signatureHelp.ts | 2 +- .../getJavaScriptSyntacticDiagnostics1.ts | 19 - tests/cases/fourslash/javaScriptModules12.ts | 57 +++ tests/cases/fourslash/javaScriptModules13.ts | 29 ++ tests/cases/fourslash/javaScriptModules14.ts | 28 ++ tests/cases/fourslash/javaScriptModules15.ts | 27 ++ tests/cases/fourslash/javaScriptModules16.ts | 22 + tests/cases/fourslash/javaScriptModules17.ts | 18 + tests/cases/fourslash/javaScriptModules18.ts | 14 + tests/cases/unittests/moduleResolution.ts | 28 +- .../unittests/services/preProcessFile.ts | 149 +++++- tests/webTestServer.ts | 15 +- 31 files changed, 993 insertions(+), 260 deletions(-) delete mode 100644 tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts create mode 100644 tests/cases/fourslash/javaScriptModules12.ts create mode 100644 tests/cases/fourslash/javaScriptModules13.ts create mode 100644 tests/cases/fourslash/javaScriptModules14.ts create mode 100644 tests/cases/fourslash/javaScriptModules15.ts create mode 100644 tests/cases/fourslash/javaScriptModules16.ts create mode 100644 tests/cases/fourslash/javaScriptModules17.ts create mode 100644 tests/cases/fourslash/javaScriptModules18.ts diff --git a/lib/lib.core.d.ts b/lib/lib.core.d.ts index b588c9fdb77..c1a71dd8d1d 100644 --- a/lib/lib.core.d.ts +++ b/lib/lib.core.d.ts @@ -1198,6 +1198,22 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + interface ArrayLike { length: number; [n: number]: T; diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts index fd115497f8a..b0d4120b4b9 100644 --- a/lib/lib.core.es6.d.ts +++ b/lib/lib.core.es6.d.ts @@ -1198,6 +1198,22 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + interface ArrayLike { length: number; [n: number]: T; diff --git a/lib/lib.d.ts b/lib/lib.d.ts index a65fc96e43f..450f79b36e9 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -1198,6 +1198,22 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + interface ArrayLike { length: number; [n: number]: T; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 75ba647a128..63e6a101fbc 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -1198,6 +1198,22 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + interface ArrayLike { length: number; [n: number]: T; diff --git a/lib/tsc.js b/lib/tsc.js index 3d2b7f3956a..a4c2586f041 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -650,6 +650,7 @@ var ts; } ts.fileExtensionIs = fileExtensionIs; ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c12a9afad62..4e0d5225f58 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -6,8 +6,8 @@ namespace ts { export const enum ModuleInstanceState { NonInstantiated = 0, - Instantiated = 1, - ConstEnumOnly = 2 + Instantiated = 1, + ConstEnumOnly = 2 } export function getModuleInstanceState(node: Node): ModuleInstanceState { @@ -90,6 +90,8 @@ namespace ts { let lastContainer: Node; let seenThisKeyword: boolean; + let isJavaScriptFile = isSourceFileJavaScript(file); + // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). @@ -167,6 +169,10 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: return node.flags & NodeFlags.Default ? "default" : undefined; + + case SyntaxKind.BinaryExpression: + Debug.assert(isModuleExportsAssignment(node)); + return "__jsExports"; } } @@ -779,7 +785,7 @@ namespace ts { return "__" + indexOf((node.parent).parameters, node); } - function bind(node: Node) { + function bind(node: Node): void { node.parent = parent; let savedInStrictMode = inStrictMode; @@ -851,9 +857,18 @@ namespace ts { function bindWorker(node: Node) { switch (node.kind) { + /* Strict mode checks */ case SyntaxKind.Identifier: return checkStrictModeIdentifier(node); case SyntaxKind.BinaryExpression: + if (isJavaScriptFile) { + if (isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); case SyntaxKind.CatchClause: return checkStrictModeCatchClause(node); @@ -919,6 +934,16 @@ namespace ts { checkStrictModeFunctionName(node); let bindingName = (node).name ? (node).name.text : "__function"; return bindAnonymousDeclaration(node, SymbolFlags.Function, bindingName); + + case SyntaxKind.CallExpression: + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (isJavaScriptFile && !file.commonJsModuleIndicator) { + bindCallExpression(node); + } + break; + + // Members of classes, interfaces, and modules case SyntaxKind.ClassExpression: case SyntaxKind.ClassDeclaration: return bindClassLikeDeclaration(node); @@ -930,6 +955,8 @@ namespace ts { return bindEnumDeclaration(node); case SyntaxKind.ModuleDeclaration: return bindModuleDeclaration(node); + + // Imports and exports case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.NamespaceImport: case SyntaxKind.ImportSpecifier: @@ -949,10 +976,14 @@ namespace ts { function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (isExternalModule(file)) { - bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName)}"`); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName) }"`); + } + function bindExportAssignment(node: ExportAssignment) { if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct @@ -985,6 +1016,32 @@ namespace ts { } } + function setCommonJsModuleIndicator(node: Node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + + function bindExportsPropertyAssignment(node: BinaryExpression) { + // When we create a property via 'exports.foo = bar', the 'exports.foo' property access + // expression is the declaration + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, SymbolFlags.Property | SymbolFlags.Export, SymbolFlags.None); + } + + function bindModuleExportsAssignment(node: BinaryExpression) { + // 'module.exports = expr' assignment + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.None, SymbolFlags.None); + } + + function bindCallExpression(node: CallExpression) { + if (isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node: ClassLikeDeclaration) { if (node.kind === SyntaxKind.ClassDeclaration) { bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b13520cee2d..7e15f0a3ad0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -160,6 +160,8 @@ namespace ts { let getGlobalPromiseConstructorLikeType: () => ObjectType; let getGlobalThenableType: () => ObjectType; + let cjsRequireType: Type; + let tupleTypes: Map = {}; let unionTypes: Map = {}; let intersectionTypes: Map = {}; @@ -362,7 +364,7 @@ namespace ts { } function isGlobalSourceFile(node: Node) { - return node.kind === SyntaxKind.SourceFile && !isExternalModule(node); + return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(node); } function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol { @@ -478,7 +480,7 @@ namespace ts { } switch (location.kind) { case SyntaxKind.SourceFile: - if (!isExternalModule(location)) break; + if (!isExternalOrCommonJsModule(location)) break; case SyntaxKind.ModuleDeclaration: let moduleExports = getSymbolOfNode(location).exports; if (location.kind === SyntaxKind.SourceFile || @@ -993,6 +995,11 @@ namespace ts { if (moduleName === undefined) { return; } + + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } + let isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule); @@ -1080,6 +1087,20 @@ namespace ts { visit(resolveExternalModuleName(node, (node).moduleSpecifier)); } } + + // CommonJS 'module.exports = expr' assignments + let commonJsModuleExports = symbol.exports["__jsExports"]; + if (commonJsModuleExports) { + for (var i = 0; i < commonJsModuleExports.declarations.length; i++) { + let properties = getPropertiesOfType(checkExpression((commonJsModuleExports.declarations[i]).right)); + if (i === 0) { + result = createSymbolTable(properties); + } + else { + mergeSymbolTable(result, createSymbolTable(properties)); + } + } + } } } } @@ -1203,7 +1224,7 @@ namespace ts { } switch (location.kind) { case SyntaxKind.SourceFile: - if (!isExternalModule(location)) { + if (!isExternalOrCommonJsModule(location)) { break; } case SyntaxKind.ModuleDeclaration: @@ -1385,7 +1406,7 @@ namespace ts { function hasExternalModuleSymbol(declaration: Node) { return (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).name.kind === SyntaxKind.StringLiteral) || - (declaration.kind === SyntaxKind.SourceFile && isExternalModule(declaration)); + (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult { @@ -2059,7 +2080,7 @@ namespace ts { } } else if (node.kind === SyntaxKind.SourceFile) { - return isExternalModule(node) ? node : undefined; + return isExternalOrCommonJsModule(node) ? node : undefined; } } Debug.fail("getContainingModule cant reach here"); @@ -2180,7 +2201,7 @@ namespace ts { case SyntaxKind.SourceFile: return true; - // Export assignements do not create name bindings outside the module + // Export assignments do not create name bindings outside the module case SyntaxKind.ExportAssignment: return false; @@ -2565,6 +2586,10 @@ namespace ts { if (declaration.kind === SyntaxKind.ExportAssignment) { return links.type = checkExpression((declaration).expression); } + // Handle exports.p = expr + if (declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) { + return checkExpressionCached((declaration.parent).right); + } // Handle variable, parameter or property if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { return unknownType; @@ -3811,6 +3836,18 @@ namespace ts { return result; } + function resolveExternalModuleTypeByLiteral(name: StringLiteral) { + let moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + let moduleSymSym = resolveExternalModuleSymbol(moduleSym); + if (moduleSymSym) { + return getTypeOfSymbol(moduleSymSym); + } + } + + return anyType; + } + function getReturnTypeOfSignature(signature: Signature): Type { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, TypeSystemPropertyName.ResolvedReturnType)) { @@ -4174,11 +4211,15 @@ namespace ts { * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace: string, name: string): Type { - let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined); - let typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type); + let typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace: string, name: string): Symbol { + let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type | SymbolFlags.Value); + } + function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -9345,6 +9386,14 @@ namespace ts { return anyType; } } + + let exprType = checkExpression(node.expression); + if (exprType === cjsRequireType) { + if (node.arguments.length === 1 && node.arguments[0].kind === SyntaxKind.StringLiteral) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } + } + return getReturnTypeOfSignature(signature); } @@ -11965,7 +12014,7 @@ namespace ts { // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent let parent = getDeclarationContainer(node); - if (parent.kind === SyntaxKind.SourceFile && isExternalModule(parent)) { + if (parent.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, declarationNameToString(name), declarationNameToString(name)); @@ -14047,7 +14096,7 @@ namespace ts { forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (isExternalModule(node)) { + if (isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } @@ -14150,7 +14199,7 @@ namespace ts { switch (location.kind) { case SyntaxKind.SourceFile: - if (!isExternalModule(location)) { + if (!isExternalOrCommonJsModule(location)) { break; } case SyntaxKind.ModuleDeclaration: @@ -14881,16 +14930,24 @@ namespace ts { // Initialize global symbol table forEach(host.getSourceFiles(), file => { - if (!isExternalModule(file)) { + if (!isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); // Initialize special symbols + if (compilerOptions.allowNonTsExtensions) { + let req = getExportedSymbolFromNamespace("CommonJS", "require"); + if (req) { + globals["require"] = req; + } + } + getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; + // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); @@ -14913,6 +14970,8 @@ namespace ts { getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); + cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. if (languageVersion >= ScriptTarget.ES6) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 307a1ddd502..6f0aa363068 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -726,12 +726,7 @@ namespace ts { * List of supported extensions in order of file resolution precedence. */ export const supportedExtensions = [".ts", ".tsx", ".d.ts"]; - /** - * List of extensions that will be used to look for external modules. - * This list is kept separate from supportedExtensions to for cases when we'll allow to include .js files in compilation, - * but still would like to load only TypeScript files as modules - */ - export const moduleFileExtensions = supportedExtensions; + export const supportedJsExtensions = supportedExtensions.concat(".js", ".jsx"); const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; export function removeFileExtension(path: string): string { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1551706a337..b477724475f 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -527,7 +527,8 @@ namespace ts { let parseErrorBeforeNextFinishedNode = false; export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean): SourceFile { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + const isJavaScriptFile = hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); let result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); @@ -536,7 +537,7 @@ namespace ts { return result; } - function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor) { + function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, isJavaScriptFile: boolean, _syntaxCursor: IncrementalParser.SyntaxCursor) { sourceText = _sourceText; syntaxCursor = _syntaxCursor; @@ -546,7 +547,7 @@ namespace ts { identifierCount = 0; nodeCount = 0; - contextFlags = isJavaScript(fileName) ? ParserContextFlags.JavaScriptFile : ParserContextFlags.None; + contextFlags = isJavaScriptFile ? ParserContextFlags.JavaScriptFile : ParserContextFlags.None; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. @@ -572,6 +573,10 @@ namespace ts { function parseSourceFileWorker(fileName: string, languageVersion: ScriptTarget, setParentNodes: boolean): SourceFile { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & ParserContextFlags.JavaScriptFile) { + sourceFile.parserContextFlags = ParserContextFlags.JavaScriptFile; + } + // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -594,7 +599,7 @@ namespace ts { // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. - if (isJavaScript(fileName)) { + if (isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } @@ -5486,7 +5491,7 @@ namespace ts { } export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) { - initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); let jsDocTypeExpression = parseJSDocTypeExpression(start, length); let diagnostics = parseDiagnostics; clearState(); @@ -5806,7 +5811,7 @@ namespace ts { } export function parseIsolatedJSDocComment(content: string, start: number, length: number) { - initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); let jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); let diagnostics = parseDiagnostics; clearState(); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 86719ff30b4..08fd94c60d3 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -70,7 +70,7 @@ namespace ts { } function loadNodeModuleFromFile(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { - return forEach(moduleFileExtensions, tryLoad); + return forEach(supportedJsExtensions, tryLoad); function tryLoad(ext: string): string { let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext; @@ -162,9 +162,10 @@ namespace ts { let failedLookupLocations: string[] = []; let referencedSourceFile: string; + let extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions; while (true) { searchName = normalizePath(combinePaths(searchPath, moduleName)); - referencedSourceFile = forEach(supportedExtensions, extension => { + referencedSourceFile = forEach(extensions, extension => { if (extension === ".tsx" && !compilerOptions.jsx) { // resolve .tsx files only if jsx support is enabled // 'logical not' handles both undefined and None cases @@ -684,6 +685,8 @@ namespace ts { return; } + let isJavaScriptFile = isSourceFileJavaScript(file); + let imports: LiteralExpression[]; for (let node of file.statements) { collect(node, /* allowRelativeModuleNames */ true); @@ -708,6 +711,20 @@ namespace ts { (imports || (imports = [])).push(moduleNameExpr); } break; + case SyntaxKind.CallExpression: + if (isJavaScriptFile && isRequireCall(node)) { + + let jsImports = (node).arguments; + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === SyntaxKind.StringLiteral) { + imports.push(jsImports[i]); + } + } + } + } + break; case SyntaxKind.ModuleDeclaration: if ((node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 @@ -724,6 +741,10 @@ namespace ts { } break; } + + if (isSourceFileJavaScript(file)) { + forEachChild(node, node => collect(node, allowRelativeModuleNames)); + } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6e5528b8217..a1665d081ae 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -764,7 +764,8 @@ namespace ts { expression?: Expression; } - export interface BinaryExpression extends Expression { + // Binary expressions can be declarations if they are 'exports.foo = bar' expressions in JS files + export interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -825,7 +826,7 @@ namespace ts { properties: NodeArray; } - export interface PropertyAccessExpression extends MemberExpression { + export interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; dotToken: Node; name: Identifier; @@ -1274,6 +1275,8 @@ namespace ts { // The first node that causes this file to be an external module /* @internal */ externalModuleIndicator: Node; + // The first node that causes this file to be a CommonJS module + /* @internal */ commonJsModuleIndicator: Node; /* @internal */ isDefaultLib: boolean; /* @internal */ identifiers: Map; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 2a16c2c71fb..c5dfcf8947e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -362,6 +362,10 @@ namespace ts { return file.externalModuleIndicator !== undefined; } + export function isExternalOrCommonJsModule(file: SourceFile): boolean { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + export function isDeclarationFile(file: SourceFile): boolean { return (file.flags & NodeFlags.DeclarationFile) !== 0; } @@ -1031,6 +1035,56 @@ namespace ts { return node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind !== SyntaxKind.ExternalModuleReference; } + export function isSourceFileJavaScript(file: SourceFile): boolean { + return isInJavaScriptFile(file); + } + + function isInJavaScriptFile(node: Node): boolean { + return node && !!(node.parserContextFlags & ParserContextFlags.JavaScriptFile); + } + + /** + * Returns true if the node is a CallExpression to the identifier 'require' with + * exactly one argument. + * This function does not test if the node is in a JavaScript file or not. + */ + export function isRequireCall(expression: Node): expression is CallExpression { + // of the form 'require("name")' + return expression.kind === SyntaxKind.CallExpression && + (expression).expression.kind === SyntaxKind.Identifier && + ((expression).expression).text === "require" && + (expression).arguments.length === 1; + } + + /** + * Returns true if the node is an assignment to a property on the identifier 'exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + export function isExportsPropertyAssignment(expression: Node): boolean { + // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === SyntaxKind.BinaryExpression) && + ((expression).operatorToken.kind === SyntaxKind.EqualsToken) && + ((expression).left.kind === SyntaxKind.PropertyAccessExpression) && + (((expression).left).expression.kind === SyntaxKind.Identifier) && + (((((expression).left).expression)).text === "exports"); + } + + /** + * Returns true if the node is an assignment to the property access expression 'module.exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + export function isModuleExportsAssignment(expression: Node): boolean { + // of the form 'module.exports = expr' where 'expr' is arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === SyntaxKind.BinaryExpression) && + ((expression).operatorToken.kind === SyntaxKind.EqualsToken) && + ((expression).left.kind === SyntaxKind.PropertyAccessExpression) && + (((expression).left).expression.kind === SyntaxKind.Identifier) && + (((((expression).left).expression)).text === "module") && + (((expression).left).name.text === "exports"); + } + export function getExternalModuleName(node: Node): Expression { if (node.kind === SyntaxKind.ImportDeclaration) { return (node).moduleSpecifier; @@ -2083,12 +2137,12 @@ namespace ts { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined; } - export function isJavaScript(fileName: string) { - return fileExtensionIs(fileName, ".js"); + export function hasJavaScriptFileExtension(fileName: string) { + return fileExtensionIs(fileName, ".js") || fileExtensionIs(fileName, ".jsx"); } export function isTsx(fileName: string) { - return fileExtensionIs(fileName, ".tsx"); + return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx"); } /** diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 457ece7e132..dd2dde6989c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -223,10 +223,22 @@ namespace FourSlash { // Add input file which has matched file name with the given reference-file path. // This is necessary when resolveReference flag is specified - private addMatchedInputFile(referenceFilePath: string) { - let inputFile = this.inputFiles[referenceFilePath]; - if (inputFile && !Harness.isLibraryFile(referenceFilePath)) { - this.languageServiceAdapterHost.addScript(referenceFilePath, inputFile); + private addMatchedInputFile(referenceFilePath: string, extensions: string[]) { + let inputFiles = this.inputFiles; + let languageServiceAdapterHost = this.languageServiceAdapterHost; + if (!extensions) { + tryAdd(referenceFilePath); + } + else { + tryAdd(referenceFilePath) || ts.forEach(extensions, ext => tryAdd(referenceFilePath + ext)); + } + + function tryAdd(path: string) { + let inputFile = inputFiles[path]; + if (inputFile && !Harness.isLibraryFile(path)) { + languageServiceAdapterHost.addScript(path, inputFile); + return true; + } } } @@ -280,15 +292,15 @@ namespace FourSlash { ts.forEach(referencedFiles, referenceFile => { // Fourslash insert tests/cases/fourslash into inputFile.unitName so we will properly append the same base directory to refFile path let referenceFilePath = this.basePath + "/" + referenceFile.fileName; - this.addMatchedInputFile(referenceFilePath); + this.addMatchedInputFile(referenceFilePath, /* extensions */ undefined); }); // Add import files into language-service host ts.forEach(importedFiles, importedFile => { // Fourslash insert tests/cases/fourslash into inputFile.unitName and import statement doesn't require ".ts" // so convert them before making appropriate comparison - let importedFilePath = this.basePath + "/" + importedFile.fileName + ".ts"; - this.addMatchedInputFile(importedFilePath); + let importedFilePath = this.basePath + "/" + importedFile.fileName; + this.addMatchedInputFile(importedFilePath, compilationOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions); }); // Check if no-default-lib flag is false and if so add default library @@ -2257,15 +2269,15 @@ namespace FourSlash { let details = this.getCompletionEntryDetails(item.name); if (documentation !== undefined) { - assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation")); + assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation for " + name)); } if (text !== undefined) { - assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text")); + assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text for " + name)); } } if (kind !== undefined) { - assert.equal(item.kind, kind, assertionMessage("completion item kind")); + assert.equal(item.kind, kind, assertionMessage("completion item kind for " + name)); } return; diff --git a/src/harness/harness.ts b/src/harness/harness.ts index a37b647a124..91897493fd9 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -211,7 +211,7 @@ namespace Utils { return isNodeOrArray(v) ? serializeNode(v) : v; }, " "); - function getKindName(k: number | string): string { + function getKindName(k: number|string): string { if (typeof k === "string") { return k; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index dfde2bd1c08..688b7f0b906 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -197,7 +197,7 @@ namespace Harness.LanguageService { getHost() { return this.host; } getLanguageService(): ts.LanguageService { return ts.createLanguageService(this.host); } getClassifier(): ts.Classifier { return ts.createClassifier(); } - getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { return ts.preProcessFile(fileContents); } + getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { return ts.preProcessFile(fileContents, /* readImportFiles */ true, ts.hasJavaScriptFileExtension(fileName)); } } /// Shim adapter diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 7259ff5081c..86dee00638d 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -1183,6 +1183,22 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + interface ArrayLike { length: number; [n: number]: T; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 436b97821cc..8ea216eefe6 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -361,6 +361,10 @@ namespace ts.server { openRefCount = 0; constructor(public projectService: ProjectService, public projectOptions?: ProjectOptions) { + if(projectOptions && projectOptions.files){ + // If files are listed explicitly, allow all extensions + projectOptions.compilerOptions.allowNonTsExtensions = true; + } this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions); } @@ -449,6 +453,7 @@ namespace ts.server { setProjectOptions(projectOptions: ProjectOptions) { this.projectOptions = projectOptions; if (projectOptions.compilerOptions) { + projectOptions.compilerOptions.allowNonTsExtensions = true; this.compilerService.setCompilerOptions(projectOptions.compilerOptions); } } @@ -1156,7 +1161,9 @@ namespace ts.server { this.setCompilerOptions(opt); } else { - this.setCompilerOptions(ts.getDefaultCompilerOptions()); + var defaultOpts = ts.getDefaultCompilerOptions(); + defaultOpts.allowNonTsExtensions = true; + this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); this.classifier = ts.createClassifier(); diff --git a/src/services/services.ts b/src/services/services.ts index 15c6e3df56f..a6611a3d39a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -794,6 +794,7 @@ namespace ts { public isDefaultLib: boolean; public hasNoDefaultLib: boolean; public externalModuleIndicator: Node; // The first node that causes this file to be an external module + public commonJsModuleIndicator: Node; // The first node that causes this file to be a CommonJS module public nodeCount: number; public identifierCount: number; public symbolCount: number; @@ -2108,7 +2109,7 @@ namespace ts { }; } - export function preProcessFile(sourceText: string, readImportFiles = true): PreProcessedFileInfo { + export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo { let referencedFiles: FileReference[] = []; let importedFiles: FileReference[] = []; let ambientExternalModules: string[]; @@ -2146,9 +2147,239 @@ namespace ts { }); } - function processImport(): void { + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare(): boolean { + let token = scanner.getToken(); + if (token === SyntaxKind.DeclareKeyword) { + // declare module "mod" + token = scanner.scan(); + if (token === SyntaxKind.ModuleKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + recordAmbientExternalModule(); + } + } + return true; + } + + return false; + } + + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport(): boolean { + let token = scanner.getToken(); + if (token === SyntaxKind.ImportKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === SyntaxKind.Identifier || isKeyword(token)) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === SyntaxKind.EqualsToken) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + else if (token === SyntaxKind.CommaToken) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + return true; + } + } + + if (token === SyntaxKind.OpenBraceToken) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== SyntaxKind.CloseBraceToken && token !== SyntaxKind.EndOfFileToken) { + token = scanner.scan(); + } + + if (token === SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === SyntaxKind.AsteriskToken) { + token = scanner.scan(); + if (token === SyntaxKind.AsKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.Identifier || isKeyword(token)) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + + return true; + } + + return false; + } + + function tryConsumeExport(): boolean { + let token = scanner.getToken(); + if (token === SyntaxKind.ExportKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.OpenBraceToken) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== SyntaxKind.CloseBraceToken && token !== SyntaxKind.EndOfFileToken) { + token = scanner.scan(); + } + + if (token === SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === SyntaxKind.AsteriskToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === SyntaxKind.ImportKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.Identifier || isKeyword(token)) { + token = scanner.scan(); + if (token === SyntaxKind.EqualsToken) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + } + } + + return true; + } + + return false; + } + + function tryConsumeRequireCall(skipCurrentToken: boolean): boolean { + let token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === SyntaxKind.RequireKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.OpenParenToken) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + + function tryConsumeDefine(): boolean { + let token = scanner.getToken(); + if (token === SyntaxKind.Identifier && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== SyntaxKind.OpenParenToken) { + return true; + } + + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // looks like define ("modname", ... - skip string literal and comma + token = scanner.scan(); + if (token === SyntaxKind.CommaToken) { + token = scanner.scan(); + } + else { + // unexpected token + return true; + } + } + + // should be start of dependency list + if (token !== SyntaxKind.OpenBracketToken) { + return true; + } + + // skip open bracket + token = scanner.scan(); + let i = 0; + // scan until ']' or EOF + while (token !== SyntaxKind.CloseBracketToken && token !== SyntaxKind.EndOfFileToken) { + // record string literals as module names + if (token === SyntaxKind.StringLiteral) { + const moduleName = scanner.getTokenValue(); + // record first item in the list only if its name is not "require" + // record second item in the list only if its name is not "exports" + // record third item in the list only if its name is not "module" + // record all other items in the list unconditionally + const shouldRecordName = + i === 0 + ? moduleName !== "require" + : i === 1 + ? moduleName !== "exports" + : i !== 2 || moduleName !== "module"; + + if (shouldRecordName) { + recordModuleName(); + } + i++; + } + + token = scanner.scan(); + } + return true; + + } + return false; + } + + function processImports(): void { scanner.setText(sourceText); - let token = scanner.scan(); + scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -2160,157 +2391,30 @@ namespace ts { // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") + // (for JavaScript files) require("mod") - while (token !== SyntaxKind.EndOfFileToken) { - if (token === SyntaxKind.DeclareKeyword) { - // declare module "mod" - token = scanner.scan(); - if (token === SyntaxKind.ModuleKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - recordAmbientExternalModule(); - continue; - } - } + while (true) { + if (scanner.getToken() === SyntaxKind.EndOfFileToken) { + break; } - else if (token === SyntaxKind.ImportKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // import "mod"; - recordModuleName(); - continue; - } - else { - if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); - if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // import d from "mod"; - recordModuleName(); - continue - } - } - else if (token === SyntaxKind.EqualsToken) { - token = scanner.scan(); - if (token === SyntaxKind.RequireKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.OpenParenToken) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // import i = require("mod"); - recordModuleName(); - continue; - } - } - } - } - else if (token === SyntaxKind.CommaToken) { - // consume comma and keep going - token = scanner.scan(); - } - else { - // unknown syntax - continue; - } - } - if (token === SyntaxKind.OpenBraceToken) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== SyntaxKind.CloseBraceToken) { - token = scanner.scan(); - } - - if (token === SyntaxKind.CloseBraceToken) { - token = scanner.scan(); - if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === SyntaxKind.AsteriskToken) { - token = scanner.scan(); - if (token === SyntaxKind.AsKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); - if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + continue; } - else if (token === SyntaxKind.ExportKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.OpenBraceToken) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== SyntaxKind.CloseBraceToken) { - token = scanner.scan(); - } - - if (token === SyntaxKind.CloseBraceToken) { - token = scanner.scan(); - if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === SyntaxKind.AsteriskToken) { - token = scanner.scan(); - if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === SyntaxKind.ImportKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); - if (token === SyntaxKind.EqualsToken) { - token = scanner.scan(); - if (token === SyntaxKind.RequireKeyword) { - token = scanner.scan(); - if (token === SyntaxKind.OpenParenToken) { - token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - // export import i = require("mod"); - recordModuleName(); - } - } - } - } - } - } + else { + scanner.scan(); } - token = scanner.scan(); } + scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules }; @@ -2797,7 +2901,7 @@ namespace ts { // For JavaScript files, we don't want to report the normal typescript semantic errors. // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. - if (isJavaScript(fileName)) { + if (isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } @@ -3036,7 +3140,7 @@ namespace ts { let typeChecker = program.getTypeChecker(); let syntacticStart = new Date().getTime(); let sourceFile = getValidSourceFile(fileName); - let isJavaScriptFile = isJavaScript(fileName); + let isJavaScriptFile = isSourceFileJavaScript(sourceFile); let isJsDocTagName = false; @@ -3857,22 +3961,25 @@ namespace ts { let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData; - let entries: CompletionEntry[]; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - addRange(entries, getJavaScriptCompletionEntries()); + let sourceFile = getValidSourceFile(fileName); + + let entries: CompletionEntry[] = []; + + if (isRightOfDot && isSourceFileJavaScript(sourceFile)) { + const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } // Add keywords if this is not a member completion list @@ -3882,26 +3989,23 @@ namespace ts { return { isMemberCompletion, isNewIdentifierLocation, entries }; - function getJavaScriptCompletionEntries(): CompletionEntry[] { + function getJavaScriptCompletionEntries(sourceFile: SourceFile, uniqueNames: Map): CompletionEntry[] { let entries: CompletionEntry[] = []; - let allNames: Map = {}; let target = program.getCompilerOptions().target; - for (let sourceFile of program.getSourceFiles()) { - let nameTable = getNameTable(sourceFile); - for (let name in nameTable) { - if (!allNames[name]) { - allNames[name] = name; - let displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks:*/ true); - if (displayName) { - let entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + let nameTable = getNameTable(sourceFile); + for (let name in nameTable) { + if (!uniqueNames[name]) { + uniqueNames[name] = name; + let displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks:*/ true); + if (displayName) { + let entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -3945,26 +4049,24 @@ namespace ts { }; } - function getCompletionEntriesFromSymbols(symbols: Symbol[]): CompletionEntry[] { + function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[]): Map { let start = new Date().getTime(); - let entries: CompletionEntry[] = []; - + let uniqueNames: Map = {}; if (symbols) { - let nameToSymbol: Map = {}; for (let symbol of symbols) { let entry = createCompletionEntry(symbol, location); if (entry) { let id = escapeIdentifier(entry.name); - if (!lookUp(nameToSymbol, id)) { + if (!lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } diff --git a/src/services/shims.ts b/src/services/shims.ts index 351514a1499..686faf0e1bd 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -957,7 +957,8 @@ namespace ts { return this.forwardJSONCall( "getPreProcessedFileInfo('" + fileName + "')", () => { - var result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + // for now treat files as JavaScript + var result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); var convertResult = { referencedFiles: [], importedFiles: [], diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index df321647e5c..02e36e185a5 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -204,7 +204,7 @@ namespace ts.SignatureHelp { if (!candidates.length) { // We didn't have any sig help items produced by the TS compiler. If this is a JS // file, then see if we can figure out anything better. - if (isJavaScript(sourceFile.fileName)) { + if (isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts deleted file mode 100644 index e409029276b..00000000000 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -// @allowNonTsExtensions: true -// @Filename: a.js -//// /** -//// * @type {number} -//// * @type {string} -//// */ -//// var v; - -verify.getSyntacticDiagnostics(`[ - { - "message": "\'type\' tag already specified.", - "start": 26, - "length": 4, - "category": "error", - "code": 1223 - } -]`); \ No newline at end of file diff --git a/tests/cases/fourslash/javaScriptModules12.ts b/tests/cases/fourslash/javaScriptModules12.ts new file mode 100644 index 00000000000..c391f150963 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules12.ts @@ -0,0 +1,57 @@ +/// + +// Invocations of 'require' stop top-level variables from becoming global + +// @allowNonTsExtensions: true + +// @Filename: mod1.js +//// var x = require('fs'); +//// /*1*/ + +// @Filename: mod2.js +//// var y; +//// if(true) { +//// y = require('fs'); +//// } +//// /*2*/ + +// @Filename: glob1.js +//// var a = require; +//// /*3*/ + +// @Filename: glob2.js +//// var b = ''; +//// /*4*/ + +// @Filename: consumer.js +//// /*5*/ + +goTo.marker('1'); +verify.completionListContains('x'); +verify.not.completionListContains('y'); +verify.completionListContains('a'); +verify.completionListContains('b'); + +goTo.marker('2'); +verify.not.completionListContains('x'); +verify.completionListContains('y'); +verify.completionListContains('a'); +verify.completionListContains('b'); + +goTo.marker('3'); +verify.not.completionListContains('x'); +verify.not.completionListContains('y'); +verify.completionListContains('a'); +verify.completionListContains('b'); + +goTo.marker('4'); +verify.not.completionListContains('x'); +verify.not.completionListContains('y'); +verify.completionListContains('a'); +verify.completionListContains('b'); + +goTo.marker('5'); +verify.not.completionListContains('x'); +verify.not.completionListContains('y'); +verify.completionListContains('a'); +verify.completionListContains('b'); diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts new file mode 100644 index 00000000000..215f47e9ad6 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -0,0 +1,29 @@ +/// + +// Assignments to 'module.exports' create an external module + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// if (true) { +//// module.exports = { a: 10 }; +//// } else { +//// module.exports = { b: 10 }; +//// } +//// var invisible = true; + +// @Filename: isGlobal.js +//// var y = 10; + +// @Filename: consumer.js +//// var x = require('myMod'); +//// /**/; + +goTo.file('consumer.js'); +goTo.marker(); + +verify.completionListContains('y'); +verify.not.completionListContains('invisible'); + +edit.insert('x.'); +verify.completionListContains('a'); +verify.completionListContains('b'); diff --git a/tests/cases/fourslash/javaScriptModules14.ts b/tests/cases/fourslash/javaScriptModules14.ts new file mode 100644 index 00000000000..5434f94cf8d --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules14.ts @@ -0,0 +1,28 @@ +/// + +// Assignments to 'exports.p' stop global variables from being visible in other files + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// if (true) { +//// exports.b = true; +//// } else { +//// exports.n = 3; +//// } +//// function fn() { +//// exports.s = 'foo'; +//// } +//// var invisible = true; + +// @Filename: isGlobal.js +//// var y = 10; + +// @Filename: consumer.js +//// var x = require('myMod'); +//// /**/; + +goTo.file('consumer.js'); +goTo.marker(); + +verify.completionListContains('y'); +verify.not.completionListContains('invisible'); diff --git a/tests/cases/fourslash/javaScriptModules15.ts b/tests/cases/fourslash/javaScriptModules15.ts new file mode 100644 index 00000000000..ff888d99336 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules15.ts @@ -0,0 +1,27 @@ +/// + +// Assignments to 'exports.p' define a property 'p' even if they're not at top-level + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// if (true) { +//// exports.b = true; +//// } else { +//// exports.n = 3; +//// } +//// function fn() { +//// exports.s = 'foo'; +//// } + +// @Filename: consumer.js +//// var x = require('myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules16.ts b/tests/cases/fourslash/javaScriptModules16.ts new file mode 100644 index 00000000000..c556f288145 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules16.ts @@ -0,0 +1,22 @@ +/// + +// Assignments to 'exports.p' define a property 'p' + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// exports.n = 3; +//// exports.s = 'foo'; +//// exports.b = true; + +// @Filename: consumer.js +//// var x = require('myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules17.ts b/tests/cases/fourslash/javaScriptModules17.ts new file mode 100644 index 00000000000..8514ed0ee18 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules17.ts @@ -0,0 +1,18 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// module.exports = { n: 3, s: 'foo', b: true }; + +// @Filename: consumer.js +//// var x = require('./myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules18.ts b/tests/cases/fourslash/javaScriptModules18.ts new file mode 100644 index 00000000000..d3117f86b3f --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules18.ts @@ -0,0 +1,14 @@ +/// + +// CommonJS modules should not pollute the global namespace + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// var x = require('fs'); + +// @Filename: other.js +//// /**/; + +goTo.file('other.js'); + +verify.not.completionListContains('x'); diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index b5c2c70e491..7e363d80d6d 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -82,7 +82,7 @@ module ts { assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); // expect three failed lookup location - attempt to load module as file with all supported extensions - assert.equal(resolution.failedLookupLocations.length, 3); + assert.equal(resolution.failedLookupLocations.length, 5); } it("module name as directory - load from typings", () => { @@ -103,6 +103,8 @@ module ts { "/a/b/foo.ts", "/a/b/foo.tsx", "/a/b/foo.d.ts", + "/a/b/foo.js", + "/a/b/foo.jsx", "/a/b/foo/index.ts", "/a/b/foo/index.tsx", ]); @@ -119,17 +121,25 @@ module ts { "/a/b/c/d/node_modules/foo.ts", "/a/b/c/d/node_modules/foo.tsx", "/a/b/c/d/node_modules/foo.d.ts", + "/a/b/c/d/node_modules/foo.js", + "/a/b/c/d/node_modules/foo.jsx", "/a/b/c/d/node_modules/foo/package.json", "/a/b/c/d/node_modules/foo/index.ts", "/a/b/c/d/node_modules/foo/index.tsx", "/a/b/c/d/node_modules/foo/index.d.ts", + "/a/b/c/d/node_modules/foo/index.js", + "/a/b/c/d/node_modules/foo/index.jsx", "/a/b/c/node_modules/foo.ts", "/a/b/c/node_modules/foo.tsx", "/a/b/c/node_modules/foo.d.ts", + "/a/b/c/node_modules/foo.js", + "/a/b/c/node_modules/foo.jsx", "/a/b/c/node_modules/foo/package.json", "/a/b/c/node_modules/foo/index.ts", "/a/b/c/node_modules/foo/index.tsx", - "/a/b/c/node_modules/foo/index.d.ts" + "/a/b/c/node_modules/foo/index.d.ts", + "/a/b/c/node_modules/foo/index.js", + "/a/b/c/node_modules/foo/index.jsx" ]) }); @@ -151,27 +161,41 @@ module ts { "/a/node_modules/b/c/node_modules/d/node_modules/foo.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo.js", + "/a/node_modules/b/c/node_modules/d/node_modules/foo.jsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.js", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.jsx", "/a/node_modules/b/c/node_modules/foo.ts", "/a/node_modules/b/c/node_modules/foo.tsx", "/a/node_modules/b/c/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/foo.js", + "/a/node_modules/b/c/node_modules/foo.jsx", "/a/node_modules/b/c/node_modules/foo/package.json", "/a/node_modules/b/c/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/foo/index.js", + "/a/node_modules/b/c/node_modules/foo/index.jsx", "/a/node_modules/b/node_modules/foo.ts", "/a/node_modules/b/node_modules/foo.tsx", "/a/node_modules/b/node_modules/foo.d.ts", + "/a/node_modules/b/node_modules/foo.js", + "/a/node_modules/b/node_modules/foo.jsx", "/a/node_modules/b/node_modules/foo/package.json", "/a/node_modules/b/node_modules/foo/index.ts", "/a/node_modules/b/node_modules/foo/index.tsx", "/a/node_modules/b/node_modules/foo/index.d.ts", + "/a/node_modules/b/node_modules/foo/index.js", + "/a/node_modules/b/node_modules/foo/index.jsx", "/a/node_modules/foo.ts", "/a/node_modules/foo.tsx", "/a/node_modules/foo.d.ts", + "/a/node_modules/foo.js", + "/a/node_modules/foo.jsx", "/a/node_modules/foo/package.json", "/a/node_modules/foo/index.ts", "/a/node_modules/foo/index.tsx" diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index a3f8db5528f..aba5ce15c03 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -2,8 +2,8 @@ /// describe('PreProcessFile:', function () { - function test(sourceText: string, readImportFile: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void { - var resultPreProcess = ts.preProcessFile(sourceText, readImportFile); + function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void { + var resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports); var resultIsLibFile = resultPreProcess.isLibFile; var resultImportedFiles = resultPreProcess.importedFiles; @@ -45,7 +45,9 @@ describe('PreProcessFile:', function () { } describe("Test preProcessFiles,", function () { it("Correctly return referenced files from triple slash", function () { - test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", true, + test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 }, { fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }], @@ -56,7 +58,9 @@ describe('PreProcessFile:', function () { }), it("Do not return reference path because of invalid triple-slash syntax", function () { - test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", true, + test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [], @@ -66,7 +70,9 @@ describe('PreProcessFile:', function () { }), it("Correctly return imported files", function () { - test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", true, + test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, @@ -77,7 +83,9 @@ describe('PreProcessFile:', function () { }), it("Do not return imported files if readImportFiles argument is false", function () { - test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", false, + test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", + /* readImports */ false, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [], @@ -87,7 +95,9 @@ describe('PreProcessFile:', function () { }), it("Do not return import path because of invalid import syntax", function () { - test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5", true, + test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], @@ -97,7 +107,9 @@ describe('PreProcessFile:', function () { }), it("Correctly return referenced files and import files", function () { - test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");", true, + test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }], importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], @@ -107,7 +119,9 @@ describe('PreProcessFile:', function () { }), it("Correctly return referenced files and import files even with some invalid syntax", function () { - test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");", true, + test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");", + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }], importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], @@ -124,7 +138,8 @@ describe('PreProcessFile:', function () { "import {a as A} from \"m5\";" + "\n" + "import {a as A, b, c as C} from \"m6\";" + "\n" + "import def , {a, b, c as C} from \"m7\";" + "\n", - true, + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [ @@ -146,7 +161,8 @@ describe('PreProcessFile:', function () { "export {a} from \"m2\";" + "\n" + "export {a as A} from \"m3\";" + "\n" + "export {a as A, b, c as C} from \"m4\";" + "\n", - true, + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [ @@ -166,7 +182,11 @@ describe('PreProcessFile:', function () { declare module "B" {} function foo() { } - `, false, { + `, + /* readImports */ false, + /* detectJavaScriptImports */ false, + + { referencedFiles: [], importedFiles: [], ambientExternalModules: ["B"], @@ -176,7 +196,8 @@ describe('PreProcessFile:', function () { it("Correctly handles export import declarations", function () { test("export import a = require(\"m1\");", - true, + /* readImports */true, + /* detectJavaScriptImports */ false, { referencedFiles: [], importedFiles: [ @@ -186,7 +207,109 @@ describe('PreProcessFile:', function () { isLibFile: false }) }); + it("Correctly handles export require calls in JavaScript files", function () { + test(` + export import a = require("m1"); + var x = require('m2'); + foo(require('m3')); + var z = { f: require('m4') } + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "m1", pos: 39, end: 41 }, + { fileName: "m2", pos: 74, end: 76 }, + { fileName: "m3", pos: 105, end: 107 }, + { fileName: "m4", pos: 146, end: 148 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("Correctly handles dependency lists in define([deplist]) calls in JavaScript files", function () { + test(` + define(["mod1", "mod2"], (m1, m2) => { + }); + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "mod1", pos: 21, end: 25 }, + { fileName: "mod2", pos: 29, end: 33 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("Correctly handles dependency lists in define(modName, [deplist]) calls in JavaScript files", function () { + test(` + define("mod", ["mod1", "mod2"], (m1, m2) => { + }); + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "mod1", pos: 28, end: 32 }, + { fileName: "mod2", pos: 36, end: 40 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("Excludes require/exports/module names from dependency lists in define(modName, [deplist]) calls in JavaScript files", function () { + test(` + define(["require", "exports", "module", "mod1", "mod2"], (m1, m2) => { + }); + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "mod1", pos: 53, end: 57 }, + { fileName: "mod2", pos: 61, end: 65 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }); + test(` + define(["require", "exports", "mod1", "module"], (m1, m2) => { + }); + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "mod1", pos: 43, end: 47 }, + { fileName: "module", pos: 51, end: 57 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }); + test(` + define(["require", "require", "exports"], (m1, m2) => { + }); + `, + /* readImports */true, + /* detectJavaScriptImports */ true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "require", pos: 32, end: 39 }, + { fileName: "exports", pos: 43, end: 50 }, + ], + ambientExternalModules: undefined, + isLibFile: false + }); + }); }); }); diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 6d3144eeaec..75d90dbeefe 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -5,6 +5,7 @@ import fs = require("fs"); import path = require("path"); import url = require("url"); import child_process = require("child_process"); +import os = require("os"); /// Command line processing /// @@ -263,7 +264,19 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) { var browserPath: string; if ((browser && browser === 'chrome')) { - var defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"; + const platform = os.platform(); + let defaultChromePath: string; + switch(platform) { + case "win32": + defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"; + break; + case "linux": + defaultChromePath = "/opt/google/chrome/chrome"; + break; + default: + console.log(`Default Chrome location for platform ${platform} is unknown`); + break; + } if (fs.existsSync(defaultChromePath)) { browserPath = defaultChromePath; } else { From ec0d49a312171c408263c40ea777963b4d02963f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 15 Oct 2015 14:26:27 -0700 Subject: [PATCH 043/140] Always use a string literal type if contextually typed by any string literal types. --- src/compiler/checker.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2980d8a7cad..3b7436f01e2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5691,6 +5691,10 @@ namespace ts { return !!getPropertyOfType(type, "0"); } + function isStringLiteralType(type: Type) { + return type.flags & TypeFlags.StringLiteral; + } + /** * Check if a Type was written as a tuple type literal. * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. @@ -6953,6 +6957,10 @@ namespace ts { return applyToContextualType(type, t => getIndexTypeOfStructuredType(t, kind)); } + function contextualTypeIsStringLiteralType(type: Type): boolean { + return !!(type.flags & TypeFlags.Union ? forEach((type).types, isStringLiteralType) : isStringLiteralType(type)); + } + // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type: Type): boolean { return !!(type.flags & TypeFlags.Union ? forEach((type).types, isTupleLikeType) : isTupleLikeType(type)); @@ -10350,22 +10358,14 @@ namespace ts { return getUnionType([type1, type2]); } - function checkStringLiteralExpression(node: LiteralExpression) { + function checkStringLiteralExpression(node: StringLiteral): Type { // TODO (drosen): Do we want to apply the same approach to no-sub template literals? let contextualType = getContextualType(node); - if (contextualType) { - if (contextualType.flags & TypeFlags.Union) { - for (const type of (contextualType).types) { - if (type.flags & TypeFlags.StringLiteral && (type).text === node.text) { - return type; - } - } - } - else if (contextualType.flags & TypeFlags.StringLiteral && (contextualType).text === node.text) { - return contextualType; - } + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralType(node); } + return stringType; } @@ -10499,7 +10499,7 @@ namespace ts { case SyntaxKind.TemplateExpression: return checkTemplateExpression(node); case SyntaxKind.StringLiteral: - return checkStringLiteralExpression(node); + return checkStringLiteralExpression(node); case SyntaxKind.NoSubstitutionTemplateLiteral: return stringType; case SyntaxKind.RegularExpressionLiteral: From 1dbd8d1dd8309456f76ce46e7645cb0d4a646cd5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 15 Oct 2015 14:26:41 -0700 Subject: [PATCH 044/140] Accepted baselines. --- ...loadOnConstantsInvalidOverload1.errors.txt | 4 ++-- .../overloadingOnConstants2.errors.txt | 4 ++-- ...gumentsWithStringLiteralTypes01.errors.txt | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt index 1676a2fb426..4fea7cc1227 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,10): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type 'string' is not assignable to parameter of type '"SPAN"'. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type '"HI"' is not assignable to parameter of type '"SPAN"'. ==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (3 errors) ==== @@ -20,4 +20,4 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: foo("HI"); ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"SPAN"'. \ No newline at end of file +!!! error TS2345: Argument of type '"HI"' is not assignable to parameter of type '"SPAN"'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index c6d63523576..b448deaadc7 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadingOnConstants2.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'. +tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'. tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -25,7 +25,7 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialize var b: E = foo("bye", []); // E var c = foo("um", []); // error ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'. +!!! error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'. //function bar(x: "hi", items: string[]): D; diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt index 69f8d6581a1..49f17e7891d 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -14,18 +14,18 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. Type 'string' is not assignable to type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,5): error TS2322: Type 'string' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. Type '"World"' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'. Type '"World"' is not assignable to type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type '"Hello"' is not assignable to parameter of type '"World"'. +tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. @@ -120,14 +120,14 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 export let a = fun1<"Hello">("Hello", "Hello"); export let b = fun1<"Hello">("Hello", "World"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. export let c = fun2<"Hello", "Hello">("Hello", "Hello"); export let d = fun2<"Hello", "Hello">("Hello", "World"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. export let e = fun3<"Hello">("Hello", "World"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. // Assignment from the returned value should cause an error. a = takeReturnString(a); @@ -168,13 +168,13 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 export let a = fun2<"Hello", "World">("Hello", "World"); export let b = fun2<"Hello", "World">("World", "Hello"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. export let c = fun2<"World", "Hello">("Hello", "Hello"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'. +!!! error TS2345: Argument of type '"Hello"' is not assignable to parameter of type '"World"'. export let d = fun2<"World", "Hello">("World", "World"); ~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. +!!! error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. export let e = fun3<"Hello" | "World">("Hello", "World"); // Assignment from the returned value should cause an error. From 2f7719b61d3d97659a1bf430c4e48bf7897a3c0b Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 16 Oct 2015 16:40:04 -0700 Subject: [PATCH 045/140] Address CR feedback --- src/compiler/binder.ts | 22 +++++++++--------- src/compiler/checker.ts | 24 ++++++-------------- tests/cases/fourslash/javaScriptModules13.ts | 3 --- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 4e0d5225f58..d5ab7dd11ca 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -166,13 +166,12 @@ namespace ts { return "__export"; case SyntaxKind.ExportAssignment: return (node).isExportEquals ? "export=" : "default"; + case SyntaxKind.BinaryExpression: + // Binary expression case is for JS module 'module.exports = expr' + return "export="; case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: return node.flags & NodeFlags.Default ? "default" : undefined; - - case SyntaxKind.BinaryExpression: - Debug.assert(isModuleExportsAssignment(node)); - return "__jsExports"; } } @@ -936,9 +935,7 @@ namespace ts { return bindAnonymousDeclaration(node, SymbolFlags.Function, bindingName); case SyntaxKind.CallExpression: - // We're only inspecting call expressions to detect CommonJS modules, so we can skip - // this check if we've already seen the module indicator - if (isJavaScriptFile && !file.commonJsModuleIndicator) { + if (isJavaScriptFile) { bindCallExpression(node); } break; @@ -984,12 +981,13 @@ namespace ts { bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName) }"`); } - function bindExportAssignment(node: ExportAssignment) { + function bindExportAssignment(node: ExportAssignment|BinaryExpression) { + let boundExpression = node.kind === SyntaxKind.ExportAssignment ? (node).expression : (node).right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node)); } - else if (node.expression.kind === SyntaxKind.Identifier) { + else if (boundExpression.kind === SyntaxKind.Identifier) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes); } @@ -1033,11 +1031,13 @@ namespace ts { function bindModuleExportsAssignment(node: BinaryExpression) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.None, SymbolFlags.None); + bindExportAssignment(node); } function bindCallExpression(node: CallExpression) { - if (isRequireCall(node)) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (!file.commonJsModuleIndicator && isRequireCall(node)) { setCommonJsModuleIndicator(node); } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7e15f0a3ad0..f0c81940192 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1087,20 +1087,6 @@ namespace ts { visit(resolveExternalModuleName(node, (node).moduleSpecifier)); } } - - // CommonJS 'module.exports = expr' assignments - let commonJsModuleExports = symbol.exports["__jsExports"]; - if (commonJsModuleExports) { - for (var i = 0; i < commonJsModuleExports.declarations.length; i++) { - let properties = getPropertiesOfType(checkExpression((commonJsModuleExports.declarations[i]).right)); - if (i === 0) { - result = createSymbolTable(properties); - } - else { - mergeSymbolTable(result, createSymbolTable(properties)); - } - } - } } } } @@ -2586,6 +2572,10 @@ namespace ts { if (declaration.kind === SyntaxKind.ExportAssignment) { return links.type = checkExpression((declaration).expression); } + // Handle module.exports = expr + if (declaration.kind === SyntaxKind.BinaryExpression) { + return links.type = checkExpression((declaration).right); + } // Handle exports.p = expr if (declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) { return checkExpressionCached((declaration.parent).right); @@ -3839,9 +3829,9 @@ namespace ts { function resolveExternalModuleTypeByLiteral(name: StringLiteral) { let moduleSym = resolveExternalModuleName(name, name); if (moduleSym) { - let moduleSymSym = resolveExternalModuleSymbol(moduleSym); - if (moduleSymSym) { - return getTypeOfSymbol(moduleSymSym); + let resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); } } diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts index 215f47e9ad6..8b22971009c 100644 --- a/tests/cases/fourslash/javaScriptModules13.ts +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -6,8 +6,6 @@ // @Filename: myMod.js //// if (true) { //// module.exports = { a: 10 }; -//// } else { -//// module.exports = { b: 10 }; //// } //// var invisible = true; @@ -26,4 +24,3 @@ verify.not.completionListContains('invisible'); edit.insert('x.'); verify.completionListContains('a'); -verify.completionListContains('b'); From 61b71008d71be7c65c3c75657c85875b810b1482 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 16 Oct 2015 17:35:43 -0700 Subject: [PATCH 046/140] Remove obsolute AMD logic from reference preprocessing in services --- src/services/services.ts | 16 +------ .../unittests/services/preProcessFile.ts | 48 ------------------- 2 files changed, 1 insertion(+), 63 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index a6611a3d39a..30d993cb6b6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2351,21 +2351,7 @@ namespace ts { while (token !== SyntaxKind.CloseBracketToken && token !== SyntaxKind.EndOfFileToken) { // record string literals as module names if (token === SyntaxKind.StringLiteral) { - const moduleName = scanner.getTokenValue(); - // record first item in the list only if its name is not "require" - // record second item in the list only if its name is not "exports" - // record third item in the list only if its name is not "module" - // record all other items in the list unconditionally - const shouldRecordName = - i === 0 - ? moduleName !== "require" - : i === 1 - ? moduleName !== "exports" - : i !== 2 || moduleName !== "module"; - - if (shouldRecordName) { - recordModuleName(); - } + recordModuleName(); i++; } diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index aba5ce15c03..d9ddaf0f256 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -262,54 +262,6 @@ describe('PreProcessFile:', function () { isLibFile: false }) }); - it("Excludes require/exports/module names from dependency lists in define(modName, [deplist]) calls in JavaScript files", function () { - test(` - define(["require", "exports", "module", "mod1", "mod2"], (m1, m2) => { - }); - `, - /* readImports */true, - /* detectJavaScriptImports */ true, - { - referencedFiles: [], - importedFiles: [ - { fileName: "mod1", pos: 53, end: 57 }, - { fileName: "mod2", pos: 61, end: 65 }, - ], - ambientExternalModules: undefined, - isLibFile: false - }); - - test(` - define(["require", "exports", "mod1", "module"], (m1, m2) => { - }); - `, - /* readImports */true, - /* detectJavaScriptImports */ true, - { - referencedFiles: [], - importedFiles: [ - { fileName: "mod1", pos: 43, end: 47 }, - { fileName: "module", pos: 51, end: 57 }, - ], - ambientExternalModules: undefined, - isLibFile: false - }); - test(` - define(["require", "require", "exports"], (m1, m2) => { - }); - `, - /* readImports */true, - /* detectJavaScriptImports */ true, - { - referencedFiles: [], - importedFiles: [ - { fileName: "require", pos: 32, end: 39 }, - { fileName: "exports", pos: 43, end: 50 }, - ], - ambientExternalModules: undefined, - isLibFile: false - }); - }); }); }); From 5725fc4497d2aa2d0711cd2918ddde62f43cedff Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 19 Oct 2015 11:02:20 -0700 Subject: [PATCH 047/140] CR feedback --- lib/lib.core.d.ts | 16 ---- lib/lib.core.es6.d.ts | 45 ++++++---- lib/lib.d.ts | 168 ++++++-------------------------------- lib/lib.dom.d.ts | 152 ++++++---------------------------- lib/lib.es6.d.ts | 168 ++++++-------------------------------- lib/lib.webworker.d.ts | 7 +- src/compiler/checker.ts | 18 +--- src/compiler/utilities.ts | 5 +- src/lib/core.d.ts | 16 ---- 9 files changed, 119 insertions(+), 476 deletions(-) diff --git a/lib/lib.core.d.ts b/lib/lib.core.d.ts index c1a71dd8d1d..b588c9fdb77 100644 --- a/lib/lib.core.d.ts +++ b/lib/lib.core.d.ts @@ -1198,22 +1198,6 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } - -declare namespace CommonJS { - export var require: Require; - - export var exports: any; - - interface Exports { } - interface Module { - exports: Exports; - } - - interface Require { - (moduleName: string): any; - } -} - interface ArrayLike { length: number; [n: number]: T; diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts index b0d4120b4b9..6d6a68559f8 100644 --- a/lib/lib.core.es6.d.ts +++ b/lib/lib.core.es6.d.ts @@ -1198,22 +1198,6 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } - -declare namespace CommonJS { - export var require: Require; - - export var exports: any; - - interface Exports { } - interface Module { - exports: Exports; - } - - interface Require { - (moduleName: string): any; - } -} - interface ArrayLike { length: number; [n: number]: T; @@ -3981,7 +3965,34 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 450f79b36e9..40a29796586 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -1198,22 +1198,6 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } - -declare namespace CommonJS { - export var require: Require; - - export var exports: any; - - interface Exports { } - interface Module { - exports: Exports; - } - - interface Require { - (moduleName: string): any; - } -} - interface ArrayLike { length: number; [n: number]: T; @@ -4259,8 +4243,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -4347,7 +4331,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -4391,7 +4375,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -4449,7 +4433,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -4525,7 +4509,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -5124,7 +5108,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -5139,7 +5123,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -6507,8 +6491,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -11330,27 +11312,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -11509,24 +11470,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -11574,63 +11517,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -12048,6 +11934,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -12065,7 +11955,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -12775,7 +12664,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -12789,6 +12677,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -14950,7 +14839,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -15137,34 +15026,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -15928,7 +15817,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -16665,7 +16553,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -16686,8 +16573,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -16703,6 +16588,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -16763,7 +16650,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 849560ac0d2..41d569ba9f7 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -419,8 +419,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -507,7 +507,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -551,7 +551,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -609,7 +609,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -685,7 +685,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -1284,7 +1284,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -1299,7 +1299,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -2667,8 +2667,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -7490,27 +7488,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -7669,24 +7646,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -7734,63 +7693,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -8208,6 +8110,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -8225,7 +8131,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -8935,7 +8840,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -8949,6 +8853,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -11110,7 +11015,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -11297,34 +11202,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -12088,7 +11993,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -12825,7 +12729,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -12846,8 +12749,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -12863,6 +12764,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -12923,7 +12826,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 63e6a101fbc..a7bf8f05076 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -1198,22 +1198,6 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } - -declare namespace CommonJS { - export var require: Require; - - export var exports: any; - - interface Exports { } - interface Module { - exports: Exports; - } - - interface Require { - (moduleName: string): any; - } -} - interface ArrayLike { length: number; [n: number]: T; @@ -5574,8 +5558,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -5662,7 +5646,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -5706,7 +5690,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -5764,7 +5748,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -5840,7 +5824,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -6439,7 +6423,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -6454,7 +6438,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -7822,8 +7806,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -12645,27 +12627,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -12824,24 +12785,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -12889,63 +12832,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -13363,6 +13249,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -13380,7 +13270,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -14090,7 +13979,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -14104,6 +13992,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -16265,7 +16154,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -16452,34 +16341,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -17243,7 +17132,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -17980,7 +17868,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -18001,8 +17888,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -18018,6 +17903,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -18078,7 +17965,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 85bcfb1498e..7995a03a40f 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -234,7 +234,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -1111,7 +1111,6 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } - interface BlobPropertyBag { type?: string; endings?: string; @@ -1126,8 +1125,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -1143,6 +1140,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f0c81940192..aa3e9b44815 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2577,7 +2577,7 @@ namespace ts { return links.type = checkExpression((declaration).right); } // Handle exports.p = expr - if (declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) { + if (declaration.kind === SyntaxKind.PropertyAccessExpression) { return checkExpressionCached((declaration.parent).right); } // Handle variable, parameter or property @@ -9377,11 +9377,9 @@ namespace ts { } } - let exprType = checkExpression(node.expression); - if (exprType === cjsRequireType) { - if (node.arguments.length === 1 && node.arguments[0].kind === SyntaxKind.StringLiteral) { - return resolveExternalModuleTypeByLiteral(node.arguments[0]); - } + // In JavaScript files, calls to any identifier 'require' are treated as external module imports + if (isInJavaScriptFile(node) && isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); @@ -14925,14 +14923,6 @@ namespace ts { } }); - // Initialize special symbols - if (compilerOptions.allowNonTsExtensions) { - let req = getExportedSymbolFromNamespace("CommonJS", "require"); - if (req) { - globals["require"] = req; - } - } - getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c5dfcf8947e..1c875ec1b51 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1039,7 +1039,7 @@ namespace ts { return isInJavaScriptFile(file); } - function isInJavaScriptFile(node: Node): boolean { + export function isInJavaScriptFile(node: Node): boolean { return node && !!(node.parserContextFlags & ParserContextFlags.JavaScriptFile); } @@ -1053,7 +1053,8 @@ namespace ts { return expression.kind === SyntaxKind.CallExpression && (expression).expression.kind === SyntaxKind.Identifier && ((expression).expression).text === "require" && - (expression).arguments.length === 1; + (expression).arguments.length === 1 && + (expression).arguments[0].kind === SyntaxKind.StringLiteral; } /** diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 86dee00638d..7259ff5081c 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -1183,22 +1183,6 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } - -declare namespace CommonJS { - export var require: Require; - - export var exports: any; - - interface Exports { } - interface Module { - exports: Exports; - } - - interface Require { - (moduleName: string): any; - } -} - interface ArrayLike { length: number; [n: number]: T; From efa63b98bb529ee9cb35a04d9adbe76a453de81f Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 19 Oct 2015 11:02:27 -0700 Subject: [PATCH 048/140] LKG update --- lib/tsc.js | 17143 +++++++++++++------------ lib/tsserver.js | 19769 +++++++++++++++-------------- lib/typescript.d.ts | 527 +- lib/typescript.js | 22898 ++++++++++++++++++---------------- lib/typescriptServices.d.ts | 527 +- lib/typescriptServices.js | 22898 ++++++++++++++++++---------------- 6 files changed, 43463 insertions(+), 40299 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index a4c2586f041..ed982c2d941 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -410,8 +410,11 @@ var ts; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { - Debug.assert(!headChain.next); - headChain.next = tailChain; + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; @@ -950,10 +953,14 @@ var ts; close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { + if (curr.mtime.getTime() === 0) { + callback(fileName, true); + return; + } if (+curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, false); } }, resolvePath: function (path) { @@ -1051,7 +1058,7 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, @@ -1139,7 +1146,7 @@ var ts; Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -1157,10 +1164,9 @@ var ts; An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, @@ -1189,10 +1195,6 @@ var ts; An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -1203,6 +1205,10 @@ var ts; _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "'=' can only be used in an object literal property inside a destructuring assignment." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1327,7 +1333,7 @@ var ts; In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, @@ -1415,6 +1421,9 @@ var ts; yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A module cannot have multiple default exports." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -1515,7 +1524,7 @@ var ts; Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1527,7 +1536,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -1548,7 +1557,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -1569,7 +1578,6 @@ var ts; Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, @@ -1616,81 +1624,83 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } }; })(ts || (ts = {})); var ts; (function (ts) { function tokenIsIdentifierOrKeyword(token) { - return token >= 67; + return token >= 69; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { - "abstract": 113, - "any": 115, - "as": 114, - "boolean": 118, - "break": 68, - "case": 69, - "catch": 70, - "class": 71, - "continue": 73, - "const": 72, - "constructor": 119, - "debugger": 74, - "declare": 120, - "default": 75, - "delete": 76, - "do": 77, - "else": 78, - "enum": 79, - "export": 80, - "extends": 81, - "false": 82, - "finally": 83, - "for": 84, - "from": 131, - "function": 85, - "get": 121, - "if": 86, - "implements": 104, - "import": 87, - "in": 88, - "instanceof": 89, - "interface": 105, - "is": 122, - "let": 106, - "module": 123, - "namespace": 124, - "new": 90, - "null": 91, - "number": 126, - "package": 107, - "private": 108, - "protected": 109, - "public": 110, - "require": 125, - "return": 92, - "set": 127, - "static": 111, - "string": 128, - "super": 93, - "switch": 94, - "symbol": 129, - "this": 95, - "throw": 96, - "true": 97, - "try": 98, - "type": 130, - "typeof": 99, - "var": 100, - "void": 101, - "while": 102, - "with": 103, - "yield": 112, - "async": 116, - "await": 117, - "of": 132, + "abstract": 115, + "any": 117, + "as": 116, + "boolean": 120, + "break": 70, + "case": 71, + "catch": 72, + "class": 73, + "continue": 75, + "const": 74, + "constructor": 121, + "debugger": 76, + "declare": 122, + "default": 77, + "delete": 78, + "do": 79, + "else": 80, + "enum": 81, + "export": 82, + "extends": 83, + "false": 84, + "finally": 85, + "for": 86, + "from": 133, + "function": 87, + "get": 123, + "if": 88, + "implements": 106, + "import": 89, + "in": 90, + "instanceof": 91, + "interface": 107, + "is": 124, + "let": 108, + "module": 125, + "namespace": 126, + "new": 92, + "null": 93, + "number": 128, + "package": 109, + "private": 110, + "protected": 111, + "public": 112, + "require": 127, + "return": 94, + "set": 129, + "static": 113, + "string": 130, + "super": 95, + "switch": 96, + "symbol": 131, + "this": 97, + "throw": 98, + "true": 99, + "try": 100, + "type": 132, + "typeof": 101, + "var": 102, + "void": 103, + "while": 104, + "with": 105, + "yield": 114, + "async": 118, + "await": 119, + "of": 134, "{": 15, "}": 16, "(": 17, @@ -1712,37 +1722,39 @@ var ts; "=>": 34, "+": 35, "-": 36, + "**": 38, "*": 37, - "/": 38, - "%": 39, - "++": 40, - "--": 41, - "<<": 42, + "/": 39, + "%": 40, + "++": 41, + "--": 42, + "<<": 43, ">": 43, - ">>>": 44, - "&": 45, - "|": 46, - "^": 47, - "!": 48, - "~": 49, - "&&": 50, - "||": 51, - "?": 52, - ":": 53, - "=": 55, - "+=": 56, - "-=": 57, - "*=": 58, - "/=": 59, - "%=": 60, - "<<=": 61, - ">>=": 62, - ">>>=": 63, - "&=": 64, - "|=": 65, - "^=": 66, - "@": 54 + ">>": 44, + ">>>": 45, + "&": 46, + "|": 47, + "^": 48, + "!": 49, + "~": 50, + "&&": 51, + "||": 52, + "?": 53, + ":": 54, + "=": 56, + "+=": 57, + "-=": 58, + "*=": 59, + "**=": 60, + "/=": 61, + "%=": 62, + "<<=": 63, + ">>=": 64, + ">>>=": 65, + "&=": 66, + "|=": 67, + "^=": 68, + "@": 55 }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; @@ -2144,8 +2156,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 67 || token > 103; }, - isReservedWord: function () { return token >= 68 && token <= 103; }, + isIdentifier: function () { return token === 69 || token > 105; }, + isReservedWord: function () { return token >= 70 && token <= 105; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2167,16 +2179,6 @@ var ts; onError(message, length || 0); } } - function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); - } function scanNumber() { var start = pos; while (isDigit(text.charCodeAt(pos))) @@ -2431,12 +2433,12 @@ var ts; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { + if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92) { ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); @@ -2459,7 +2461,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 67; + return token = 69; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -2538,7 +2540,7 @@ var ts; } return pos += 2, token = 31; } - return pos++, token = 48; + return pos++, token = 49; case 34: case 39: tokenValue = scanString(); @@ -2547,42 +2549,48 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 60; + return pos += 2, token = 62; } - return pos++, token = 39; + return pos++, token = 40; case 38: if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 50; + return pos += 2, token = 51; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; + return pos += 2, token = 66; } - return pos++, token = 45; + return pos++, token = 46; case 40: return pos++, token = 17; case 41: return pos++, token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; + return pos += 2, token = 59; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 38; } return pos++, token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 40; + return pos += 2, token = 41; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 56; + return pos += 2, token = 57; } return pos++, token = 35; case 44: return pos++, token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 41; + return pos += 2, token = 42; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 57; + return pos += 2, token = 58; } return pos++, token = 36; case 46: @@ -2637,9 +2645,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; + return pos += 2, token = 61; } - return pos++, token = 38; + return pos++, token = 39; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2687,7 +2695,7 @@ var ts; tokenValue = "" + scanNumber(); return token = 8; case 58: - return pos++, token = 53; + return pos++, token = 54; case 59: return pos++, token = 23; case 60: @@ -2702,14 +2710,16 @@ var ts; } if (text.charCodeAt(pos + 1) === 60) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 61; + return pos += 3, token = 63; } - return pos += 2, token = 42; + return pos += 2, token = 43; } if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 28; } - if (text.charCodeAt(pos + 1) === 47 && languageVariant === 1) { + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { return pos += 2, token = 26; } return pos++, token = 25; @@ -2732,7 +2742,7 @@ var ts; if (text.charCodeAt(pos + 1) === 62) { return pos += 2, token = 34; } - return pos++, token = 55; + return pos++, token = 56; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2745,35 +2755,35 @@ var ts; } return pos++, token = 27; case 63: - return pos++, token = 52; + return pos++, token = 53; case 91: return pos++, token = 19; case 93: return pos++, token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 66; + return pos += 2, token = 68; } - return pos++, token = 47; + return pos++, token = 48; case 123: return pos++, token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 51; + return pos += 2, token = 52; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; + return pos += 2, token = 67; } - return pos++, token = 46; + return pos++, token = 47; case 125: return pos++, token = 16; case 126: - return pos++, token = 49; + return pos++, token = 50; case 64: - return pos++, token = 54; + return pos++, token = 55; case 92: var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); @@ -2781,9 +2791,9 @@ var ts; error(ts.Diagnostics.Invalid_character); return pos++, token = 0; default: - if (isIdentifierStart(ch)) { + if (isIdentifierStart(ch, languageVersion)) { pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92) { @@ -2810,14 +2820,14 @@ var ts; if (text.charCodeAt(pos) === 62) { if (text.charCodeAt(pos + 1) === 62) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 63; + return pos += 3, token = 65; } - return pos += 2, token = 44; + return pos += 2, token = 45; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 62; + return pos += 2, token = 64; } - return pos++, token = 43; + return pos++, token = 44; } if (text.charCodeAt(pos) === 61) { return pos++, token = 29; @@ -2826,7 +2836,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 38 || token === 59) { + if (token === 39 || token === 61) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2860,7 +2870,7 @@ var ts; } p++; } - while (p < end && isIdentifierPart(text.charCodeAt(p))) { + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; @@ -2903,14 +2913,14 @@ var ts; break; } } - return token = 234; + return token = 236; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) { + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { pos++; } else { @@ -2977,16 +2987,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 213 || node.kind === 214) { + if (node.kind === 215 || node.kind === 216) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 220 || node.kind === 219) && !(node.flags & 1)) { + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 1)) { return 0; } - else if (node.kind === 217) { + else if (node.kind === 219) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3002,7 +3012,7 @@ var ts; }); return state; } - else if (node.kind === 216) { + else if (node.kind === 218) { return getModuleInstanceState(node.body); } else { @@ -3021,6 +3031,8 @@ var ts; var container; var blockScopeContainer; var lastContainer; + var seenThisKeyword; + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var inStrictMode = !!file.externalModuleIndicator; var symbolCount = 0; var Symbol = ts.objectAllocator.getSymbolConstructor(); @@ -3054,10 +3066,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 216 && node.name.kind === 9) { + if (node.kind === 218 && node.name.kind === 9) { return "\"" + node.name.text + "\""; } - if (node.name.kind === 134) { + if (node.name.kind === 136) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -3065,22 +3077,24 @@ var ts; return node.name.text; } switch (node.kind) { - case 142: + case 144: return "__constructor"; - case 150: - case 145: - return "__call"; - case 151: - case 146: - return "__new"; + case 152: case 147: + return "__call"; + case 153: + case 148: + return "__new"; + case 149: return "__index"; - case 226: + case 228: return "__export"; - case 225: + case 227: return node.isExportEquals ? "export=" : "default"; - case 211: - case 212: + case 181: + return "export="; + case 213: + case 214: return node.flags & 1024 ? "default" : undefined; } } @@ -3089,7 +3103,8 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 1024 && parent ? "default" : getDeclarationName(node); + var isDefaultExport = node.flags & 1024; + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { symbol = ts.hasProperty(symbolTable, name) @@ -3105,6 +3120,11 @@ var ts; var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 1024) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -3122,7 +3142,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 228 || (node.kind === 219 && hasExportModifier)) { + if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -3161,44 +3181,51 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - ts.forEachChild(node, bind); + if (node.kind === 215) { + seenThisKeyword = false; + ts.forEachChild(node, bind); + node.flags = seenThisKeyword ? node.flags | 524288 : node.flags & ~524288; + } + else { + ts.forEachChild(node, bind); + } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function getContainerFlags(node) { switch (node.kind) { - case 184: - case 212: - case 213: + case 186: + case 214: case 215: - case 153: - case 163: + case 217: + case 155: + case 165: return 1; + case 147: + case 148: + case 149: + case 143: + case 142: + case 213: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 211: - case 142: - case 143: - case 144: - case 150: - case 151: - case 171: - case 172: - case 216: - case 246: - case 214: - return 5; - case 242: - case 197: - case 198: - case 199: + case 152: + case 153: + case 173: + case 174: case 218: + case 248: + case 216: + return 5; + case 244: + case 199: + case 200: + case 201: + case 220: return 2; - case 190: + case 192: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -3214,33 +3241,33 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 216: + case 218: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 246: + case 248: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 184: - case 212: + case 186: + case 214: return declareClassMember(node, symbolFlags, symbolExcludes); - case 215: + case 217: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 153: - case 163: - case 213: + case 155: + case 165: + case 215: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 150: - case 151: + case 152: + case 153: + case 147: + case 148: + case 149: + case 143: + case 142: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 142: - case 143: - case 144: - case 211: - case 171: - case 172: - case 214: + case 213: + case 173: + case 174: + case 216: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -3264,11 +3291,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 246 ? node : node.body; - if (body.kind === 246 || body.kind === 217) { + var body = node.kind === 248 ? node : node.body; + if (body.kind === 248 || body.kind === 219) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 226 || stat.kind === 225) { + if (stat.kind === 228 || stat.kind === 227) { return true; } } @@ -3323,11 +3350,11 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 67) { + if (prop.name.kind !== 69) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 243 || prop.kind === 244 || prop.kind === 141 + var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -3349,10 +3376,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 216: + case 218: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 246: + case 248: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -3370,8 +3397,8 @@ var ts; } function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 104 && - node.originalKeywordKind <= 112 && + node.originalKeywordKind >= 106 && + node.originalKeywordKind <= 114 && !ts.isIdentifierName(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -3398,17 +3425,17 @@ var ts; } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 67) { + if (inStrictMode && node.expression.kind === 69) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 67) { + if (name && name.kind === 69) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); @@ -3442,7 +3469,7 @@ var ts; } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 40 || node.operator === 41) { + if (node.operator === 41 || node.operator === 42) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -3471,17 +3498,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 246: - case 217: + case 248: + case 219: updateStrictModeStatementList(node.statements); return; - case 190: + case 192: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 212: - case 184: + case 214: + case 186: inStrictMode = true; return; } @@ -3504,102 +3531,122 @@ var ts; } function bindWorker(node) { switch (node.kind) { - case 67: + case 69: return checkStrictModeIdentifier(node); - case 179: + case 181: + if (isJavaScriptFile) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); - case 242: + case 244: return checkStrictModeCatchClause(node); - case 173: + case 175: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 178: + case 180: return checkStrictModePostfixUnaryExpression(node); - case 177: + case 179: return checkStrictModePrefixUnaryExpression(node); - case 203: + case 205: return checkStrictModeWithStatement(node); - case 135: + case 97: + seenThisKeyword = true; + return; + case 137: return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 136: - return bindParameter(node); - case 209: - case 161: - return bindVariableDeclarationOrBindingElement(node); - case 139: case 138: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 243: - case 244: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 245: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 145: - case 146: - case 147: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); + return bindParameter(node); + case 211: + case 163: + return bindVariableDeclarationOrBindingElement(node); case 141: case 140: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 245: + case 246: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 247: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 147: + case 148: + case 149: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 143: + case 142: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 211: + case 213: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 142: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 143: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); case 144: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 146: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 150: - case 151: - return bindFunctionOrConstructorType(node); + case 152: case 153: + return bindFunctionOrConstructorType(node); + case 155: return bindAnonymousDeclaration(node, 2048, "__type"); - case 163: + case 165: return bindObjectLiteralExpression(node); - case 171: - case 172: + case 173: + case 174: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); - case 184: - case 212: - return bindClassLikeDeclaration(node); - case 213: - return bindBlockScopedDeclaration(node, 64, 792960); + case 168: + if (isJavaScriptFile) { + bindCallExpression(node); + } + break; + case 186: case 214: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindClassLikeDeclaration(node); case 215: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 64, 792960); case 216: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 217: + return bindEnumDeclaration(node); + case 218: return bindModuleDeclaration(node); - case 219: - case 222: - case 224: - case 228: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 221: - return bindImportClause(node); + case 224: case 226: + case 230: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 223: + return bindImportClause(node); + case 228: return bindExportDeclaration(node); - case 225: + case 227: return bindExportAssignment(node); - case 246: + case 248: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } function bindExportAssignment(node) { + var boundExpression = node.kind === 227 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 67) { + else if (boundExpression.kind === 69) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -3619,8 +3666,27 @@ var ts; declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); } } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + } + function bindModuleExportsAssignment(node) { + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } function bindClassLikeDeclaration(node) { - if (node.kind === 212) { + if (node.kind === 214) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -3673,7 +3739,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (node.flags & 112 && - node.parent.kind === 142 && + node.parent.kind === 144 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); @@ -3719,7 +3785,8 @@ var ts; increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); @@ -3781,7 +3848,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 246) { + while (node && node.kind !== 248) { node = node.parent; } return node; @@ -3872,15 +3939,15 @@ var ts; return current; } switch (current.kind) { - case 246: + case 248: + case 220: + case 244: case 218: - case 242: - case 216: - case 197: - case 198: case 199: + case 200: + case 201: return current; - case 190: + case 192: if (!isFunctionLike(current.parent)) { return current; } @@ -3891,9 +3958,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 209 && + declaration.kind === 211 && declaration.parent && - declaration.parent.kind === 242; + declaration.parent.kind === 244; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3929,22 +3996,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 246: + case 248: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 209: - case 161: - case 212: - case 184: - case 213: - case 216: - case 215: - case 245: case 211: - case 171: + case 163: + case 214: + case 186: + case 215: + case 218: + case 217: + case 247: + case 213: + case 173: errorNode = node.name; break; } @@ -3961,16 +4028,20 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 8192) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 215 && isConst(node); + return node.kind === 217 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 161 || isBindingPattern(node))) { + while (node && (node.kind === 163 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3978,14 +4049,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 209) { + if (node.kind === 211) { node = node.parent; } - if (node && node.kind === 210) { + if (node && node.kind === 212) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 191) { + if (node && node.kind === 193) { flags |= node.flags; } return flags; @@ -4000,7 +4071,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 193 && node.expression.kind === 9; + return node.kind === 195 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4008,7 +4079,7 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 136 || node.kind === 135) ? + var commentRanges = (node.kind === 138 || node.kind === 137) ? ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode); return ts.filter(commentRanges, isJsDocComment); @@ -4022,68 +4093,69 @@ var ts; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (149 <= node.kind && node.kind <= 158) { + if (151 <= node.kind && node.kind <= 160) { return true; } switch (node.kind) { - case 115: - case 126: + case 117: case 128: - case 118: - case 129: + case 130: + case 120: + case 131: return true; - case 101: - return node.parent.kind !== 175; + case 103: + return node.parent.kind !== 177; case 9: - return node.parent.kind === 136; - case 186: + return node.parent.kind === 138; + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 67: - if (node.parent.kind === 133 && node.parent.right === node) { + case 69: + if (node.parent.kind === 135 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 164 && node.parent.name === node) { + else if (node.parent.kind === 166 && node.parent.name === node) { node = node.parent; } - case 133: - case 164: - ts.Debug.assert(node.kind === 67 || node.kind === 133 || node.kind === 164, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 69 || node.kind === 135 || node.kind === 166, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 135: + case 166: + case 97: var parent_1 = node.parent; - if (parent_1.kind === 152) { + if (parent_1.kind === 154) { return false; } - if (149 <= parent_1.kind && parent_1.kind <= 158) { + if (151 <= parent_1.kind && parent_1.kind <= 160) { return true; } switch (parent_1.kind) { - case 186: + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 135: + case 137: return node === parent_1.constraint; - case 139: - case 138: - case 136: - case 209: - return node === parent_1.type; - case 211: - case 171: - case 172: - case 142: case 141: case 140: - case 143: - case 144: + case 138: + case 211: return node === parent_1.type; + case 213: + case 173: + case 174: + case 144: + case 143: + case 142: case 145: case 146: + return node === parent_1.type; case 147: + case 148: + case 149: return node === parent_1.type; - case 169: + case 171: return node === parent_1.type; - case 166: - case 167: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 168: + case 169: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 170: return false; } } @@ -4094,23 +4166,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 202: + case 204: return visitor(node); - case 218: - case 190: - case 194: - case 195: + case 220: + case 192: case 196: case 197: case 198: case 199: - case 203: - case 204: - case 239: - case 240: + case 200: + case 201: case 205: - case 207: + case 206: + case 241: case 242: + case 207: + case 209: + case 244: return ts.forEachChild(node, traverse); } } @@ -4120,23 +4192,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 182: + case 184: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + case 217: case 215: - case 213: + case 218: case 216: case 214: - case 212: - case 184: + case 186: return; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 134) { + if (name_5 && name_5.kind === 136) { traverse(name_5.expression); return; } @@ -4151,14 +4223,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 161: - case 245: - case 136: - case 243: - case 139: + case 163: + case 247: case 138: - case 244: - case 209: + case 245: + case 141: + case 140: + case 246: + case 211: return true; } } @@ -4166,29 +4238,29 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 143 || node.kind === 144); + return node && (node.kind === 145 || node.kind === 146); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 212 || node.kind === 184); + return node && (node.kind === 214 || node.kind === 186); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 142: - case 171: - case 211: - case 172: - case 141: - case 140: - case 143: case 144: + case 173: + case 213: + case 174: + case 143: + case 142: case 145: case 146: case 147: - case 150: - case 151: + case 148: + case 149: + case 152: + case 153: return true; } } @@ -4197,24 +4269,24 @@ var ts; ts.isFunctionLike = isFunctionLike; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 171: + case 145: + case 146: + case 213: + case 173: return true; } return false; } ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 190 && isFunctionLike(node.parent); + return node && node.kind === 192 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 141 && node.parent.kind === 163; + return node && node.kind === 143 && node.parent.kind === 165; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -4242,36 +4314,39 @@ var ts; return undefined; } switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 172: + case 174: if (!includeArrowFunctions) { continue; } - case 211: - case 171: - case 216: - case 139: - case 138: + case 213: + case 173: + case 218: case 141: case 140: - case 142: case 143: + case 142: case 144: - case 215: - case 246: + case 145: + case 146: + case 147: + case 148: + case 149: + case 217: + case 248: return node; } } @@ -4283,33 +4358,33 @@ var ts; if (!node) return node; switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 211: - case 171: - case 172: + case 213: + case 173: + case 174: if (!includeFunctions) { continue; } - case 139: - case 138: case 141: case 140: - case 142: case 143: + case 142: case 144: + case 145: + case 146: return node; } } @@ -4318,12 +4393,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 149: + case 151: return node.typeName; - case 186: + case 188: return node.expression; - case 67: - case 133: + case 69: + case 135: return node; } } @@ -4331,7 +4406,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 168) { + if (node.kind === 170) { return node.tag; } return node.expression; @@ -4339,40 +4414,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 212: + case 214: return true; - case 139: - return node.parent.kind === 212; - case 136: - return node.parent.body && node.parent.parent.kind === 212; - case 143: - case 144: case 141: - return node.body && node.parent.kind === 212; + return node.parent.kind === 214; + case 138: + return node.parent.body && node.parent.parent.kind === 214; + case 145: + case 146: + case 143: + return node.body && node.parent.kind === 214; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 212: + case 214: if (node.decorators) { return true; } return false; - case 139: - case 136: - if (node.decorators) { - return true; - } - return false; - case 143: - if (node.body && node.decorators) { - return true; - } - return false; case 141: - case 144: + case 138: + if (node.decorators) { + return true; + } + return false; + case 145: + if (node.body && node.decorators) { + return true; + } + return false; + case 143: + case 146: if (node.body && node.decorators) { return true; } @@ -4383,10 +4458,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 212: + case 214: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 141: - case 144: + case 143: + case 146: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4396,95 +4471,105 @@ var ts; return nodeIsDecorated(node) || childIsDecorated(node); } ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 166; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 167; + } + ts.isElementAccessExpression = isElementAccessExpression; function isExpression(node) { switch (node.kind) { case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 10: - case 162: - case 163: case 164: case 165: case 166: case 167: case 168: - case 187: case 169: case 170: + case 189: case 171: - case 184: case 172: - case 175: case 173: + case 186: case 174: case 177: - case 178: + case 175: + case 176: case 179: case 180: - case 183: case 181: - case 11: - case 185: - case 231: - case 232: case 182: + case 185: + case 183: + case 11: + case 187: + case 233: + case 234: + case 184: + case 178: return true; - case 133: - while (node.parent.kind === 133) { + case 135: + while (node.parent.kind === 135) { node = node.parent; } - return node.parent.kind === 152; - case 67: - if (node.parent.kind === 152) { + return node.parent.kind === 154; + case 69: + if (node.parent.kind === 154) { return true; } case 8: case 9: + case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 209: - case 136: - case 139: + case 211: case 138: + case 141: + case 140: + case 247: case 245: - case 243: - case 161: + case 163: return parent_2.initializer === node; - case 193: - case 194: case 195: case 196: - case 202: - case 203: - case 204: - case 239: - case 206: - case 204: - return parent_2.expression === node; case 197: + case 198: + case 204: + case 205: + case 206: + case 241: + case 208: + case 206: + return parent_2.expression === node; + case 199: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 210) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 212) || forStatement.condition === node || forStatement.incrementor === node; - case 198: - case 199: + case 200: + case 201: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212) || forInStatement.expression === node; - case 169: - case 187: + case 171: + case 189: return node === parent_2.expression; - case 188: + case 190: return node === parent_2.expression; - case 134: + case 136: return node === parent_2.expression; - case 137: - case 238: + case 139: + case 240: + case 239: return true; - case 186: + case 188: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4495,6 +4580,10 @@ var ts; return false; } ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 || @@ -4502,7 +4591,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind === 230; + return node.kind === 221 && node.moduleReference.kind === 232; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4511,20 +4600,54 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind !== 230; + return node.kind === 221 && node.moduleReference.kind !== 232; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(expression) { + return expression.kind === 168 && + expression.expression.kind === 69 && + expression.expression.text === "require" && + expression.arguments.length === 1; + } + ts.isRequireCall = isRequireCall; + function isExportsPropertyAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + function isModuleExportsAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { - if (node.kind === 220) { + if (node.kind === 222) { return node.moduleSpecifier; } - if (node.kind === 219) { + if (node.kind === 221) { var reference = node.moduleReference; - if (reference.kind === 230) { + if (reference.kind === 232) { return reference.expression; } } - if (node.kind === 226) { + if (node.kind === 228) { return node.moduleSpecifier; } } @@ -4532,13 +4655,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 136: + case 138: + case 143: + case 142: + case 246: + case 245: case 141: case 140: - case 244: - case 243: - case 139: - case 138: return node.questionToken !== undefined; } } @@ -4546,9 +4669,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 259 && + return node.kind === 261 && node.parameters.length > 0 && - node.parameters[0].type.kind === 261; + node.parameters[0].type.kind === 263; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -4562,24 +4685,24 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 267); + return getJSDocTag(node, 269); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 266); + return getJSDocTag(node, 268); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 268); + return getJSDocTag(node, 270); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 67) { + if (parameter.name && parameter.name.kind === 69) { var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 265) { + if (t.kind === 267) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -4598,12 +4721,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 260) { + if (node.type && node.type.kind === 262) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 260; + return paramTag.typeExpression.type.kind === 262; } } return node.dotDotDotToken !== undefined; @@ -4624,7 +4747,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 160 || node.kind === 159); + return !!node && (node.kind === 162 || node.kind === 161); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4639,34 +4762,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 172: - case 161: - case 212: - case 184: - case 142: - case 215: - case 245: - case 228: - case 211: - case 171: - case 143: - case 221: - case 219: - case 224: + case 174: + case 163: + case 214: + case 186: + case 144: + case 217: + case 247: + case 230: case 213: + case 173: + case 145: + case 223: + case 221: + case 226: + case 215: + case 143: + case 142: + case 218: + case 224: + case 138: + case 245: case 141: case 140: + case 146: + case 246: case 216: - case 222: - case 136: - case 243: - case 139: - case 138: - case 144: - case 244: - case 214: - case 135: - case 209: + case 137: + case 211: return true; } return false; @@ -4674,25 +4797,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 201: - case 200: - case 208: - case 195: - case 193: - case 192: - case 198: - case 199: - case 197: - case 194: - case 205: - case 202: - case 204: - case 96: - case 207: - case 191: - case 196: case 203: - case 225: + case 202: + case 210: + case 197: + case 195: + case 194: + case 200: + case 201: + case 199: + case 196: + case 207: + case 204: + case 206: + case 98: + case 209: + case 193: + case 198: + case 205: + case 227: return true; default: return false; @@ -4701,13 +4824,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 142: - case 139: + case 144: case 141: case 143: - case 144: - case 140: - case 147: + case 145: + case 146: + case 142: + case 149: return true; default: return false; @@ -4715,11 +4838,11 @@ var ts; } ts.isClassElement = isClassElement; function isDeclarationName(name) { - if (name.kind !== 67 && name.kind !== 9 && name.kind !== 8) { + if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) { return false; } var parent = name.parent; - if (parent.kind === 224 || parent.kind === 228) { + if (parent.kind === 226 || parent.kind === 230) { if (parent.propertyName) { return true; } @@ -4733,54 +4856,54 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 139: - case 138: case 141: case 140: case 143: - case 144: + case 142: + case 145: + case 146: + case 247: case 245: - case 243: - case 164: + case 166: return parent.name === node; - case 133: + case 135: if (parent.right === node) { - while (parent.kind === 133) { + while (parent.kind === 135) { parent = parent.parent; } - return parent.kind === 152; + return parent.kind === 154; } return false; - case 161: - case 224: + case 163: + case 226: return parent.propertyName === node; - case 228: + case 230: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 219 || - node.kind === 221 && !!node.name || - node.kind === 222 || + return node.kind === 221 || + node.kind === 223 && !!node.name || node.kind === 224 || - node.kind === 228 || - node.kind === 225 && node.expression.kind === 67; + node.kind === 226 || + node.kind === 230 || + node.kind === 227 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 104); + var heritageClause = getHeritageClause(node.heritageClauses, 106); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -4849,7 +4972,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 68 <= token && token <= 132; + return 70 <= token && token <= 134; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4862,19 +4985,19 @@ var ts; ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 134 && + declaration.name.kind === 136 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 164 && isESSymbolIdentifier(node.expression); + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 67 || name.kind === 9 || name.kind === 8) { + if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 134) { + if (name.kind === 136) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4889,21 +5012,21 @@ var ts; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 67 && node.text === "Symbol"; + return node.kind === 69 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 113: - case 116: - case 72: - case 120: - case 75: - case 80: + case 115: + case 118: + case 74: + case 122: + case 77: + case 82: + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; } return false; @@ -4911,28 +5034,28 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 136; + return root.kind === 138; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 161) { + while (node.kind === 163) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 216 || n.kind === 246; + return isFunctionLike(n) || n.kind === 218 || n.kind === 248; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneEntityName(node) { - if (node.kind === 67) { - var clone_1 = createSynthesizedNode(67); + if (node.kind === 69) { + var clone_1 = createSynthesizedNode(69); clone_1.text = node.text; return clone_1; } else { - var clone_2 = createSynthesizedNode(133); + var clone_2 = createSynthesizedNode(135); clone_2.left = cloneEntityName(node.left); clone_2.left.parent = clone_2; clone_2.right = cloneEntityName(node.right); @@ -5175,7 +5298,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 142 && nodeIsPresent(member.body)) { + if (member.kind === 144 && nodeIsPresent(member.body)) { return member; } }); @@ -5202,10 +5325,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 143) { + if (accessor.kind === 145) { getAccessor = accessor; } - else if (accessor.kind === 144) { + else if (accessor.kind === 146) { setAccessor = accessor; } else { @@ -5214,7 +5337,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 143 || member.kind === 144) + if ((member.kind === 145 || member.kind === 146) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5225,10 +5348,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 143 && !getAccessor) { + if (member.kind === 145 && !getAccessor) { getAccessor = member; } - if (member.kind === 144 && !setAccessor) { + if (member.kind === 146 && !setAccessor) { setAccessor = member; } } @@ -5334,16 +5457,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 111: return 128; - case 110: return 16; - case 109: return 64; - case 108: return 32; - case 113: return 256; - case 80: return 1; - case 120: return 2; - case 72: return 32768; - case 75: return 1024; - case 116: return 512; + case 113: return 128; + case 112: return 16; + case 111: return 64; + case 110: return 32; + case 115: return 256; + case 82: return 1; + case 122: return 2; + case 74: return 32768; + case 77: return 1024; + case 118: return 512; } return 0; } @@ -5351,29 +5474,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 164: - case 165: - case 167: case 166: - case 231: - case 232: + case 167: + case 169: case 168: - case 162: + case 233: + case 234: case 170: - case 163: - case 184: - case 171: - case 67: + case 164: + case 172: + case 165: + case 186: + case 173: + case 69: case 10: case 8: case 9: case 11: - case 181: - case 82: - case 91: - case 95: - case 97: + case 183: + case 84: case 93: + case 97: + case 99: + case 95: return true; } } @@ -5381,12 +5504,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 55 && token <= 66; + return token >= 56 && token <= 68; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 186 && - node.parent.token === 81 && + return node.kind === 188 && + node.parent.token === 83 && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -5395,10 +5518,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 67) { + if (node.kind === 69) { return true; } - else if (node.kind === 164) { + else if (isPropertyAccessExpression(node)) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -5406,16 +5529,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 133 && node.parent.right === node) || - (node.parent.kind === 164 && node.parent.name === node); + return (node.parent.kind === 135 && node.parent.right === node) || + (node.parent.kind === 166 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 163) { + if (kind === 165) { return expression.properties.length === 0; } - if (kind === 162) { + if (kind === 164) { return expression.elements.length === 0; } return false; @@ -5425,12 +5548,12 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } ts.isTsx = isTsx; function getExpandedCharCodes(input) { @@ -5624,9 +5747,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 135) { + if (d && d.kind === 137) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215) { return current; } } @@ -5636,7 +5759,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(270); + var nodeConstructors = new Array(272); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5674,20 +5797,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 133: + case 135: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 135: + case 137: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 136: - case 139: + case 246: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); case 138: - case 243: - case 244: - case 209: - case 161: + case 141: + case 140: + case 245: + case 211: + case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5696,24 +5825,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 150: - case 151: - case 145: - case 146: + case 152: + case 153: case 147: + case 148: + case 149: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 171: - case 211: - case 172: + case 145: + case 146: + case 173: + case 213: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5724,290 +5853,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 149: + case 151: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 148: + case 150: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 152: - return visitNode(cbNode, node.exprName); - case 153: - return visitNodes(cbNodes, node.members); case 154: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 155: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 156: + return visitNode(cbNode, node.elementType); case 157: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.elementTypes); case 158: - return visitNode(cbNode, node.type); case 159: + return visitNodes(cbNodes, node.types); case 160: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 161: case 162: return visitNodes(cbNodes, node.elements); - case 163: - return visitNodes(cbNodes, node.properties); case 164: + return visitNodes(cbNodes, node.elements); + case 165: + return visitNodes(cbNodes, node.properties); + case 166: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 165: + case 167: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 166: - case 167: + case 168: + case 169: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 168: + case 170: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 169: + case 171: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 170: - return visitNode(cbNode, node.expression); - case 173: - return visitNode(cbNode, node.expression); - case 174: + case 172: return visitNode(cbNode, node.expression); case 175: return visitNode(cbNode, node.expression); - case 177: - return visitNode(cbNode, node.operand); - case 182: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 176: return visitNode(cbNode, node.expression); - case 178: - return visitNode(cbNode, node.operand); + case 177: + return visitNode(cbNode, node.expression); case 179: + return visitNode(cbNode, node.operand); + case 184: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression); + case 180: + return visitNode(cbNode, node.operand); + case 181: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 187: + case 189: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 180: + case 182: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 183: + case 185: return visitNode(cbNode, node.expression); - case 190: - case 217: + case 192: + case 219: return visitNodes(cbNodes, node.statements); - case 246: + case 248: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 191: + case 193: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 210: + case 212: return visitNodes(cbNodes, node.declarations); - case 193: + case 195: return visitNode(cbNode, node.expression); - case 194: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 195: + case 197: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 196: + case 198: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 197: + case 199: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 198: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 199: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 200: - case 201: - return visitNode(cbNode, node.label); - case 202: - return visitNode(cbNode, node.expression); - case 203: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 201: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 202: + case 203: + return visitNode(cbNode, node.label); case 204: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 218: - return visitNodes(cbNodes, node.clauses); - case 239: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 240: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression); case 205: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 206: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 220: + return visitNodes(cbNodes, node.clauses); + case 241: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 242: + return visitNodes(cbNodes, node.statements); case 207: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 242: + case 244: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 137: + case 139: return visitNode(cbNode, node.expression); - case 212: - case 184: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 213: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 214: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 245: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 216: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 217: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 247: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 218: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 219: + case 221: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 220: + case 222: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 221: + case 223: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 222: + case 224: return visitNode(cbNode, node.name); - case 223: - case 227: + case 225: + case 229: return visitNodes(cbNodes, node.elements); - case 226: + case 228: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 224: - case 228: + case 226: + case 230: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 225: + case 227: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 181: + case 183: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 188: + case 190: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 134: + case 136: return visitNode(cbNode, node.expression); - case 241: + case 243: return visitNodes(cbNodes, node.types); - case 186: + case 188: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 230: + case 232: return visitNode(cbNode, node.expression); - case 229: - return visitNodes(cbNodes, node.decorators); case 231: + return visitNodes(cbNodes, node.decorators); + case 233: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 232: - case 233: + case 234: + case 235: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + case 239: + return visitNode(cbNode, node.expression); + case 240: + return visitNode(cbNode, node.expression); case 237: - return visitNode(cbNode, node.expression); - case 238: - return visitNode(cbNode, node.expression); - case 235: return visitNode(cbNode, node.tagName); - case 247: - return visitNode(cbNode, node.type); - case 251: - return visitNodes(cbNodes, node.types); - case 252: - return visitNodes(cbNodes, node.types); - case 250: - return visitNode(cbNode, node.elementType); - case 254: + case 249: return visitNode(cbNode, node.type); case 253: + return visitNodes(cbNodes, node.types); + case 254: + return visitNodes(cbNodes, node.types); + case 252: + return visitNode(cbNode, node.elementType); + case 256: return visitNode(cbNode, node.type); case 255: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.type); case 257: + return visitNodes(cbNodes, node.members); + case 259: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 258: - return visitNode(cbNode, node.type); - case 259: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 260: return visitNode(cbNode, node.type); case 261: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 262: return visitNode(cbNode, node.type); - case 256: + case 263: + return visitNode(cbNode, node.type); + case 264: + return visitNode(cbNode, node.type); + case 258: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 263: - return visitNodes(cbNodes, node.tags); case 265: + return visitNodes(cbNodes, node.tags); + case 267: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 266: - return visitNode(cbNode, node.typeExpression); - case 267: - return visitNode(cbNode, node.typeExpression); case 268: + return visitNode(cbNode, node.typeExpression); + case 269: + return visitNode(cbNode, node.typeExpression); + case 270: return visitNodes(cbNodes, node.typeParameters); } } @@ -6048,13 +6177,14 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -6062,7 +6192,7 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 : 0; + contextFlags = isJavaScriptFile ? 32 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -6080,6 +6210,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32) { + sourceFile.parserContextFlags = 32; + } token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -6093,7 +6226,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -6103,9 +6236,9 @@ var ts; return; function visit(node) { switch (node.kind) { - case 191: - case 211: - case 136: + case 193: + case 213: + case 138: addJSDocComment(node); } forEachChild(node, visit); @@ -6139,7 +6272,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(246, 0); + var sourceFile = createNode(248, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6298,16 +6431,16 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 67) { + if (token === 69) { return true; } - if (token === 112 && inYieldContext()) { + if (token === 114 && inYieldContext()) { return false; } - if (token === 117 && inAwaitContext()) { + if (token === 119 && inAwaitContext()) { return false; } - return token > 103; + return token > 105; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -6403,15 +6536,15 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(67); - if (token !== 67) { + var node = createNode(69); + if (token !== 69) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(67, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -6443,7 +6576,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(134); + var node = createNode(136); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6453,20 +6586,27 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 72) { - return nextToken() === 79; + if (token === 74) { + return nextToken() === 81; } - if (token === 80) { + if (token === 82) { nextToken(); - if (token === 75) { + if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 && token !== 15 && canFollowModifier(); } - if (token === 75) { + if (token === 77) { return nextTokenIsClassOrFunction(); } + if (token === 113) { + nextToken(); + return canFollowModifier(); + } nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } return canFollowModifier(); } function parseAnyContextualModifier() { @@ -6480,7 +6620,7 @@ var ts; } function nextTokenIsClassOrFunction() { nextToken(); - return token === 71 || token === 85; + return token === 73 || token === 87; } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6493,7 +6633,7 @@ var ts; case 3: return !(token === 23 && inErrorRecovery) && isStartOfStatement(); case 2: - return token === 69 || token === 75; + return token === 71 || token === 77; case 4: return isStartOfTypeMember(); case 5: @@ -6549,7 +6689,7 @@ var ts; ts.Debug.assert(token === 15); if (nextToken() === 16) { var next = nextToken(); - return next === 24 || next === 15 || next === 81 || next === 104; + return next === 24 || next === 15 || next === 83 || next === 106; } return true; } @@ -6562,8 +6702,8 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 104 || - token === 81) { + if (token === 106 || + token === 83) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -6587,13 +6727,13 @@ var ts; case 21: return token === 16; case 3: - return token === 16 || token === 69 || token === 75; + return token === 16 || token === 71 || token === 77; case 7: - return token === 15 || token === 81 || token === 104; + return token === 15 || token === 83 || token === 106; case 8: return isVariableDeclaratorListTerminator(); case 17: - return token === 27 || token === 17 || token === 15 || token === 81 || token === 104; + return token === 27 || token === 17 || token === 15 || token === 83 || token === 106; case 11: return token === 18 || token === 23; case 15: @@ -6607,11 +6747,11 @@ var ts; case 20: return token === 15 || token === 16; case 13: - return token === 27 || token === 38; + return token === 27 || token === 39; case 14: return token === 25 && lookAhead(nextTokenIsSlash); case 22: - return token === 18 || token === 53 || token === 16; + return token === 18 || token === 54 || token === 16; case 23: return token === 27 || token === 16; case 25: @@ -6732,17 +6872,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 142: - case 147: - case 143: case 144: - case 139: - case 189: - return true; + case 149: + case 145: + case 146: case 141: + case 191: + return true; + case 143: var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 67 && - methodDeclaration.name.originalKeywordKind === 119; + var nameIsConstructor = methodDeclaration.name.kind === 69 && + methodDeclaration.name.originalKeywordKind === 121; return !nameIsConstructor; } } @@ -6751,8 +6891,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 239: - case 240: + case 241: + case 242: return true; } } @@ -6761,65 +6901,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 211: - case 191: - case 190: - case 194: + case 213: case 193: - case 206: - case 202: - case 204: - case 201: - case 200: - case 198: - case 199: - case 197: - case 196: - case 203: case 192: - case 207: - case 205: + case 196: case 195: case 208: - case 220: - case 219: - case 226: - case 225: - case 216: - case 212: - case 213: - case 215: + case 204: + case 206: + case 203: + case 202: + case 200: + case 201: + case 199: + case 198: + case 205: + case 194: + case 209: + case 207: + case 197: + case 210: + case 222: + case 221: + case 228: + case 227: + case 218: case 214: + case 215: + case 217: + case 216: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 245; + return node.kind === 247; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 146: + case 148: + case 142: + case 149: case 140: case 147: - case 138: - case 145: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 209) { + if (node.kind !== 211) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 136) { + if (node.kind !== 138) { return false; } var parameter = node; @@ -6919,7 +7059,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(133, entity.pos); + var node = createNode(135, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6930,13 +7070,13 @@ var ts; if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(181); + var template = createNode(183); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; @@ -6949,7 +7089,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(188); + var span = createNode(190); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { @@ -6984,14 +7124,14 @@ var ts; } function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 67 && token === 122 && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 69 && token === 124 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(148, typeName.pos); + var node_1 = createNode(150, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(149, typeName.pos); + var node = createNode(151, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -6999,15 +7139,15 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(152); - parseExpected(99); + var node = createNode(154); + parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(135); + var node = createNode(137); node.name = parseIdentifier(); - if (parseOptional(81)) { + if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -7023,7 +7163,7 @@ var ts; } } function parseParameterType() { - if (parseOptional(53)) { + if (parseOptional(54)) { return token === 9 ? parseLiteralNode(true) : parseType(); @@ -7031,7 +7171,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 54; + return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 55; } function setModifiers(node, modifiers) { if (modifiers) { @@ -7040,7 +7180,7 @@ var ts; } } function parseParameter() { - var node = createNode(136); + var node = createNode(138); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); @@ -7048,7 +7188,7 @@ var ts; if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(52); + node.questionToken = parseOptionalToken(53); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); return finishNode(node); @@ -7095,10 +7235,10 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 146) { - parseExpected(90); + if (kind === 148) { + parseExpected(92); } - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } @@ -7125,17 +7265,17 @@ var ts; else { nextToken(); } - if (token === 53 || token === 24) { + if (token === 54 || token === 24) { return true; } - if (token !== 52) { + if (token !== 53) { return false; } nextToken(); - return token === 53 || token === 24 || token === 20; + return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(147, fullStart); + var node = createNode(149, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -7146,17 +7286,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(140, fullStart); + var method = createNode(142, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(53, false, false, false, method); + fillSignature(54, false, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(138, fullStart); + var property = createNode(140, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -7190,22 +7330,22 @@ var ts; nextToken(); return token === 17 || token === 25 || - token === 52 || token === 53 || + token === 54 || canParseSemicolon(); } function parseTypeMember() { switch (token) { case 17: case 25: - return parseSignatureMember(145); + return parseSignatureMember(147); case 19: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); - case 90: + case 92: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(146); + return parseSignatureMember(148); } case 9: case 8: @@ -7235,7 +7375,7 @@ var ts; return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(153); + var node = createNode(155); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7251,12 +7391,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(155); + var node = createNode(157); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(158); + var node = createNode(160); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -7264,8 +7404,8 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 151) { - parseExpected(90); + if (kind === 153) { + parseExpected(92); } fillSignature(34, false, false, false, node); return finishNode(node); @@ -7276,16 +7416,17 @@ var ts; } function parseNonArrayType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 101: + case 103: + case 97: return parseTokenNode(); - case 99: + case 101: return parseTypeQuery(); case 15: return parseTypeLiteral(); @@ -7299,17 +7440,18 @@ var ts; } function isStartOfType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: + case 103: + case 97: case 101: - case 99: case 15: case 19: case 25: - case 90: + case 92: return true; case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -7325,7 +7467,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(154, type.pos); + var node = createNode(156, type.pos); node.elementType = type; type = finishNode(node); } @@ -7347,10 +7489,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(157, parseArrayTypeOrHigher, 45); + return parseUnionOrIntersectionType(159, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(156, parseIntersectionTypeOrHigher, 46); + return parseUnionOrIntersectionType(158, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -7365,8 +7507,8 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 53 || token === 24 || - token === 52 || token === 55 || + if (token === 54 || token === 24 || + token === 53 || token === 56 || isIdentifier() || ts.isModifier(token)) { return true; } @@ -7384,23 +7526,23 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(150); + return parseFunctionOrConstructorType(152); } - if (token === 90) { - return parseFunctionOrConstructorType(151); + if (token === 92) { + return parseFunctionOrConstructorType(153); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(53) ? parseType() : undefined; + return parseOptional(54) ? parseType() : undefined; } function isStartOfLeftHandSideExpression() { switch (token) { + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 8: case 9: case 11: @@ -7408,12 +7550,12 @@ var ts; case 17: case 19: case 15: - case 85: - case 71: - case 90: - case 38: - case 59: - case 67: + case 87: + case 73: + case 92: + case 39: + case 61: + case 69: return true; default: return isIdentifier(); @@ -7426,16 +7568,16 @@ var ts; switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 76: - case 99: + case 78: case 101: - case 40: + case 103: case 41: + case 42: case 25: - case 117: - case 112: + case 119: + case 114: return true; default: if (isBinaryOperator()) { @@ -7446,9 +7588,9 @@ var ts; } function isStartOfExpressionStatement() { return token !== 15 && - token !== 85 && - token !== 71 && - token !== 54 && + token !== 87 && + token !== 73 && + token !== 55 && isStartOfExpression(); } function allowInAndParseExpression() { @@ -7470,12 +7612,12 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 55) { + if (token !== 56) { if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { return undefined; } } - parseExpected(55); + parseExpected(56); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -7487,7 +7629,7 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 67 && token === 34) { + if (expr.kind === 69 && token === 34) { return parseSimpleArrowFunctionExpression(expr); } if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { @@ -7496,7 +7638,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 112) { + if (token === 114) { if (inYieldContext()) { return true; } @@ -7509,7 +7651,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(182); + var node = createNode(184); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7523,8 +7665,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(172, identifier.pos); - var parameter = createNode(136, identifier.pos); + var node = createNode(174, identifier.pos); + var parameter = createNode(138, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -7554,7 +7696,7 @@ var ts; return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 17 || token === 25 || token === 116) { + if (token === 17 || token === 25 || token === 118) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token === 34) { @@ -7563,7 +7705,7 @@ var ts; return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 116) { + if (token === 118) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; @@ -7579,7 +7721,7 @@ var ts; var third = nextToken(); switch (third) { case 34: - case 53: + case 54: case 15: return 1; default: @@ -7595,7 +7737,7 @@ var ts; if (!isIdentifier()) { return 0; } - if (nextToken() === 53) { + if (nextToken() === 54) { return 1; } return 2; @@ -7608,10 +7750,10 @@ var ts; if (sourceFile.languageVariant === 1) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 81) { + if (third === 83) { var fourth = nextToken(); switch (fourth) { - case 55: + case 56: case 27: return false; default: @@ -7635,10 +7777,10 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(172); + var node = createNode(174); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512); - fillSignature(53, false, isAsync, !allowAmbiguity, node); + fillSignature(54, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; } @@ -7652,8 +7794,8 @@ var ts; return parseFunctionBlock(false, isAsync, false); } if (token !== 23 && - token !== 85 && - token !== 71 && + token !== 87 && + token !== 73 && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(false, isAsync, true); @@ -7663,15 +7805,15 @@ var ts; : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); } function parseConditionalExpressionRest(leftOperand) { - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (!questionToken) { return leftOperand; } - var node = createNode(180, leftOperand.pos); + var node = createNode(182, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(53, false, ts.Diagnostics._0_expected, ts.tokenToString(53)); + node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7680,19 +7822,22 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 88 || t === 132; + return t === 90 || t === 134; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); var newPrecedence = getBinaryOperatorPrecedence(); - if (newPrecedence <= precedence) { + var consumeCurrentOperator = token === 38 ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { break; } - if (token === 88 && inDisallowInContext()) { + if (token === 90 && inDisallowInContext()) { break; } - if (token === 114) { + if (token === 116) { if (scanner.hasPrecedingLineBreak()) { break; } @@ -7708,22 +7853,22 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 88) { + if (inDisallowInContext() && token === 90) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 51: + case 52: return 1; - case 50: + case 51: return 2; - case 46: - return 3; case 47: + return 3; + case 48: return 4; - case 45: + case 46: return 5; case 30: case 31: @@ -7734,64 +7879,66 @@ var ts; case 27: case 28: case 29: - case 89: - case 88: - case 114: + case 91: + case 90: + case 116: return 7; - case 42: case 43: case 44: + case 45: return 8; case 35: case 36: return 9; case 37: - case 38: case 39: + case 40: return 10; + case 38: + return 11; } return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(179, left.pos); + var node = createNode(181, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(187, left.pos); + var node = createNode(189, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(177); + var node = createNode(179); node.operator = token; nextToken(); - node.operand = parseUnaryExpressionOrHigher(); + node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(173); + var node = createNode(175); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(174); + var node = createNode(176); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(175); + var node = createNode(177); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token === 117) { + if (token === 119) { if (inAwaitContext()) { return true; } @@ -7800,45 +7947,87 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(176); + var node = createNode(178); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseUnaryExpressionOrHigher() { if (isAwaitExpression()) { return parseAwaitExpression(); } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38) { + var diagnostic; + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 171) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } + else { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + function parseSimpleUnaryExpression() { switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 40: - case 41: return parsePrefixUnaryExpression(); - case 76: + case 78: return parseDeleteExpression(); - case 99: - return parseTypeOfExpression(); case 101: + return parseTypeOfExpression(); + case 103: return parseVoidExpression(); case 25: - if (sourceFile.languageVariant !== 1) { - return parseTypeAssertion(); - } - if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); - } + return parseTypeAssertion(); default: - return parsePostfixExpressionOrHigher(); + return parseIncrementExpression(); } } - function parsePostfixExpressionOrHigher() { + function isIncrementExpression() { + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 78: + case 101: + case 103: + return false; + case 25: + if (sourceFile.languageVariant !== 1) { + return false; + } + default: + return true; + } + } + function parseIncrementExpression() { + if (token === 41 || token === 42) { + var node = createNode(179); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 && token === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) { + return parseJsxElementOrSelfClosingElement(true); + } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 40 || token === 41) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(178, expression.pos); + if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(180, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7847,7 +8036,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 93 + var expression = token === 95 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); @@ -7861,7 +8050,7 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(164, expression.pos); + var node = createNode(166, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -7869,26 +8058,26 @@ var ts; } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); - if (opening.kind === 233) { - var node = createNode(231, opening.pos); + if (opening.kind === 235) { + var node = createNode(233, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 232); + ts.Debug.assert(opening.kind === 234); return opening; } } function parseJsxText() { - var node = createNode(234, scanner.getStartPos()); + var node = createNode(236, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 234: + case 236: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -7924,11 +8113,11 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(233, fullStart); + node = createNode(235, fullStart); scanJsxText(); } else { - parseExpected(38); + parseExpected(39); if (inExpressionContext) { parseExpected(27); } @@ -7936,7 +8125,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(232, fullStart); + node = createNode(234, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7947,7 +8136,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(133, elementName.pos); + var node = createNode(135, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -7955,7 +8144,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(238); + var node = createNode(240); parseExpected(15); if (token !== 16) { node.expression = parseExpression(); @@ -7974,9 +8163,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(236); + var node = createNode(238); node.name = parseIdentifierName(); - if (parseOptional(55)) { + if (parseOptional(56)) { switch (token) { case 9: node.initializer = parseLiteralNode(); @@ -7989,7 +8178,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(237); + var node = createNode(239); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -7997,7 +8186,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(235); + var node = createNode(237); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -8010,18 +8199,18 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(169); + var node = createNode(171); parseExpected(25); node.type = parseType(); parseExpected(27); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(164, expression.pos); + var propertyAccess = createNode(166, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -8029,7 +8218,7 @@ var ts; continue; } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(165, expression.pos); + var indexedAccess = createNode(167, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -8043,7 +8232,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(168, expression.pos); + var tagExpression = createNode(170, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -8062,7 +8251,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8070,7 +8259,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -8103,18 +8292,18 @@ var ts; case 21: case 18: case 20: - case 53: + case 54: case 23: - case 52: + case 53: case 30: case 32: case 31: case 33: - case 50: case 51: - case 47: - case 45: + case 52: + case 48: case 46: + case 47: case 16: case 1: return true; @@ -8130,11 +8319,11 @@ var ts; case 9: case 11: return parseLiteralNode(); + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: return parseTokenNode(); case 17: return parseParenthesizedExpression(); @@ -8142,19 +8331,19 @@ var ts; return parseArrayLiteralExpression(); case 15: return parseObjectLiteralExpression(); - case 116: + case 118: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 71: + case 73: return parseClassExpression(); - case 85: + case 87: return parseFunctionExpression(); - case 90: + case 92: return parseNewExpression(); - case 38: - case 59: + case 39: + case 61: if (reScanSlashToken() === 10) { return parseLiteralNode(); } @@ -8165,28 +8354,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(170); + var node = createNode(172); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(183); + var node = createNode(185); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(185) : + token === 24 ? createNode(187) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(162); + var node = createNode(164); parseExpected(19); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048; @@ -8195,11 +8384,11 @@ var ts; return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(121)) { - return parseAccessorDeclaration(143, fullStart, decorators, modifiers); + if (parseContextualModifier(123)) { + return parseAccessorDeclaration(145, fullStart, decorators, modifiers); } - else if (parseContextualModifier(127)) { - return parseAccessorDeclaration(144, fullStart, decorators, modifiers); + else if (parseContextualModifier(129)) { + return parseAccessorDeclaration(146, fullStart, decorators, modifiers); } return undefined; } @@ -8215,27 +8404,33 @@ var ts; var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 24 || token === 16) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(244, fullStart); + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(246, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(243, fullStart); + var propertyAssignment = createNode(245, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(53); + parseExpected(54); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(163); + var node = createNode(165); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048; @@ -8249,9 +8444,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(171); + var node = createNode(173); setModifiers(node, parseModifiers()); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); @@ -8260,7 +8455,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlock(isGenerator, isAsync, false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -8271,8 +8466,8 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(167); - parseExpected(90); + var node = createNode(169); + parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token === 17) { @@ -8281,7 +8476,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(190); + var node = createNode(192); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8309,25 +8504,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(192); + var node = createNode(194); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(194); - parseExpected(86); + var node = createNode(196); + parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(78) ? parseStatement() : undefined; + node.elseStatement = parseOptional(80) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(195); - parseExpected(77); + var node = createNode(197); + parseExpected(79); node.statement = parseStatement(); - parseExpected(102); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8335,8 +8530,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(196); - parseExpected(102); + var node = createNode(198); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8345,11 +8540,11 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(84); + parseExpected(86); parseExpected(17); var initializer = undefined; if (token !== 23) { - if (token === 100 || token === 106 || token === 72) { + if (token === 102 || token === 108 || token === 74) { initializer = parseVariableDeclarationList(true); } else { @@ -8357,22 +8552,22 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(88)) { - var forInStatement = createNode(198, pos); + if (parseOptional(90)) { + var forInStatement = createNode(200, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(132)) { - var forOfStatement = createNode(199, pos); + else if (parseOptional(134)) { + var forOfStatement = createNode(201, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(197, pos); + var forStatement = createNode(199, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8390,7 +8585,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 201 ? 68 : 73); + parseExpected(kind === 203 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8398,8 +8593,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(202); - parseExpected(92); + var node = createNode(204); + parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -8407,8 +8602,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(203); - parseExpected(103); + var node = createNode(205); + parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8416,30 +8611,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(239); - parseExpected(69); + var node = createNode(241); + parseExpected(71); node.expression = allowInAnd(parseExpression); - parseExpected(53); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(240); - parseExpected(75); - parseExpected(53); + var node = createNode(242); + parseExpected(77); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 69 ? parseCaseClause() : parseDefaultClause(); + return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(204); - parseExpected(94); + var node = createNode(206); + parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(218, scanner.getStartPos()); + var caseBlock = createNode(220, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8447,26 +8642,26 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(206); - parseExpected(96); + var node = createNode(208); + parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(207); - parseExpected(98); + var node = createNode(209); + parseExpected(100); node.tryBlock = parseBlock(false); - node.catchClause = token === 70 ? parseCatchClause() : undefined; - if (!node.catchClause || token === 83) { - parseExpected(83); + node.catchClause = token === 72 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 85) { + parseExpected(85); node.finallyBlock = parseBlock(false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(242); - parseExpected(70); + var result = createNode(244); + parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); } @@ -8475,22 +8670,22 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(208); - parseExpected(74); + var node = createNode(210); + parseExpected(76); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 67 && parseOptional(53)) { - var labeledStatement = createNode(205, fullStart); + if (expression.kind === 69 && parseOptional(54)) { + var labeledStatement = createNode(207, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(193, fullStart); + var expressionStatement = createNode(195, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -8502,7 +8697,7 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 85 && !scanner.hasPrecedingLineBreak(); + return token === 87 && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); @@ -8511,41 +8706,41 @@ var ts; function isDeclaration() { while (true) { switch (token) { - case 100: - case 106: - case 72: - case 85: - case 71: - case 79: + case 102: + case 108: + case 74: + case 87: + case 73: + case 81: return true; - case 105: - case 130: + case 107: + case 132: return nextTokenIsIdentifierOnSameLine(); - case 123: - case 124: + case 125: + case 126: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 116: - case 120: + case 115: + case 118: + case 122: + case 110: + case 111: + case 112: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 87: + case 89: nextToken(); return token === 9 || token === 37 || token === 15 || ts.tokenIsIdentifierOrKeyword(token); - case 80: + case 82: nextToken(); - if (token === 55 || token === 37 || - token === 15 || token === 75) { + if (token === 56 || token === 37 || + token === 15 || token === 77) { return true; } continue; - case 110: - case 108: - case 109: - case 111: case 113: nextToken(); continue; @@ -8559,44 +8754,44 @@ var ts; } function isStartOfStatement() { switch (token) { - case 54: + case 55: case 23: case 15: - case 100: - case 106: - case 85: - case 71: - case 79: - case 86: - case 77: case 102: - case 84: + case 108: + case 87: case 73: - case 68: - case 92: - case 103: + case 81: + case 88: + case 79: + case 104: + case 86: + case 75: + case 70: case 94: + case 105: case 96: case 98: - case 74: - case 70: - case 83: - return true; + case 100: + case 76: case 72: - case 80: - case 87: - return isStartOfDeclaration(); - case 116: - case 120: - case 105: - case 123: - case 124: - case 130: + case 85: return true; + case 74: + case 82: + case 89: + return isStartOfDeclaration(); + case 118: + case 122: + case 107: + case 125: + case 126: + case 132: + return true; + case 112: case 110: - case 108: - case 109: case 111: + case 113: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8615,60 +8810,60 @@ var ts; return parseEmptyStatement(); case 15: return parseBlock(false); - case 100: + case 102: return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 106: + case 108: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined, undefined); } break; - case 85: - return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 71: - return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 86: - return parseIfStatement(); - case 77: - return parseDoStatement(); - case 102: - return parseWhileStatement(); - case 84: - return parseForOrForInOrForOfStatement(); - case 73: - return parseBreakOrContinueStatement(200); - case 68: - return parseBreakOrContinueStatement(201); - case 92: - return parseReturnStatement(); - case 103: - return parseWithStatement(); - case 94: - return parseSwitchStatement(); - case 96: - return parseThrowStatement(); - case 98: - case 70: - case 83: - return parseTryStatement(); - case 74: - return parseDebuggerStatement(); - case 54: - return parseDeclaration(); - case 116: - case 105: - case 130: - case 123: - case 124: - case 120: - case 72: - case 79: - case 80: case 87: - case 108: - case 109: + return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 73: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); + case 88: + return parseIfStatement(); + case 79: + return parseDoStatement(); + case 104: + return parseWhileStatement(); + case 86: + return parseForOrForInOrForOfStatement(); + case 75: + return parseBreakOrContinueStatement(202); + case 70: + return parseBreakOrContinueStatement(203); + case 94: + return parseReturnStatement(); + case 105: + return parseWithStatement(); + case 96: + return parseSwitchStatement(); + case 98: + return parseThrowStatement(); + case 100: + case 72: + case 85: + return parseTryStatement(); + case 76: + return parseDebuggerStatement(); + case 55: + return parseDeclaration(); + case 118: + case 107: + case 132: + case 125: + case 126: + case 122: + case 74: + case 81: + case 82: + case 89: case 110: - case 113: case 111: + case 112: + case 115: + case 113: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8681,33 +8876,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 100: - case 106: - case 72: + case 102: + case 108: + case 74: return parseVariableStatement(fullStart, decorators, modifiers); - case 85: - return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 71: - return parseClassDeclaration(fullStart, decorators, modifiers); - case 105: - return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 130: - return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 79: - return parseEnumDeclaration(fullStart, decorators, modifiers); - case 123: - case 124: - return parseModuleDeclaration(fullStart, decorators, modifiers); case 87: + return parseFunctionDeclaration(fullStart, decorators, modifiers); + case 73: + return parseClassDeclaration(fullStart, decorators, modifiers); + case 107: + return parseInterfaceDeclaration(fullStart, decorators, modifiers); + case 132: + return parseTypeAliasDeclaration(fullStart, decorators, modifiers); + case 81: + return parseEnumDeclaration(fullStart, decorators, modifiers); + case 125: + case 126: + return parseModuleDeclaration(fullStart, decorators, modifiers); + case 89: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 80: + case 82: nextToken(); - return token === 75 || token === 55 ? + return token === 77 || token === 56 ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { - var node = createMissingNode(229, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(231, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8728,23 +8923,23 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(185); + return createNode(187); } - var node = createNode(161); + var node = createNode(163); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(161); + var node = createNode(163); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 53) { + if (tokenIsIdentifier && token !== 54) { node.name = propertyName; } else { - parseExpected(53); + parseExpected(54); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -8752,14 +8947,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(159); + var node = createNode(161); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(160); + var node = createNode(162); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -8778,7 +8973,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(209); + var node = createNode(211); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8787,21 +8982,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(210); + var node = createNode(212); switch (token) { - case 100: + case 102: break; - case 106: + case 108: node.flags |= 16384; break; - case 72: + case 74: node.flags |= 32768; break; default: ts.Debug.fail(); } nextToken(); - if (token === 132 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 134 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8816,7 +9011,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(193, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8824,29 +9019,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(213, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(142, pos); + var node = createNode(144, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(119); - fillSignature(53, false, false, false, node); + parseExpected(121); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(141, fullStart); + var method = createNode(143, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8854,12 +9049,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512); - fillSignature(53, isGenerator, isAsync, false, method); + fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(139, fullStart); + var property = createNode(141, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -8874,7 +9069,7 @@ var ts; function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { var asteriskToken = parseOptionalToken(37); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } @@ -8890,16 +9085,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; default: return false; @@ -8907,7 +9102,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 54) { + if (token === 55) { return true; } while (ts.isModifier(token)) { @@ -8928,15 +9123,15 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 127 || idToken === 121) { + if (!ts.isKeyword(idToken) || idToken === 129 || idToken === 123) { return true; } switch (token) { case 17: case 25: + case 54: + case 56: case 53: - case 55: - case 52: return true; default: return canParseSemicolon(); @@ -8948,14 +9143,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(54)) { + if (!parseOptional(55)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(137, decoratorStart); + var decorator = createNode(139, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8989,7 +9184,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 116) { + if (token === 118) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -9004,7 +9199,7 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(189); + var result = createNode(191); nextToken(); return finishNode(result); } @@ -9015,7 +9210,7 @@ var ts; if (accessor) { return accessor; } - if (token === 119) { + if (token === 121) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -9029,23 +9224,23 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_7 = createMissingNode(67, true, ts.Diagnostics.Declaration_expected); + var name_7 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 184); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 186); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(71); - node.name = parseOptionalIdentifier(); + parseExpected(73); + node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(15)) { @@ -9057,6 +9252,14 @@ var ts; } return finishNode(node); } + function parseNameOfClassDeclarationOrExpression() { + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 && lookAhead(nextTokenIsIdentifierOrKeyword); + } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { return parseList(20, parseHeritageClause); @@ -9067,8 +9270,8 @@ var ts; return parseList(20, parseHeritageClause); } function parseHeritageClause() { - if (token === 81 || token === 104) { - var node = createNode(241); + if (token === 83 || token === 106) { + var node = createNode(243); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -9077,7 +9280,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(186); + var node = createNode(188); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -9085,16 +9288,16 @@ var ts; return finishNode(node); } function isHeritageClause() { - return token === 81 || token === 104; + return token === 83 || token === 106; } function parseClassMembers() { return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(105); + parseExpected(107); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -9102,28 +9305,28 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(130); + parseExpected(132); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(55); + parseExpected(56); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(245, scanner.getStartPos()); + var node = createNode(247, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(217, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(79); + parseExpected(81); node.name = parseIdentifier(); if (parseExpected(15)) { node.members = parseDelimitedList(6, parseEnumMember); @@ -9135,7 +9338,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(217, scanner.getStartPos()); + var node = createNode(219, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -9146,7 +9349,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); var namespaceFlag = flags & 131072; node.decorators = decorators; setModifiers(node, modifiers); @@ -9158,7 +9361,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -9167,11 +9370,11 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(124)) { + if (parseOptional(126)) { flags |= 131072; } else { - parseExpected(123); + parseExpected(125); if (token === 9) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -9179,58 +9382,58 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 125 && + return token === 127 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 17; } function nextTokenIsSlash() { - return nextToken() === 38; + return nextToken() === 39; } function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 24 || - token === 131; + token === 133; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(87); + parseExpected(89); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 131) { - var importEqualsDeclaration = createNode(219, fullStart); + if (token !== 24 && token !== 133) { + var importEqualsDeclaration = createNode(221, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(55); + parseExpected(56); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(220, fullStart); + var importDeclaration = createNode(222, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(131); + parseExpected(133); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(221, fullStart); + var importClause = createNode(223, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(223); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(225); } return finishNode(importClause); } @@ -9240,8 +9443,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(230); - parseExpected(125); + var node = createNode(232); + parseExpected(127); parseExpected(17); node.expression = parseModuleSpecifier(); parseExpected(18); @@ -9255,22 +9458,22 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(222); + var namespaceImport = createNode(224); parseExpected(37); - parseExpected(114); + parseExpected(116); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 223 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 225 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(228); + return parseImportOrExportSpecifier(230); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(224); + return parseImportOrExportSpecifier(226); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9278,9 +9481,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 114) { + if (token === 116) { node.propertyName = identifierName; - parseExpected(114); + parseExpected(116); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -9289,23 +9492,23 @@ var ts; else { node.name = identifierName; } - if (kind === 224 && checkIdentifierIsKeyword) { + if (kind === 226 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(131); + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(227); - if (token === 131 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(131); + node.exportClause = parseNamedImportsOrExports(229); + if (token === 133 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9313,14 +9516,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(55)) { + if (parseOptional(56)) { node.isExportEquals = true; } else { - parseExpected(75); + parseExpected(77); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -9383,10 +9586,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 219 && node.moduleReference.kind === 230 - || node.kind === 220 - || node.kind === 225 - || node.kind === 226 + || node.kind === 221 && node.moduleReference.kind === 232 + || node.kind === 222 + || node.kind === 227 + || node.kind === 228 ? node : undefined; }); @@ -9396,22 +9599,22 @@ var ts; function isJSDocType() { switch (token) { case 37: - case 52: + case 53: case 17: case 19: - case 48: + case 49: case 15: - case 85: + case 87: case 22: - case 90: - case 95: + case 92: + case 97: return true; } return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -9421,7 +9624,7 @@ var ts; function parseJSDocTypeExpression(start, length) { scanner.setText(sourceText, start, length); token = nextToken(); - var result = createNode(247); + var result = createNode(249); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9431,13 +9634,13 @@ var ts; JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 46) { - var unionType = createNode(251, type.pos); + if (token === 47) { + var unionType = createNode(253, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 55) { - var optionalType = createNode(258, type.pos); + if (token === 56) { + var optionalType = createNode(260, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9448,20 +9651,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(250, type.pos); + var arrayType = createNode(252, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } - else if (token === 52) { - var nullableType = createNode(253, type.pos); + else if (token === 53) { + var nullableType = createNode(255, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 48) { - var nonNullableType = createNode(254, type.pos); + else if (token === 49) { + var nonNullableType = createNode(256, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9476,80 +9679,80 @@ var ts; switch (token) { case 37: return parseJSDocAllType(); - case 52: + case 53: return parseJSDocUnknownOrNullableType(); case 17: return parseJSDocUnionType(); case 19: return parseJSDocTupleType(); - case 48: + case 49: return parseJSDocNonNullableType(); case 15: return parseJSDocRecordType(); - case 85: + case 87: return parseJSDocFunctionType(); case 22: return parseJSDocVariadicType(); - case 90: + case 92: return parseJSDocConstructorType(); - case 95: + case 97: return parseJSDocThisType(); - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(262); + var result = createNode(264); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(261); + var result = createNode(263); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(260); + var result = createNode(262); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(259); + var result = createNode(261); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); checkForTrailingComma(result.parameters); parseExpected(18); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(136); + var parameter = createNode(138); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(258, type.pos); + var result = createNode(260, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(257); + var result = createNode(259); result.name = parseSimplePropertyName(); while (parseOptional(21)) { if (token === 25) { @@ -9578,13 +9781,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(133, left.pos); + var result = createNode(135, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(255); + var result = createNode(257); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9592,22 +9795,22 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(256); + var result = createNode(258); result.name = parseSimplePropertyName(); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(254); + var result = createNode(256); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(252); + var result = createNode(254); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9621,7 +9824,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(251); + var result = createNode(253); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9632,14 +9835,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(46)) { + while (parseOptional(47)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(248); + var result = createNode(250); nextToken(); return finishNode(result); } @@ -9650,19 +9853,19 @@ var ts; token === 16 || token === 18 || token === 27 || - token === 55 || - token === 46) { - var result = createNode(249, pos); + token === 56 || + token === 47) { + var result = createNode(251, pos); return finishNode(result); } else { - var result = createNode(253, pos); + var result = createNode(255, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocComment = parseJSDocComment(undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -9727,7 +9930,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(263, start); + var result = createNode(265, start); result.tags = tags; return finishNode(result, end); } @@ -9738,7 +9941,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(54, pos - 1); + var atToken = createNode(55, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -9764,7 +9967,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(264, atToken.pos); + var result = createNode(266, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -9815,7 +10018,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(265, atToken.pos); + var result = createNode(267, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -9825,27 +10028,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266, atToken.pos); + var result = createNode(268, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267; })) { + if (ts.forEach(tags, function (t) { return t.kind === 269; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(267, atToken.pos); + var result = createNode(269, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268; })) { + if (ts.forEach(tags, function (t) { return t.kind === 270; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -9858,7 +10061,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(135, name_8.pos); + var typeParameter = createNode(137, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -9869,7 +10072,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(268, atToken.pos); + var result = createNode(270, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -9890,7 +10093,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(67, startPos); + var result = createNode(69, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -9966,7 +10169,7 @@ var ts; switch (node.kind) { case 9: case 8: - case 67: + case 69: return true; } return false; @@ -10205,17 +10408,19 @@ var ts; var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; + var symbolCount = 0; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, @@ -10301,6 +10506,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var cjsRequireType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -10361,6 +10567,7 @@ var ts; diagnostics.add(diagnostic); } function createSymbol(flags, name) { + symbolCount++; return new Symbol(flags, name); } function getExcludedSymbolFlags(flags) { @@ -10489,10 +10696,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 246); + return ts.getAncestor(node, 248); } function isGlobalSourceFile(node) { - return node.kind === 246 && !ts.isExternalModule(node); + return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10509,17 +10716,54 @@ var ts; } } } - function isDefinedBefore(node1, node2) { - var file1 = ts.getSourceFileOfNode(node1); - var file2 = ts.getSourceFileOfNode(node2); - if (file1 === file2) { - return node1.pos <= node2.pos; + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } - if (!compilerOptions.outFile && !compilerOptions.out) { - return true; + if (declaration.pos <= usage.pos) { + return declaration.kind !== 211 || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + if (declaration.parent.parent.kind === 193 || + declaration.parent.parent.kind === 199) { + return isSameScopeDescendentOf(usage, declaration, container); + } + else if (declaration.parent.parent.kind === 201 || + declaration.parent.parent.kind === 200) { + var expression = declaration.parent.parent.expression; + return isSameScopeDescendentOf(usage, expression, container); + } + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 141 && + (current.parent.flags & 128) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; } - var sourceFiles = host.getSourceFiles(); - return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -10540,16 +10784,16 @@ var ts; } } switch (location.kind) { - case 246: - if (!ts.isExternalModule(location)) + case 248: + if (!ts.isExternalOrCommonJsModule(location)) break; - case 216: + case 218: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 246 || - (location.kind === 216 && location.name.kind === 9)) { + if (location.kind === 248 || + (location.kind === 218 && location.name.kind === 9)) { if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 228)) { + ts.getDeclarationOfKind(moduleExports[name], 230)) { break; } result = moduleExports["default"]; @@ -10563,13 +10807,13 @@ var ts; break loop; } break; - case 215: + case 217: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 139: - case 138: + case 141: + case 140: if (ts.isClassLike(location.parent) && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -10579,9 +10823,9 @@ var ts; } } break; - case 212: - case 184: - case 213: + case 214: + case 186: + case 215: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -10589,7 +10833,7 @@ var ts; } break loop; } - if (location.kind === 184 && meaning & 32) { + if (location.kind === 186 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -10597,28 +10841,28 @@ var ts; } } break; - case 134: + case 136: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 213) { + if (ts.isClassLike(grandparent) || grandparent.kind === 215) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 172: + case 145: + case 146: + case 213: + case 174: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 171: + case 173: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -10631,8 +10875,8 @@ var ts; } } break; - case 137: - if (location.parent && location.parent.kind === 136) { + case 139: + if (location.parent && location.parent.kind === 138) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -10658,8 +10902,11 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2 && result.flags & 2) { - checkResolvedBlockScopedVariable(result, errorLocation); + if (meaning & 2) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } } } return result; @@ -10668,21 +10915,7 @@ var ts; ts.Debug.assert((result.flags & 2) !== 0); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 209); - var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 191 || - variableDeclaration.parent.parent.kind === 197) { - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); - } - else if (variableDeclaration.parent.parent.kind === 199 || - variableDeclaration.parent.parent.kind === 198) { - var expression = variableDeclaration.parent.parent.expression; - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); - } - } - if (isUsedBeforeDeclaration) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -10699,10 +10932,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 219) { + if (node.kind === 221) { return node; } - while (node && node.kind !== 220) { + while (node && node.kind !== 222) { node = node.parent; } return node; @@ -10712,7 +10945,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 230) { + if (node.moduleReference.kind === 232) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -10801,17 +11034,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 219: - return getTargetOfImportEqualsDeclaration(node); case 221: + return getTargetOfImportEqualsDeclaration(node); + case 223: return getTargetOfImportClause(node); - case 222: - return getTargetOfNamespaceImport(node); case 224: + return getTargetOfNamespaceImport(node); + case 226: return getTargetOfImportSpecifier(node); - case 228: + case 230: return getTargetOfExportSpecifier(node); - case 225: + case 227: return getTargetOfExportAssignment(node); } } @@ -10853,10 +11086,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 225) { + if (node.kind === 227) { checkExpressionCached(node.expression); } - else if (node.kind === 228) { + else if (node.kind === 230) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -10866,17 +11099,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 219); + importDeclaration = ts.getAncestor(entityName, 221); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 67 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 67 || entityName.parent.kind === 133) { + if (entityName.kind === 69 || entityName.parent.kind === 135) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 219); + ts.Debug.assert(entityName.parent.kind === 221); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -10888,16 +11121,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 67) { + if (name.kind === 69) { var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 133 || name.kind === 164) { - var left = name.kind === 133 ? name.left : name.expression; - var right = name.kind === 133 ? name.right : name.name; + else if (name.kind === 135 || name.kind === 166) { + var left = name.kind === 135 ? name.left : name.expression; + var right = name.kind === 135 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -10916,9 +11149,6 @@ var ts; ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } - function isExternalModuleNameRelative(moduleName) { - return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; - } function resolveExternalModuleName(location, moduleReferenceExpression) { if (moduleReferenceExpression.kind !== 9) { return; @@ -10929,7 +11159,10 @@ var ts; if (moduleName === undefined) { return; } - var isRelative = isExternalModuleNameRelative(moduleName); + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } + var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); if (symbol) { @@ -11033,7 +11266,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 142 && ts.nodeIsPresent(member.body)) { + if (member.kind === 144 && ts.nodeIsPresent(member.body)) { return member; } } @@ -11098,17 +11331,17 @@ var ts; } } switch (location_1.kind) { - case 246: - if (!ts.isExternalModule(location_1)) { + case 248: + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 216: + case 218: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 212: - case 213: + case 214: + case 215: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11141,7 +11374,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11170,7 +11403,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11225,8 +11458,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 216 && declaration.name.kind === 9) || - (declaration.kind === 246 && ts.isExternalModule(declaration)); + return (declaration.kind === 218 && declaration.name.kind === 9) || + (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11258,11 +11491,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 152) { + if (entityName.parent.kind === 154) { meaning = 107455 | 1048576; } - else if (entityName.kind === 133 || entityName.kind === 164 || - entityName.parent.kind === 219) { + else if (entityName.kind === 135 || entityName.kind === 166 || + entityName.parent.kind === 221) { meaning = 1536; } else { @@ -11313,10 +11546,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 158) { + while (node.kind === 160) { node = node.parent; } - if (node.kind === 214) { + if (node.kind === 216) { return getSymbolOfNode(node); } } @@ -11330,10 +11563,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 184: + case 186: return "(Anonymous class)"; - case 171: - case 172: + case 173: + case 174: return "(Anonymous function)"; } } @@ -11394,6 +11627,7 @@ var ts; } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16; + var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 16777343) { @@ -11401,6 +11635,12 @@ var ts; ? "any" : type.intrinsicName); } + else if (type.flags & 33554432) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } else if (type.flags & 4096) { writeTypeReference(type, flags); } @@ -11439,9 +11679,9 @@ var ts; writeType(types[i], delimiter === 24 ? 0 : 64); } } - function writeSymbolTypeReference(symbol, typeArguments, pos, end) { - if (!isReservedMemberName(symbol.name)) { - buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056); + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056, 0, flags); } if (pos < end) { writePunctuation(writer, 25); @@ -11455,7 +11695,7 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments; + var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1)) { writeType(typeArguments[0], 64); writePunctuation(writer, 19); @@ -11473,12 +11713,13 @@ var ts; i++; } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i); + writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); writePunctuation(writer, 21); } } } - writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length); + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } function writeTupleType(type) { @@ -11490,7 +11731,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeTypeList(type.types, type.flags & 16384 ? 46 : 45); + writeTypeList(type.types, type.flags & 16384 ? 47 : 46); if (flags & 64) { writePunctuation(writer, 18); } @@ -11510,7 +11751,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 115); + writeKeyword(writer, 117); } } else { @@ -11531,7 +11772,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 246 || declaration.parent.kind === 217; + return declaration.parent.kind === 248 || declaration.parent.kind === 219; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -11540,7 +11781,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 99); + writeKeyword(writer, 101); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } @@ -11574,7 +11815,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { @@ -11583,6 +11824,8 @@ var ts; return; } } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; writePunctuation(writer, 15); writer.writeLine(); writer.increaseIndent(); @@ -11594,7 +11837,7 @@ var ts; } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -11603,11 +11846,11 @@ var ts; if (resolved.stringIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 128); + writeKeyword(writer, 130); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.stringIndexType, 0); writePunctuation(writer, 23); @@ -11616,11 +11859,11 @@ var ts; if (resolved.numberIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 126); + writeKeyword(writer, 128); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.numberIndexType, 0); writePunctuation(writer, 23); @@ -11635,7 +11878,7 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -11645,9 +11888,9 @@ var ts; else { buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(t, 0); writePunctuation(writer, 23); @@ -11656,6 +11899,7 @@ var ts; } writer.decreaseIndent(); writePunctuation(writer, 16); + inObjectTypeLiteral = saveInObjectTypeLiteral; } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -11669,7 +11913,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 81); + writeKeyword(writer, 83); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -11681,9 +11925,9 @@ var ts; } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } @@ -11730,14 +11974,14 @@ var ts; writePunctuation(writer, 34); } else { - writePunctuation(writer, 53); + writePunctuation(writer, 54); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 122); + writeKeyword(writer, 124); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -11771,13 +12015,13 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 216) { + if (node.kind === 218) { if (node.name.kind === 9) { return node; } } - else if (node.kind === 246) { - return ts.isExternalModule(node) ? node : undefined; + else if (node.kind === 248) { + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -11819,59 +12063,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 161: + case 163: return isDeclarationVisible(node.parent.parent); - case 209: + case 211: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 216: - case 212: - case 213: + case 218: case 214: - case 211: case 215: - case 219: + case 216: + case 213: + case 217: + case 221: var parent_4 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 219 && parent_4.kind !== 246 && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } return isDeclarationVisible(parent_4); - case 139: - case 138: - case 143: - case 144: case 141: case 140: + case 145: + case 146: + case 143: + case 142: if (node.flags & (32 | 64)) { return false; } - case 142: - case 146: - case 145: + case 144: + case 148: case 147: - case 136: - case 217: - case 150: - case 151: - case 153: case 149: - case 154: + case 138: + case 219: + case 152: + case 153: case 155: + case 151: case 156: case 157: case 158: + case 159: + case 160: return isDeclarationVisible(node.parent); - case 221: - case 222: + case 223: case 224: + case 226: return false; - case 135: - case 246: + case 137: + case 248: return true; - case 225: + case 227: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -11887,10 +12131,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 225) { + if (node.parent && node.parent.kind === 227) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 230) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -11965,7 +12209,7 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 209 ? node.parent.parent.parent : node.parent; + return node.kind === 211 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -11978,9 +12222,13 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + var parentType = getTypeForBindingElementParent(pattern.parent); if (parentType === unknownType) { return unknownType; } @@ -11991,7 +12239,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 159) { + if (pattern.kind === 161) { var name_10 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_10.text) || isNumericLiteralName(name_10.text) && getIndexTypeOfType(parentType, 1) || @@ -12025,10 +12273,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 198) { + if (declaration.parent.parent.kind === 200) { return anyType; } - if (declaration.parent.parent.kind === 199) { + if (declaration.parent.parent.kind === 201) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -12037,10 +12285,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var func = declaration.parent; - if (func.kind === 144 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143); + if (func.kind === 146 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12053,7 +12301,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 244) { + if (declaration.kind === 246) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -12091,7 +12339,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 185 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 187 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -12100,7 +12348,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 159 + return pattern.kind === 161 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -12110,12 +12358,12 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 243 ? getWidenedType(type) : type; + return declaration.kind !== 245 ? getWidenedType(type) : type; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 136 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 138 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12128,12 +12376,18 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 242) { + if (declaration.parent.kind === 244) { return links.type = anyType; } - if (declaration.kind === 225) { + if (declaration.kind === 227) { return links.type = checkExpression(declaration.expression); } + if (declaration.kind === 181) { + return links.type = checkExpression(declaration.right); + } + if (declaration.kind === 166) { + return checkExpressionCached(declaration.parent.right); + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } @@ -12156,7 +12410,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 143) { + if (accessor.kind === 145) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12172,8 +12426,8 @@ var ts; if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 143); - var setter = ts.getDeclarationOfKind(symbol, 144); + var getter = ts.getDeclarationOfKind(symbol, 145); + var setter = ts.getDeclarationOfKind(symbol, 146); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -12199,7 +12453,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 143); + var getter_1 = ts.getDeclarationOfKind(symbol, 145); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -12288,9 +12542,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 212 || node.kind === 184 || - node.kind === 211 || node.kind === 171 || - node.kind === 141 || node.kind === 172) { + if (node.kind === 214 || node.kind === 186 || + node.kind === 213 || node.kind === 173 || + node.kind === 143 || node.kind === 174) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -12299,15 +12553,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 213 || node.kind === 212 || - node.kind === 184 || node.kind === 214) { + if (node.kind === 215 || node.kind === 214 || + node.kind === 186 || node.kind === 216) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -12412,7 +12666,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 213 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -12433,6 +12687,29 @@ var ts; } } } + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 215) { + if (declaration.flags & 524288) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0; _b < baseTypeNodes.length; _b++) { + var node = baseTypeNodes[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056, true); + if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -12440,7 +12717,7 @@ var ts; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - if (outerTypeParameters || localTypeParameters) { + if (outerTypeParameters || localTypeParameters || kind === 1024 || !isIndependentInterface(symbol)) { type.flags |= 4096; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; @@ -12449,6 +12726,9 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; + type.thisType = createType(512 | 33554432); + type.thisType.symbol = symbol; + type.thisType.constraint = getTypeWithThisArgument(type); } } return links.declaredType; @@ -12459,7 +12739,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 214); + var declaration = ts.getDeclarationOfKind(symbol, 216); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -12490,7 +12770,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 135).constraint) { + if (!ts.getDeclarationOfKind(symbol, 137).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -12523,6 +12803,66 @@ var ts; } return unknownType; } + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + function isIndependentType(node) { + switch (node.kind) { + case 117: + case 130: + case 128: + case 120: + case 131: + case 103: + case 9: + return true; + case 156: + return isIndependentType(node.elementType); + case 151: + return isIndependentTypeReference(node); + } + return false; + } + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 144 && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 141: + case 140: + return isIndependentVariableLikeDeclaration(declaration); + case 143: + case 142: + case 144: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } function createSymbolTable(symbols) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { @@ -12531,11 +12871,11 @@ var ts; } return result; } - function createInstantiatedSymbolTable(symbols, mapper) { + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; - result[symbol.name] = instantiateSymbol(symbol, mapper); + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } @@ -12566,44 +12906,54 @@ var ts; } return type; } - function resolveClassOrInterfaceMembers(type) { - var target = resolveDeclaredMembers(type); - var members = target.symbol.members; - var callSignatures = target.declaredCallSignatures; - var constructSignatures = target.declaredConstructSignatures; - var stringIndexType = target.declaredStringIndexType; - var numberIndexType = target.declaredNumberIndexType; - var baseTypes = getBaseTypes(target); + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexType = source.declaredStringIndexType; + var numberIndexType = source.declaredNumberIndexType; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexType = instantiateType(source.declaredStringIndexType, mapper); + numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + } + var baseTypes = getBaseTypes(source); if (baseTypes.length) { - members = createSymbolTable(target.declaredProperties); + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0; _i < baseTypes.length; _i++) { var baseType = baseTypes[_i]; - addInheritedMembers(members, getPropertiesOfObjectType(baseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1); + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); } } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } function resolveTypeReferenceMembers(type) { - var target = resolveDeclaredMembers(type.target); - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; - ts.forEach(getBaseTypes(target), function (baseType) { - var instantiatedBaseType = instantiateType(baseType, mapper); - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); - }); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); @@ -12652,7 +13002,8 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true))); + var arrayElementType = getUnionType(type.elementTypes, true); + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -12754,7 +13105,14 @@ var ts; var constructSignatures; var stringIndexType; var numberIndexType; - if (symbol.flags & 2048) { + if (type.target) { + members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0), type.mapper); + numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1), type.mapper); + } + else if (symbol.flags & 2048) { members = symbol.members; callSignatures = getSignaturesOfSymbol(members["__call"]); constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -12790,7 +13148,10 @@ var ts; } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 | 2048)) { + if (type.flags & 4096) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 | 2048)) { resolveClassOrInterfaceMembers(type); } else if (type.flags & 65536) { @@ -12805,9 +13166,6 @@ var ts; else if (type.flags & 32768) { resolveIntersectionTypeMembers(type); } - else { - resolveTypeReferenceMembers(type); - } } return type; } @@ -13014,7 +13372,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 142 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 144 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13045,7 +13403,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 148) { + if (declaration.type.kind === 150) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -13055,8 +13413,8 @@ var ts; } } else { - if (declaration.kind === 143 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 144); + if (declaration.kind === 145 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 146); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13074,19 +13432,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 150: - case 151: - case 211: - case 141: - case 140: + case 152: + case 153: + case 213: + case 143: case 142: + case 144: + case 147: + case 148: + case 149: case 145: case 146: - case 147: - case 143: - case 144: - case 171: - case 172: + case 173: + case 174: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -13098,6 +13456,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3)) { @@ -13156,7 +13524,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 142 || signature.declaration.kind === 146; + var isConstructor = signature.declaration.kind === 144 || signature.declaration.kind === 148; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -13170,7 +13538,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 126 : 128; + var syntaxKind = kind === 1 ? 128 : 130; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -13199,30 +13567,33 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137).parent); } function getTypeListId(types) { - switch (types.length) { - case 1: - return "" + types[0].id; - case 2: - return types[0].id + "," + types[1].id; - default: - var result = ""; - for (var i = 0; i < types.length; i++) { - if (i > 0) { - result += ","; + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; } - result += types[i].id; - } - return result; + return result; + } } + return ""; } function getPropagatingFlagsOfTypes(types) { var result = 0; @@ -13236,7 +13607,7 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | getPropagatingFlagsOfTypes(typeArguments); + var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -13252,13 +13623,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 149 && n.typeName.kind === 67) { + if (n.kind === 151 && n.typeName.kind === 69) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -13325,7 +13696,7 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 149 ? node.typeName : + var typeNameOrExpression = node.kind === 151 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -13351,9 +13722,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 212: - case 213: + case 214: case 215: + case 217: return declaration; } } @@ -13390,10 +13761,13 @@ var ts; return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056, undefined), arity); } function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); - var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); + var typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace, name) { + var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 | 107455); + } function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -13403,17 +13777,17 @@ var ts; ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } - function createTypeFromGenericGlobalType(genericGlobalType, elementType) { - return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType; + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, elementType); + return createTypeFromGenericGlobalType(globalIterableType, [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType); + return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); } function createArrayType(elementType) { - return createTypeFromGenericGlobalType(globalArrayType, elementType); + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -13570,46 +13944,66 @@ var ts; } return links.resolvedType; } + function getThisType(node) { + var container = ts.getThisContainer(node, false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { + if (!(container.flags & 128)) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } function getTypeFromTypeNode(node) { switch (node.kind) { - case 115: + case 117: return anyType; - case 128: + case 130: return stringType; - case 126: + case 128: return numberType; - case 118: + case 120: return booleanType; - case 129: + case 131: return esSymbolType; - case 101: + case 103: return voidType; + case 97: + return getTypeFromThisTypeNode(node); case 9: return getTypeFromStringLiteral(node); - case 149: - return getTypeFromTypeReference(node); - case 148: - return booleanType; - case 186: - return getTypeFromTypeReference(node); - case 152: - return getTypeFromTypeQueryNode(node); - case 154: - return getTypeFromArrayTypeNode(node); - case 155: - return getTypeFromTupleTypeNode(node); - case 156: - return getTypeFromUnionTypeNode(node); - case 157: - return getTypeFromIntersectionTypeNode(node); - case 158: - return getTypeFromTypeNode(node.type); - case 150: case 151: + return getTypeFromTypeReference(node); + case 150: + return booleanType; + case 188: + return getTypeFromTypeReference(node); + case 154: + return getTypeFromTypeQueryNode(node); + case 156: + return getTypeFromArrayTypeNode(node); + case 157: + return getTypeFromTupleTypeNode(node); + case 158: + return getTypeFromUnionTypeNode(node); + case 159: + return getTypeFromIntersectionTypeNode(node); + case 160: + return getTypeFromTypeNode(node.type); + case 152: case 153: + case 155: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 67: - case 133: + case 69: + case 135: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -13713,7 +14107,7 @@ var ts; type: instantiateType(signature.typePredicate.type, mapper) }; } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -13745,21 +14139,13 @@ var ts; mapper.instantiations = []; } var result = createObjectType(65536 | 131072, type.symbol); - result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); - result.members = createSymbolTable(result.properties); - result.callSignatures = instantiateList(getSignaturesOfType(type, 0), mapper, instantiateSignature); - result.constructSignatures = instantiateList(getSignaturesOfType(type, 1), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, 0); - var numberIndexType = getIndexTypeOfType(type, 1); - if (stringIndexType) - result.stringIndexType = instantiateType(stringIndexType, mapper); - if (numberIndexType) - result.numberIndexType = instantiateType(numberIndexType, mapper); + result.target = type; + result.mapper = mapper; mapper.instantiations[type.id] = result; return result; } function instantiateType(type, mapper) { - if (mapper !== identityMapper) { + if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } @@ -13783,27 +14169,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 171: - case 172: + case 173: + case 174: return isContextSensitiveFunctionLikeDeclaration(node); - case 163: + case 165: return ts.forEach(node.properties, isContextSensitive); - case 162: + case 164: return ts.forEach(node.elements, isContextSensitive); - case 180: + case 182: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 179: - return node.operatorToken.kind === 51 && + case 181: + return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 243: + case 245: return isContextSensitive(node.initializer); - case 141: - case 140: + case 143: + case 142: return isContextSensitiveFunctionLikeDeclaration(node); - case 170: + case 172: return isContextSensitive(node.expression); } return false; @@ -13956,7 +14342,7 @@ var ts; } else { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; } } @@ -13978,7 +14364,7 @@ var ts; var result; if (source.flags & 80896 && target.flags & 80896) { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, false)) { + if (result = typeArgumentsRelatedTo(source, target, false)) { return result; } } @@ -14088,9 +14474,14 @@ var ts; } return result; } - function typesRelatedTo(sources, targets, reportErrors) { + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0; + } var result = -1; - for (var i = 0, len = sources.length; i < len; i++) { + for (var i = 0; i < targets.length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; @@ -14741,22 +15132,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 139: - case 138: + case 141: + case 140: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 136: + case 138: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 211: - case 141: - case 140: + case 213: case 143: - case 144: - case 171: - case 172: + case 142: + case 145: + case 146: + case 173: + case 174: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -14852,9 +15243,10 @@ var ts; } } else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - var sourceTypes = source.typeArguments; - var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } @@ -15008,10 +15400,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 152: + case 154: return true; - case 67: - case 133: + case 69: + case 135: node = node.parent; continue; default: @@ -15051,12 +15443,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 55 && node.operatorToken.kind <= 66) { + if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { var n = node.left; - while (n.kind === 170) { + while (n.kind === 172) { n = n.expression; } - if (n.kind === 67 && getResolvedSymbol(n) === symbol) { + if (n.kind === 69 && getResolvedSymbol(n) === symbol) { return true; } } @@ -15070,55 +15462,55 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 179: + case 181: return isAssignedInBinaryExpression(node); - case 209: - case 161: - return isAssignedInVariableDeclaration(node); - case 159: - case 160: - case 162: + case 211: case 163: + return isAssignedInVariableDeclaration(node); + case 161: + case 162: case 164: case 165: case 166: case 167: + case 168: case 169: - case 187: - case 170: - case 177: - case 173: - case 176: - case 174: + case 171: + case 189: + case 172: + case 179: case 175: case 178: - case 182: + case 176: + case 177: case 180: - case 183: - case 190: - case 191: + case 184: + case 182: + case 185: + case 192: case 193: - case 194: case 195: case 196: case 197: case 198: case 199: - case 202: - case 203: + case 200: + case 201: case 204: - case 239: - case 240: case 205: case 206: - case 207: + case 241: case 242: - case 231: - case 232: - case 236: - case 237: + case 207: + case 208: + case 209: + case 244: case 233: + case 234: case 238: + case 239: + case 235: + case 240: return ts.forEachChild(node, isAssignedIn); } return false; @@ -15133,34 +15525,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 194: + case 196: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 180: + case 182: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 179: + case 181: if (child === node.right) { - if (node.operatorToken.kind === 50) { + if (node.operatorToken.kind === 51) { narrowedType = narrowType(type, node.left, true); } - else if (node.operatorToken.kind === 51) { + else if (node.operatorToken.kind === 52) { narrowedType = narrowType(type, node.left, false); } } break; - case 246: - case 216: - case 211: - case 141: - case 140: + case 248: + case 218: + case 213: case 143: - case 144: case 142: + case 145: + case 146: + case 144: break loop; } if (narrowedType !== type) { @@ -15174,12 +15566,12 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 174 || expr.right.kind !== 9) { + if (expr.left.kind !== 176 || expr.right.kind !== 9) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 67 || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; @@ -15225,7 +15617,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -15289,27 +15681,27 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 166: + case 168: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 170: + case 172: return narrowType(type, expr.expression, assumeTrue); - case 179: + case 181: var operator = expr.operatorToken.kind; if (operator === 32 || operator === 33) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 50) { + else if (operator === 51) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 51) { + else if (operator === 52) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 89) { + else if (operator === 91) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 177: - if (expr.operator === 48) { + case 179: + if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -15321,7 +15713,7 @@ var ts; var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 172) { + if (container.kind === 174) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -15352,15 +15744,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 242) { + symbol.valueDeclaration.parent.kind === 244) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 210) { + while (container.kind !== 212) { container = container.parent; } container = container.parent; - if (container.kind === 191) { + if (container.kind === 193) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -15378,7 +15770,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 139 || container.kind === 142) { + if (container.kind === 141 || container.kind === 144) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -15389,29 +15781,29 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 172) { + if (container.kind === 174) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 216: + case 218: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 215: + case 217: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 142: + case 144: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 139: - case 138: + case 141: + case 140: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 134: + case 136: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -15420,27 +15812,27 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 136) { + if (n.kind === 138) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 166 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 168 && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 172) { + while (container && container.kind === 174) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -15466,7 +15858,7 @@ var ts; return unknownType; } if (!canUseSuperExpression) { - if (container && container.kind === 134) { + if (container && container.kind === 136) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -15477,7 +15869,7 @@ var ts; } return unknownType; } - if (container.kind === 142 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 144 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -15489,24 +15881,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 142; + return container.kind === 144; } else { if (container && ts.isClassLike(container.parent)) { if (container.flags & 128) { - return container.kind === 141 || - container.kind === 140 || - container.kind === 143 || - container.kind === 144; + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146; } else { - return container.kind === 141 || + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146 || + container.kind === 141 || container.kind === 140 || - container.kind === 143 || - container.kind === 144 || - container.kind === 139 || - container.kind === 138 || - container.kind === 142; + container.kind === 144; } } } @@ -15540,7 +15932,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -15573,7 +15965,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 136 && node.parent.initializer === node) { + if (node.parent.kind === 138 && node.parent.initializer === node) { return true; } node = node.parent; @@ -15582,8 +15974,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 142 || - functionDecl.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144))) { + functionDecl.kind === 144 || + functionDecl.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -15602,7 +15994,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 168) { + if (template.parent.kind === 170) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -15610,12 +16002,12 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 55 && operator <= 66) { + if (operator >= 56 && operator <= 68) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 51) { + else if (operator === 52) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -15702,7 +16094,7 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 236) { + if (expr.parent.kind === 238) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -15712,7 +16104,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 237) { + if (expr.kind === 239) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -15730,38 +16122,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 209: - case 136: - case 139: + case 211: case 138: - case 161: + case 141: + case 140: + case 163: return getContextualTypeForInitializerExpression(node); - case 172: - case 202: + case 174: + case 204: return getContextualTypeForReturnExpression(node); - case 182: + case 184: return getContextualTypeForYieldOperand(parent); - case 166: - case 167: - return getContextualTypeForArgument(parent, node); + case 168: case 169: - case 187: + return getContextualTypeForArgument(parent, node); + case 171: + case 189: return getTypeFromTypeNode(parent.type); - case 179: + case 181: return getContextualTypeForBinaryOperand(node); - case 243: + case 245: return getContextualTypeForObjectLiteralElement(parent); - case 162: + case 164: return getContextualTypeForElementExpression(node); - case 180: + case 182: return getContextualTypeForConditionalOperand(node); - case 188: - ts.Debug.assert(parent.parent.kind === 181); + case 190: + ts.Debug.assert(parent.parent.kind === 183); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 170: + case 172: return getContextualType(parent); - case 238: - case 237: + case 240: + case 239: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -15776,7 +16168,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 171 || node.kind === 172; + return node.kind === 173 || node.kind === 174; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -15784,7 +16176,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -15824,13 +16216,13 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 179 && parent.operatorToken.kind === 55 && parent.left === node) { + if (parent.kind === 181 && parent.operatorToken.kind === 56 && parent.left === node) { return true; } - if (parent.kind === 243) { + if (parent.kind === 245) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 162) { + if (parent.kind === 164) { return isAssignmentTarget(parent); } return false; @@ -15840,8 +16232,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 161 && !!node.initializer) || - (node.kind === 179 && node.operatorToken.kind === 55); + return (node.kind === 163 && !!node.initializer) || + (node.kind === 181 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -15850,7 +16242,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 183) { + if (inDestructuringPattern && e.kind === 185) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -15862,7 +16254,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 183; + hasSpreadElement = hasSpreadElement || e.kind === 185; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -15873,7 +16265,7 @@ var ts; var contextualType = getContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 160 || pattern.kind === 162)) { + if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -15881,7 +16273,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 185) { + if (patternElement.kind !== 187) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -15896,7 +16288,7 @@ var ts; return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { - return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 136 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -15921,35 +16313,37 @@ var ts; return links.resolvedType; } function checkObjectLiteral(node, contextualMapper) { - checkGrammarObjectLiteralExpression(node); + var inDestructuringPattern = isAssignmentTarget(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 159 || contextualType.pattern.kind === 163); - var inDestructuringPattern = isAssignmentTarget(node); + (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 243 || - memberDecl.kind === 244 || + if (memberDecl.kind === 245 || + memberDecl.kind === 246 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 243) { + if (memberDecl.kind === 245) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 141) { + else if (memberDecl.kind === 143) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 244); + ts.Debug.assert(memberDecl.kind === 246); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - if (memberDecl.kind === 243 && hasDefaultValue(memberDecl.initializer)) { + var isOptional = (memberDecl.kind === 245 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 246 && memberDecl.objectAssignmentInitializer); + if (isOptional) { prop.flags |= 536870912; } } @@ -15972,7 +16366,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 143 || memberDecl.kind === 144); + ts.Debug.assert(memberDecl.kind === 145 || memberDecl.kind === 146); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16028,7 +16422,7 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 67) { + if (lhs.kind === 69) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && @@ -16045,17 +16439,17 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 238: + case 240: checkJsxExpression(child); break; - case 231: + case 233: checkJsxElement(child); break; - case 232: + case 234: checkJsxSelfClosingElement(child); break; default: - ts.Debug.assert(child.kind === 234); + ts.Debug.assert(child.kind === 236); } } return jsxElementType || anyType; @@ -16064,7 +16458,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 133) { + if (tagName.kind === 135) { return false; } else { @@ -16165,12 +16559,14 @@ var ts; var valueSymbol = resolveJsxTagName(node); if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4; - getSymbolLinks(valueSymbol).referenced = true; + if (valueSymbol.flags & 8388608) { + markAliasSymbolAsReferenced(valueSymbol); + } } return valueSymbol || unknownSymbol; } function resolveJsxTagName(node) { - if (node.tagName.kind === 67) { + if (node.tagName.kind === 69) { var tag = node.tagName; var sym = getResolvedSymbol(tag); return sym.exportSymbol || sym; @@ -16310,11 +16706,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 236) { + if (node.attributes[i].kind === 238) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 237); + ts.Debug.assert(node.attributes[i].kind === 239); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -16340,7 +16736,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 139; + return s.valueDeclaration ? s.valueDeclaration.kind : 141; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -16348,11 +16744,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 93) { - var errorNode = node.kind === 164 ? + if (left.kind === 95) { + var errorNode = node.kind === 166 ? node.name : node.right; - if (getDeclarationKindFromSymbol(prop) !== 141) { + if (getDeclarationKindFromSymbol(prop) !== 143) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -16373,7 +16769,7 @@ var ts; } return true; } - if (left.kind === 93) { + if (left.kind === 95) { return true; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -16383,6 +16779,9 @@ var ts; if (flags & 128) { return true; } + if (type.flags & 33554432) { + type = getConstraintOfTypeParameter(type); + } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; @@ -16407,18 +16806,18 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 ? apparentType : type)); } return unknownType; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, type, prop); + checkClassPropertyAccess(node, left, apparentType, prop); } return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 164 + var left = node.kind === 166 ? node.expression : node.left; var type = checkExpression(left); @@ -16433,7 +16832,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 167 && node.parent.expression === node) { + if (node.parent.kind === 169 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -16492,6 +16891,12 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } + if (indexArgumentExpression.kind === 167 || indexArgumentExpression.kind === 166) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); @@ -16529,10 +16934,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 168) { + if (node.kind === 170) { checkExpression(node.template); } - else if (node.kind !== 137) { + else if (node.kind !== 139) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -16583,7 +16988,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 183) { + if (arg && arg.kind === 185) { return i; } } @@ -16595,11 +17000,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 168) { + if (node.kind === 170) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 181) { + if (tagExpression.template.kind === 183) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -16611,7 +17016,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 137) { + else if (node.kind === 139) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -16619,7 +17024,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 167); + ts.Debug.assert(callExpression.kind === 169); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -16672,7 +17077,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -16719,7 +17124,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -16738,16 +17143,16 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 168) { + if (node.kind === 170) { var template = node.template; args = [undefined]; - if (template.kind === 181) { + if (template.kind === 183) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 137) { + else if (node.kind === 139) { return undefined; } else { @@ -16756,18 +17161,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 137) { + if (node.kind === 139) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return 1; - case 139: - return 2; case 141: + return 2; case 143: - case 144: + case 145: + case 146: + if (languageVersion === 0) { + return 2; + } return signature.parameters.length >= 3 ? 3 : 2; - case 136: + case 138: return 3; } } @@ -16777,20 +17185,20 @@ var ts; } function getEffectiveDecoratorFirstArgumentType(node) { switch (node.kind) { - case 212: - case 184: + case 214: + case 186: var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 136: + case 138: node = node.parent; - if (node.kind === 142) { + if (node.kind === 144) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } - case 139: case 141: case 143: - case 144: + case 145: + case 146: return getParentTypeOfClassElement(node); default: ts.Debug.fail("Unsupported decorator target."); @@ -16799,25 +17207,25 @@ var ts; } function getEffectiveDecoratorSecondArgumentType(node) { switch (node.kind) { - case 212: + case 214: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 136: + case 138: node = node.parent; - if (node.kind === 142) { + if (node.kind === 144) { return anyType; } - case 139: case 141: case 143: - case 144: + case 145: + case 146: var element = node; switch (element.name.kind) { - case 67: + case 69: case 8: case 9: return getStringLiteralType(element.name); - case 134: + case 136: var nameType = checkComputedPropertyName(element.name); if (allConstituentTypesHaveKind(nameType, 16777216)) { return nameType; @@ -16836,17 +17244,17 @@ var ts; } function getEffectiveDecoratorThirdArgumentType(node) { switch (node.kind) { - case 212: + case 214: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 136: + case 138: return numberType; - case 139: + case 141: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 141: case 143: - case 144: + case 145: + case 146: var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); default: @@ -16868,26 +17276,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return globalTemplateStringsArrayType; } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 137 || - (argIndex === 0 && node.kind === 168)) { + if (node.kind === 139 || + (argIndex === 0 && node.kind === 170)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return node.expression; } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return node.template; } else { @@ -16895,12 +17303,12 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 168; - var isDecorator = node.kind === 137; + var isTaggedTemplate = node.kind === 170; + var isDecorator = node.kind === 139; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; - if (node.expression.kind !== 93) { + if (node.expression.kind !== 95) { ts.forEach(typeArguments, checkSourceElement); } } @@ -17038,7 +17446,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); @@ -17127,16 +17535,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 136: + case 138: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 139: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 141: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 143: - case 144: + case 145: + case 146: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -17164,16 +17572,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 166) { + if (node.kind === 168) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 167) { + else if (node.kind === 169) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 168) { + else if (node.kind === 170) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 137) { + else if (node.kind === 139) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -17185,21 +17593,24 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { return voidType; } - if (node.kind === 167) { + if (node.kind === 169) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 142 && - declaration.kind !== 146 && - declaration.kind !== 151) { + declaration.kind !== 144 && + declaration.kind !== 148 && + declaration.kind !== 153) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -17234,10 +17645,22 @@ var ts; assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } } + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 187) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + assignBindingElementTypes(element); + } + } + } + } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); @@ -17258,7 +17681,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 190) { + if (func.body.kind !== 192) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -17362,7 +17785,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 206); + return (body.statements.length === 1) && (body.statements[0].kind === 208); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -17371,7 +17794,7 @@ var ts; if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 190) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192) { return; } var bodyBlock = func.body; @@ -17384,9 +17807,9 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 171) { + if (!hasGrammarError && node.kind === 173) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -17422,14 +17845,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 141 && node.kind !== 140) { + if (produceDiagnostics && node.kind !== 143 && node.kind !== 142) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -17446,7 +17869,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 190) { + if (node.body.kind === 192) { checkSourceElement(node.body); } else { @@ -17478,17 +17901,17 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 67: { + case 69: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 164: { + case 166: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 165: + case 167: return true; - case 170: + case 172: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17496,12 +17919,12 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 67: - case 164: { + case 69: + case 166: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; } - case 165: { + case 167: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 9) { @@ -17511,7 +17934,7 @@ var ts; } return false; } - case 170: + case 172: return isConstVariableReference(n.expression); default: return false; @@ -17556,15 +17979,15 @@ var ts; switch (node.operator) { case 35: case 36: - case 49: + case 50: if (someConstituentTypeHasKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 48: + case 49: return booleanType; - case 40: case 41: + case 42: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); @@ -17619,21 +18042,21 @@ var ts; function isConstEnumSymbol(symbol) { return (symbol.flags & 128) !== 0; } - function checkInstanceOfExpression(node, leftType, rightType) { + function checkInstanceOfExpression(left, right, leftType, rightType) { if (allConstituentTypesHaveKind(leftType, 16777726)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } - function checkInExpression(node, leftType, rightType) { + function checkInExpression(left, right, leftType, rightType) { if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } @@ -17641,7 +18064,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 243 || p.kind === 244) { + if (p.kind === 245 || p.kind === 246) { var name_13 = p.name; var type = isTypeAny(sourceType) ? sourceType @@ -17649,7 +18072,12 @@ var ts; isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name_13, type); + if (p.kind === 246) { + checkDestructuringAssignment(p, type); + } + else { + checkDestructuringAssignment(p.initializer || name_13, type); + } } else { error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); @@ -17666,8 +18094,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { + if (e.kind !== 187) { + if (e.kind !== 185) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -17692,7 +18120,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 179 && restExpression.operatorToken.kind === 55) { + if (restExpression.kind === 181 && restExpression.operatorToken.kind === 56) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -17704,15 +18132,26 @@ var ts; } return sourceType; } - function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 179 && target.operatorToken.kind === 55) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 246) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 181 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 163) { + if (target.kind === 165) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 162) { + if (target.kind === 164) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -17725,33 +18164,38 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - var operator = node.operatorToken.kind; - if (operator === 55 && (node.left.kind === 163 || node.left.kind === 162)) { - return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 && (left.kind === 165 || left.kind === 164)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); switch (operator) { case 37: - case 58: case 38: case 59: - case 39: case 60: - case 36: - case 57: - case 42: + case 39: case 61: - case 43: + case 40: case 62: - case 44: + case 36: + case 58: + case 43: case 63: - case 46: + case 44: + case 64: + case 45: case 65: case 47: + case 67: + case 48: + case 68: + case 46: case 66: - case 45: - case 64: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17759,19 +18203,19 @@ var ts; var suggestedOperator; if ((leftType.flags & 8) && (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { - var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } } return numberType; case 35: - case 56: + case 57: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17795,7 +18239,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 56) { + if (operator === 57) { checkAssignmentOperator(resultType); } return resultType; @@ -17814,23 +18258,23 @@ var ts; reportOperatorError(); } return booleanType; - case 89: - return checkInstanceOfExpression(node, leftType, rightType); - case 88: - return checkInExpression(node, leftType, rightType); - case 50: - return rightType; + case 91: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90: + return checkInExpression(left, right, leftType, rightType); case 51: + return rightType; + case 52: return getUnionType([leftType, rightType]); - case 55: + case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 24: return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? node.left : - someConstituentTypeHasKind(rightType, 16777216) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? left : + someConstituentTypeHasKind(rightType, 16777216) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -17840,29 +18284,29 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 46: - case 65: - return 51; case 47: - case 66: + case 67: + return 52; + case 48: + case 68: return 33; - case 45: - case 64: - return 50; + case 46: + case 66: + return 51; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 55 && operator <= 66) { - var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (produceDiagnostics && operator >= 56 && operator <= 68) { + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); if (ok) { - checkTypeAssignableTo(valueType, leftType, node.left, undefined); + checkTypeAssignableTo(valueType, leftType, left, undefined); } } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function isYieldExpressionInClass(node) { @@ -17938,14 +18382,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -17968,7 +18412,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 133) { + if (node.kind === 135) { type = checkQualifiedName(node); } else { @@ -17976,9 +18420,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 164 && node.parent.expression === node) || - (node.parent.kind === 165 && node.parent.expression === node) || - ((node.kind === 67 || node.kind === 133) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 166 && node.parent.expression === node) || + (node.parent.kind === 167 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 135) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -17991,78 +18435,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 67: + case 69: return checkIdentifier(node); - case 95: - return checkThisExpression(node); - case 93: - return checkSuperExpression(node); - case 91: - return nullType; case 97: - case 82: + return checkThisExpression(node); + case 95: + return checkSuperExpression(node); + case 93: + return nullType; + case 99: + case 84: return booleanType; case 8: return checkNumericLiteral(node); - case 181: + case 183: return checkTemplateExpression(node); case 9: case 11: return stringType; case 10: return globalRegExpType; - case 162: - return checkArrayLiteral(node, contextualMapper); - case 163: - return checkObjectLiteral(node, contextualMapper); case 164: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 165: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 166: + return checkPropertyAccessExpression(node); case 167: - return checkCallExpression(node); + return checkIndexedAccess(node); case 168: - return checkTaggedTemplateExpression(node); - case 170: - return checkExpression(node.expression, contextualMapper); - case 184: - return checkClassExpression(node); - case 171: - case 172: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 174: - return checkTypeOfExpression(node); case 169: - case 187: - return checkAssertion(node); + return checkCallExpression(node); + case 170: + return checkTaggedTemplateExpression(node); + case 172: + return checkExpression(node.expression, contextualMapper); + case 186: + return checkClassExpression(node); case 173: - return checkDeleteExpression(node); - case 175: - return checkVoidExpression(node); + case 174: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 176: - return checkAwaitExpression(node); + return checkTypeOfExpression(node); + case 171: + case 189: + return checkAssertion(node); + case 175: + return checkDeleteExpression(node); case 177: - return checkPrefixUnaryExpression(node); + return checkVoidExpression(node); case 178: - return checkPostfixUnaryExpression(node); + return checkAwaitExpression(node); case 179: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 180: - return checkConditionalExpression(node, contextualMapper); - case 183: - return checkSpreadElementExpression(node, contextualMapper); - case 185: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 181: + return checkBinaryExpression(node, contextualMapper); case 182: + return checkConditionalExpression(node, contextualMapper); + case 185: + return checkSpreadElementExpression(node, contextualMapper); + case 187: + return undefinedType; + case 184: return checkYieldExpression(node); - case 238: + case 240: return checkJsxExpression(node); - case 231: - return checkJsxElement(node); - case 232: - return checkJsxSelfClosingElement(node); case 233: + return checkJsxElement(node); + case 234: + return checkJsxSelfClosingElement(node); + case 235: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -18083,7 +18527,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 142 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18098,15 +18542,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 141 || - node.kind === 211 || - node.kind === 171; + return node.kind === 143 || + node.kind === 213 || + node.kind === 173; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 67 && + if (param.name.kind === 69 && param.name.text === parameter.text) { return i; } @@ -18116,30 +18560,30 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 172: - case 145: - case 211: - case 171: - case 150: - case 141: - case 140: + case 174: + case 147: + case 213: + case 173: + case 152: + case 143: + case 142: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { - if (node.kind === 147) { + if (node.kind === 149) { checkGrammarIndexSignature(node); } - else if (node.kind === 150 || node.kind === 211 || node.kind === 151 || - node.kind === 145 || node.kind === 142 || - node.kind === 146) { + else if (node.kind === 152 || node.kind === 213 || node.kind === 153 || + node.kind === 147 || node.kind === 144 || + node.kind === 148) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 148) { + if (node.type.kind === 150) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -18158,19 +18602,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 159 || - param.name.kind === 160) { + if (param.name.kind === 161 || + param.name.kind === 162) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 67 && + if (element.name.kind === 69 && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 160 || - element.name.kind === 159) { + else if (element.name.kind === 162 || + element.name.kind === 161) { checkBindingPattern(element.name); } } @@ -18194,10 +18638,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 146: + case 148: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 145: + case 147: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18219,7 +18663,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 213) { + if (node.kind === 215) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -18234,7 +18678,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 128: + case 130: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18242,7 +18686,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 126: + case 128: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18282,7 +18726,7 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 166 && n.expression.kind === 93; + return n.kind === 168 && n.expression.kind === 95; } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); @@ -18300,15 +18744,15 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 95) { + if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 171 && n.kind !== 211) { + else if (n.kind !== 173 && n.kind !== 213) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 139 && + return n.kind === 141 && !(n.flags & 128) && !!n.initializer; } @@ -18328,7 +18772,7 @@ var ts; var superCallStatement; for (var _i = 0; _i < statements.length; _i++) { var statement = statements[_i]; - if (statement.kind === 193 && isSuperCallExpression(statement.expression)) { + if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -18352,13 +18796,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 143) { + if (node.kind === 145) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 143 ? 144 : 143; + var otherKind = node.kind === 145 ? 146 : 145; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -18443,9 +18887,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213) { - ts.Debug.assert(signatureDeclarationNode.kind === 145 || signatureDeclarationNode.kind === 146); - var signatureKind = signatureDeclarationNode.kind === 145 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215) { + ts.Debug.assert(signatureDeclarationNode.kind === 147 || signatureDeclarationNode.kind === 148); + var signatureKind = signatureDeclarationNode.kind === 147 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18463,7 +18907,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 213 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 215 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -18539,7 +18983,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 141 || node.kind === 140); + ts.Debug.assert(node.kind === 143 || node.kind === 142); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -18571,11 +19015,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 213 || node.parent.kind === 153 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 211 || node.kind === 141 || node.kind === 140 || node.kind === 142) { + if (node.kind === 213 || node.kind === 143 || node.kind === 142 || node.kind === 144) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -18688,16 +19132,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 213: + case 215: return 2097152; - case 216: + case 218: return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 212: - case 215: + case 214: + case 217: return 2097152 | 1048576; - case 219: + case 221: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -18708,7 +19152,8 @@ var ts; } } function checkNonThenableType(type, location, message) { - if (!(type.flags & 1) && isTypeAssignableTo(type, getGlobalThenableType())) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -18823,22 +19268,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 212: + case 214: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 136: + case 138: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 139: + case 141: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 141: case 143: - case 144: + case 145: + case 146: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -18847,9 +19292,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 149) { + if (node && node.kind === 151) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 149 ? 793056 : 1536; + var meaning = root.parent.kind === 151 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -18861,19 +19306,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 139: - checkTypeNodeAsExpression(node.type); - break; - case 136: - checkTypeNodeAsExpression(node.type); - break; case 141: checkTypeNodeAsExpression(node.type); break; + case 138: + checkTypeNodeAsExpression(node.type); + break; case 143: checkTypeNodeAsExpression(node.type); break; - case 144: + case 145: + checkTypeNodeAsExpression(node.type); + break; + case 146: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -18896,24 +19341,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 212: + case 214: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 141: - checkParameterTypeAnnotationsAsExpressions(node); - case 144: case 143: - case 139: - case 136: + checkParameterTypeAnnotationsAsExpressions(node); + case 146: + case 145: + case 141: + case 138: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 136) { + if (node.kind === 138) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -18931,12 +19376,9 @@ var ts; checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { - if (!compilerOptions.experimentalAsyncFunctions) { - error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning); - } emitAwaiter = true; } - if (node.name && node.name.kind === 134) { + if (node.name && node.name.kind === 136) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -18971,11 +19413,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 190) { + if (node.kind === 192) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 217) { + if (ts.isFunctionBlock(node) || node.kind === 219) { checkFunctionAndClassExpressionBodies(node); } } @@ -18993,19 +19435,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 139 || - node.kind === 138 || - node.kind === 141 || + if (node.kind === 141 || node.kind === 140 || node.kind === 143 || - node.kind === 144) { + node.kind === 142 || + node.kind === 145 || + node.kind === 146) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 136 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 138 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -19019,7 +19461,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration_1 = node.kind !== 67; + var isDeclaration_1 = node.kind !== 69; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -19040,7 +19482,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 67; + var isDeclaration_2 = node.kind !== 69; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -19053,11 +19495,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 216 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 218 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 246 && ts.isExternalModule(parent)) { + if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19065,7 +19507,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 209 && !node.initializer) { + if (node.kind === 211 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -19075,15 +19517,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210); - var container = varDeclList.parent.kind === 191 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); + var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 190 && ts.isFunctionLike(container.parent) || - container.kind === 217 || - container.kind === 216 || - container.kind === 246); + (container.kind === 192 && ts.isFunctionLike(container.parent) || + container.kind === 219 || + container.kind === 218 || + container.kind === 248); if (!namesShareScope) { var name_14 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_14, name_14); @@ -19093,16 +19535,16 @@ var ts; } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 136) { + if (ts.getRootDeclaration(node).kind !== 138) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 67) { + if (n.kind === 69) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 136) { + if (referencedSymbol.valueDeclaration.kind === 138) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19122,7 +19564,7 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19131,7 +19573,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 136 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 138 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19159,9 +19601,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 139 && node.kind !== 138) { + if (node.kind !== 141 && node.kind !== 140) { checkExportsOnMergedDeclarations(node); - if (node.kind === 209 || node.kind === 161) { + if (node.kind === 211 || node.kind === 163) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19182,7 +19624,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 163) { + if (node.modifiers && node.parent.kind === 165) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -19215,12 +19657,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 210) { + if (node.initializer && node.initializer.kind === 212) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19235,13 +19677,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -19256,7 +19698,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19266,7 +19708,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -19428,7 +19870,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144))); + return !!(node.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -19446,10 +19888,10 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 144) { + if (func.kind === 146) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 142) { + else if (func.kind === 144) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19458,7 +19900,9 @@ var ts; if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + if (promisedType) { + checkTypeAssignableTo(awaitedType, promisedType, node.expression); + } } else { checkTypeAssignableTo(exprType, returnType, node.expression); @@ -19482,7 +19926,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 240 && !hasDuplicateDefaultClause) { + if (clause.kind === 242 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19494,7 +19938,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 239) { + if (produceDiagnostics && clause.kind === 241) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -19511,7 +19955,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 205 && current.label.text === node.label.text) { + if (current.kind === 207 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -19537,7 +19981,7 @@ var ts; var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 67) { + if (catchClause.variableDeclaration.name.kind !== 69) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -19605,7 +20049,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 134 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 136 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -19675,6 +20119,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -19693,7 +20138,7 @@ var ts; } } } - checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); @@ -19706,7 +20151,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - ts.forEach(implementedTypeNodes, function (typeRefNode) { + for (var _b = 0; _b < implementedTypeNodes.length; _b++) { + var typeRefNode = implementedTypeNodes[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -19716,14 +20162,14 @@ var ts; if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { - checkTypeAssignableTo(type, t, node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); } } } - }); + } } if (produceDiagnostics) { checkIndexConstraints(type); @@ -19751,7 +20197,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { - if (derivedClassDecl.kind === 184) { + if (derivedClassDecl.kind === 186) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -19795,7 +20241,7 @@ var ts; } } function isAccessor(kind) { - return kind === 143 || kind === 144; + return kind === 145 || kind === 146; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -19832,7 +20278,7 @@ var ts; var ok = true; for (var _i = 0; _i < baseTypes.length; _i++) { var base = baseTypes[_i]; - var properties = getPropertiesOfObjectType(base); + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0; _a < properties.length; _a++) { var prop = properties[_a]; if (!ts.hasProperty(seen, prop.name)) { @@ -19861,7 +20307,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -19869,17 +20315,19 @@ var ts; } if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); if (checkInheritedPropertiesAreIdentical(type, node.name)) { - ts.forEach(getBaseTypes(type), function (baseType) { - checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); - }); + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } checkIndexConstraints(type); } } if (symbol && symbol.declarations) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 212 && !ts.isInAmbientContext(declaration)) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var declaration = _c[_b]; + if (declaration.kind === 214 && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -19910,10 +20358,15 @@ var ts; var autoValue = 0; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); - ts.forEach(node.members, function (member) { - if (member.name.kind !== 134 && isNumericLiteralName(member.name.text)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name.kind === 136) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } + var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; if (initializer) { autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); @@ -19921,10 +20374,13 @@ var ts; else if (ambient && !enumIsConst) { autoValue = undefined; } + else if (previousEnumMemberIsNonConstant) { + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } if (autoValue !== undefined) { getNodeLinks(member).enumMemberValue = autoValue++; } - }); + } nodeLinks.flags |= 8192; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { @@ -19935,7 +20391,10 @@ var ts; if (enumIsConst) { error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); } - else if (!ambient) { + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); } } @@ -19951,7 +20410,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 177: + case 179: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -19959,10 +20418,10 @@ var ts; switch (e.operator) { case 35: return value_1; case 36: return -value_1; - case 49: return ~value_1; + case 50: return ~value_1; } return undefined; - case 179: + case 181: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -19972,37 +20431,37 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 46: return left | right; - case 45: return left & right; - case 43: return left >> right; - case 44: return left >>> right; - case 42: return left << right; - case 47: return left ^ right; + case 47: return left | right; + case 46: return left & right; + case 44: return left >> right; + case 45: return left >>> right; + case 43: return left << right; + case 48: return left ^ right; case 37: return left * right; - case 38: return left / right; + case 39: return left / right; case 35: return left + right; case 36: return left - right; - case 39: return left % right; + case 40: return left % right; } return undefined; case 8: return +e.text; - case 170: + case 172: return evalConstant(e.expression); - case 67: - case 165: - case 164: + case 69: + case 167: + case 166: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName; - if (e.kind === 67) { + if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 165) { + if (e.kind === 167) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -20016,10 +20475,10 @@ var ts; } var current = expression; while (current) { - if (current.kind === 67) { + if (current.kind === 69) { break; } - else if (current.kind === 164) { + else if (current.kind === 166) { current = current.expression; } else { @@ -20042,7 +20501,7 @@ var ts; if (member === propertyDecl) { return undefined; } - if (!isDefinedBefore(propertyDecl, member)) { + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { reportError = false; error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return undefined; @@ -20056,7 +20515,7 @@ var ts; if (!produceDiagnostics) { return; } - checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -20078,7 +20537,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 215) { + if (declaration.kind !== 217) { return false; } var enumDeclaration = declaration; @@ -20101,8 +20560,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 212 || - (declaration.kind === 211 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 214 || + (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20153,7 +20612,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 212); + var mergedClass = ts.getDeclarationOfKind(symbol, 214); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -20161,9 +20620,9 @@ var ts; } if (isAmbientExternalModule) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } - if (isExternalModuleNameRelative(node.name.text)) { + if (ts.isExternalModuleNameRelative(node.name.text)) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -20172,17 +20631,17 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 133) { + if (node.kind === 135) { node = node.left; } - else if (node.kind === 164) { + else if (node.kind === 166) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 67); + ts.Debug.assert(node.kind === 69); return node; } function checkExternalImportOrExportDeclaration(node) { @@ -20191,14 +20650,14 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { - error(moduleName, node.kind === 226 ? + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { + error(moduleName, node.kind === 228 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } @@ -20212,7 +20671,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 228 ? + var message = node.kind === 230 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20238,7 +20697,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { checkImportBinding(importClause.namedBindings); } else { @@ -20273,8 +20732,8 @@ var ts; } } else { - if (languageVersion >= 2 && !ts.isInAmbientContext(node)) { - grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); + if (modulekind === 5 && !ts.isInAmbientContext(node)) { + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -20289,8 +20748,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -20303,7 +20762,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 246 && node.parent.kind !== 217 && node.parent.kind !== 216) { + if (node.parent.kind !== 248 && node.parent.kind !== 219 && node.parent.kind !== 218) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -20317,15 +20776,15 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 246 ? node.parent : node.parent.parent; - if (container.kind === 216 && container.name.kind === 67) { + var container = node.parent.kind === 248 ? node.parent : node.parent.parent; + if (container.kind === 218 && container.name.kind === 69) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { markExportAsReferenced(node); } else { @@ -20333,19 +20792,19 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (languageVersion >= 2) { - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (modulekind === 5) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (compilerOptions.module === 4) { + else if (modulekind === 4) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } function getModuleStatements(node) { - if (node.kind === 246) { + if (node.kind === 248) { return node.statements; } - if (node.kind === 216 && node.body.kind === 217) { + if (node.kind === 218 && node.body.kind === 219) { return node.body.statements; } return emptyArray; @@ -20382,183 +20841,182 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 216: - case 212: + case 218: + case 214: + case 215: case 213: - case 211: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 135: + case 137: return checkTypeParameter(node); - case 136: - return checkParameter(node); - case 139: case 138: - return checkPropertyDeclaration(node); - case 150: - case 151: - case 145: - case 146: - return checkSignatureDeclaration(node); - case 147: - return checkSignatureDeclaration(node); + return checkParameter(node); case 141: case 140: - return checkMethodDeclaration(node); - case 142: - return checkConstructorDeclaration(node); - case 143: - case 144: - return checkAccessorDeclaration(node); - case 149: - return checkTypeReferenceNode(node); - case 148: - return checkTypePredicate(node); + return checkPropertyDeclaration(node); case 152: - return checkTypeQuery(node); case 153: - return checkTypeLiteral(node); + case 147: + case 148: + return checkSignatureDeclaration(node); + case 149: + return checkSignatureDeclaration(node); + case 143: + case 142: + return checkMethodDeclaration(node); + case 144: + return checkConstructorDeclaration(node); + case 145: + case 146: + return checkAccessorDeclaration(node); + case 151: + return checkTypeReferenceNode(node); + case 150: + return checkTypePredicate(node); case 154: - return checkArrayType(node); + return checkTypeQuery(node); case 155: - return checkTupleType(node); + return checkTypeLiteral(node); case 156: + return checkArrayType(node); case 157: - return checkUnionOrIntersectionType(node); + return checkTupleType(node); case 158: + case 159: + return checkUnionOrIntersectionType(node); + case 160: return checkSourceElement(node.type); - case 211: - return checkFunctionDeclaration(node); - case 190: - case 217: - return checkBlock(node); - case 191: - return checkVariableStatement(node); - case 193: - return checkExpressionStatement(node); - case 194: - return checkIfStatement(node); - case 195: - return checkDoStatement(node); - case 196: - return checkWhileStatement(node); - case 197: - return checkForStatement(node); - case 198: - return checkForInStatement(node); - case 199: - return checkForOfStatement(node); - case 200: - case 201: - return checkBreakOrContinueStatement(node); - case 202: - return checkReturnStatement(node); - case 203: - return checkWithStatement(node); - case 204: - return checkSwitchStatement(node); - case 205: - return checkLabeledStatement(node); - case 206: - return checkThrowStatement(node); - case 207: - return checkTryStatement(node); - case 209: - return checkVariableDeclaration(node); - case 161: - return checkBindingElement(node); - case 212: - return checkClassDeclaration(node); case 213: - return checkInterfaceDeclaration(node); - case 214: - return checkTypeAliasDeclaration(node); - case 215: - return checkEnumDeclaration(node); - case 216: - return checkModuleDeclaration(node); - case 220: - return checkImportDeclaration(node); - case 219: - return checkImportEqualsDeclaration(node); - case 226: - return checkExportDeclaration(node); - case 225: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 192: - checkGrammarStatementInAmbientContext(node); - return; + case 219: + return checkBlock(node); + case 193: + return checkVariableStatement(node); + case 195: + return checkExpressionStatement(node); + case 196: + return checkIfStatement(node); + case 197: + return checkDoStatement(node); + case 198: + return checkWhileStatement(node); + case 199: + return checkForStatement(node); + case 200: + return checkForInStatement(node); + case 201: + return checkForOfStatement(node); + case 202: + case 203: + return checkBreakOrContinueStatement(node); + case 204: + return checkReturnStatement(node); + case 205: + return checkWithStatement(node); + case 206: + return checkSwitchStatement(node); + case 207: + return checkLabeledStatement(node); case 208: + return checkThrowStatement(node); + case 209: + return checkTryStatement(node); + case 211: + return checkVariableDeclaration(node); + case 163: + return checkBindingElement(node); + case 214: + return checkClassDeclaration(node); + case 215: + return checkInterfaceDeclaration(node); + case 216: + return checkTypeAliasDeclaration(node); + case 217: + return checkEnumDeclaration(node); + case 218: + return checkModuleDeclaration(node); + case 222: + return checkImportDeclaration(node); + case 221: + return checkImportEqualsDeclaration(node); + case 228: + return checkExportDeclaration(node); + case 227: + return checkExportAssignment(node); + case 194: checkGrammarStatementInAmbientContext(node); return; - case 229: + case 210: + checkGrammarStatementInAmbientContext(node); + return; + case 231: return checkMissingDeclaration(node); } } function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 171: - case 172: + case 173: + case 174: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 184: + case 186: ts.forEach(node.members, checkSourceElement); + ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; - case 141: - case 140: + case 143: + case 142: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 142: - case 143: case 144: - case 211: + case 145: + case 146: + case 213: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 203: + case 205: checkFunctionAndClassExpressionBodies(node.expression); break; - case 137: - case 136: case 139: case 138: - case 159: - case 160: + case 141: + case 140: case 161: case 162: case 163: - case 243: case 164: case 165: + case 245: case 166: case 167: case 168: - case 181: - case 188: case 169: - case 187: case 170: - case 174: - case 175: + case 183: + case 190: + case 171: + case 189: + case 172: case 176: - case 173: case 177: case 178: + case 175: case 179: case 180: - case 183: + case 181: case 182: - case 190: - case 217: - case 191: + case 185: + case 184: + case 192: + case 219: case 193: - case 194: case 195: case 196: case 197: @@ -20567,29 +21025,31 @@ var ts; case 200: case 201: case 202: + case 203: case 204: - case 218: - case 239: - case 240: - case 205: case 206: - case 207: - case 242: - case 209: - case 210: - case 212: + case 220: case 241: - case 186: - case 215: - case 245: - case 225: - case 246: - case 238: - case 231: - case 232: - case 236: - case 237: + case 242: + case 207: + case 208: + case 209: + case 244: + case 211: + case 212: + case 214: + case 243: + case 188: + case 217: + case 247: + case 227: + case 248: + case 240: case 233: + case 234: + case 238: + case 239: + case 235: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -20612,7 +21072,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -20667,7 +21127,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 203 && node.parent.statement === node) { + if (node.parent.kind === 205 && node.parent.statement === node) { return true; } node = node.parent; @@ -20689,28 +21149,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 246: - if (!ts.isExternalModule(location)) { + case 248: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 216: + case 218: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 215: + case 217: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 184: + case 186: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 212: - case 213: + case 214: + case 215: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 171: + case 173: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -20743,42 +21203,42 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 67 && + return name.kind === 69 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 135: - case 212: - case 213: + case 137: case 214: case 215: + case 216: + case 217: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 133) { + while (node.parent && node.parent.kind === 135) { node = node.parent; } - return node.parent && node.parent.kind === 149; + return node.parent && node.parent.kind === 151; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 164) { + while (node.parent && node.parent.kind === 166) { node = node.parent; } - return node.parent && node.parent.kind === 186; + return node.parent && node.parent.kind === 188; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 133) { + while (nodeOnRightSide.parent.kind === 135) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 219) { + if (nodeOnRightSide.parent.kind === 221) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225) { + if (nodeOnRightSide.parent.kind === 227) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -20790,10 +21250,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 225) { + if (entityName.parent.kind === 227) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 164) { + if (entityName.kind !== 166) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -20802,31 +21262,40 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 186 ? 793056 : 1536; + var meaning = 0; + if (entityName.parent.kind === 188) { + meaning = 793056; + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455; + } + } + else { + meaning = 1536; + } meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 233) || - (entityName.parent.kind === 232) || - (entityName.parent.kind === 235)) { + else if ((entityName.parent.kind === 235) || + (entityName.parent.kind === 234) || + (entityName.parent.kind === 237)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } - if (entityName.kind === 67) { + if (entityName.kind === 69) { var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 164) { + else if (entityName.kind === 166) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 133) { + else if (entityName.kind === 135) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -20835,14 +21304,14 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 149 ? 793056 : 1536; + var meaning = entityName.parent.kind === 151 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 236) { + else if (entityName.parent.kind === 238) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 148) { + if (entityName.parent.kind === 150) { return resolveEntityName(entityName, 1); } return undefined; @@ -20854,14 +21323,14 @@ var ts; if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 67) { + if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 225 + return node.parent.kind === 227 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 161 && - node.parent.parent.kind === 159 && + else if (node.parent.kind === 163 && + node.parent.parent.kind === 161 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -20871,29 +21340,29 @@ var ts; } } switch (node.kind) { - case 67: - case 164: - case 133: + case 69: + case 166: + case 135: return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 97: case 95: - case 93: - var type = checkExpression(node); + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 119: + case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 142) { + if (constructorDeclaration && constructorDeclaration.kind === 144) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 220 || node.parent.kind === 226) && + ((node.parent.kind === 222 || node.parent.kind === 228) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 165 && node.parent.argumentExpression === node) { + if (node.parent.kind === 167 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -20907,7 +21376,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 244) { + if (location && location.kind === 246) { return resolveEntityName(location.name, 107455); } return undefined; @@ -21007,11 +21476,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 246) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 248) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 216 || n.kind === 215) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 218 || n.kind === 217) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -21024,11 +21493,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 190: - case 218: - case 197: - case 198: + case 192: + case 220: case 199: + case 200: + case 201: return true; } return false; @@ -21054,22 +21523,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 219: case 221: - case 222: + case 223: case 224: - case 228: - return isAliasResolvedToValue(getSymbolOfNode(node)); case 226: + case 230: + return isAliasResolvedToValue(getSymbolOfNode(node)); + case 228: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 225: - return node.expression && node.expression.kind === 67 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 227: + return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 246 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 248 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -21117,7 +21586,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 245) { + if (node.kind === 247) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21203,21 +21672,6 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function getBlockScopedVariableId(n) { - ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 161 || (n.parent.kind === 209 && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 242; - if (isLetOrConst) { - getSymbolLinks(symbol); - return symbol.id; - } - return undefined; - } function instantiateSingleCallFunctionType(functionType, typeArguments) { if (functionType === unknownType) { return unknownType; @@ -21249,7 +21703,6 @@ var ts; isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, collectLinkedAliases: collectLinkedAliases, - getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter @@ -21260,7 +21713,7 @@ var ts; ts.bindSourceFile(file); }); ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); @@ -21288,6 +21741,7 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); if (languageVersion >= 2) { globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); @@ -21330,10 +21784,7 @@ var ts; if (!ts.nodeCanBeDecorated(node)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } - else if (languageVersion < 1) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); - } - else if (node.kind === 143 || node.kind === 144) { + else if (node.kind === 145 || node.kind === 146) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21343,38 +21794,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 143: + case 145: + case 146: case 144: - case 142: - case 139: - case 138: case 141: case 140: - case 147: - case 216: - case 220: - case 219: - case 226: - case 225: - case 136: + case 143: + case 142: + case 149: + case 218: + case 222: + case 221: + case 228: + case 227: + case 138: break; - case 211: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116) && - node.parent.kind !== 217 && node.parent.kind !== 246) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); - } - break; - case 212: case 213: - case 191: - case 214: - if (node.modifiers && node.parent.kind !== 217 && node.parent.kind !== 246) { + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; + case 214: case 215: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72) && - node.parent.kind !== 217 && node.parent.kind !== 246) { + case 193: + case 216: + if (node.modifiers && node.parent.kind !== 219 && node.parent.kind !== 248) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 217: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -21389,14 +21840,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { + case 112: + case 111: case 110: - case 109: - case 108: var text = void 0; - if (modifier.kind === 110) { + if (modifier.kind === 112) { text = "public"; } - else if (modifier.kind === 109) { + else if (modifier.kind === 111) { text = "protected"; lastProtected = modifier; } @@ -21413,11 +21864,11 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256) { - if (modifier.kind === 108) { + if (modifier.kind === 110) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -21426,17 +21877,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 111: + case 113: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256) { @@ -21445,7 +21896,7 @@ var ts; flags |= 128; lastStatic = modifier; break; - case 80: + case 82: if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -21458,42 +21909,42 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; - case 120: + case 122: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; lastDeclare = modifier; break; - case 113: + case 115: if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 212) { - if (node.kind !== 141) { + if (node.kind !== 214) { + if (node.kind !== 143) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 212 && node.parent.flags & 256)) { + if (!(node.parent.kind === 214 && node.parent.flags & 256)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128) { @@ -21505,14 +21956,14 @@ var ts; } flags |= 256; break; - case 116: + case 118: if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512; @@ -21520,7 +21971,7 @@ var ts; break; } } - if (node.kind === 142) { + if (node.kind === 144) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21538,10 +21989,10 @@ var ts; } return; } - else if ((node.kind === 220 || node.kind === 219) && flags & 2) { + else if ((node.kind === 222 || node.kind === 221) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 136 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512) { @@ -21553,10 +22004,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 141: - case 211: - case 171: - case 172: + case 143: + case 213: + case 173: + case 174: if (!node.asteriskToken) { return false; } @@ -21621,7 +22072,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 172) { + if (node.kind === 174) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -21656,7 +22107,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 128 && parameter.type.kind !== 126) { + if (parameter.type.kind !== 130 && parameter.type.kind !== 128) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -21688,7 +22139,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 185) { + if (arg.kind === 187) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -21715,7 +22166,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -21728,7 +22179,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -21743,14 +22194,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -21759,19 +22210,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 134) { + if (node.kind !== 136) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 179 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 181 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 211 || - node.kind === 171 || - node.kind === 141); + ts.Debug.assert(node.kind === 213 || + node.kind === 173 || + node.kind === 143); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -21788,7 +22239,7 @@ var ts; return grammarErrorOnNode(questionToken, message); } } - function checkGrammarObjectLiteralExpression(node) { + function checkGrammarObjectLiteralExpression(node, inDestructuring) { var seen = {}; var Property = 1; var GetAccessor = 2; @@ -21797,26 +22248,29 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 185 || - name_16.kind === 134) { + if (prop.kind === 187 || + name_16.kind === 136) { checkGrammarComputedPropertyName(name_16); continue; } + if (prop.kind === 246 && !inDestructuring && prop.objectAssignmentInitializer) { + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + } var currentKind = void 0; - if (prop.kind === 243 || prop.kind === 244) { + if (prop.kind === 245 || prop.kind === 246) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_16.kind === 8) { checkGrammarNumericLiteral(name_16); } currentKind = Property; } - else if (prop.kind === 141) { + else if (prop.kind === 143) { currentKind = Property; } - else if (prop.kind === 143) { + else if (prop.kind === 145) { currentKind = GetAccessor; } - else if (prop.kind === 144) { + else if (prop.kind === 146) { currentKind = SetAccesor; } else { @@ -21848,7 +22302,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 237) { + if (attr.kind === 239) { continue; } var jsxAttr = attr; @@ -21860,7 +22314,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 238 && !initializer.expression) { + if (initializer && initializer.kind === 240 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -21869,24 +22323,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 210) { + if (forInOrOfStatement.initializer.kind === 212) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -21909,10 +22363,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 143 && accessor.parameters.length) { + else if (kind === 145 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 144) { + else if (kind === 146) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -21937,7 +22391,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 134 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 136 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -21947,7 +22401,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 163) { + if (node.parent.kind === 165) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -21966,22 +22420,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 199: + case 200: + case 201: case 197: case 198: - case 199: - case 195: - case 196: return true; - case 205: + case 207: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -21993,9 +22447,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 205: + case 207: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 200 + var isMisplacedContinueLabel = node.kind === 202 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -22003,8 +22457,8 @@ var ts; return false; } break; - case 204: - if (node.kind === 201 && !node.label) { + case 206: + if (node.kind === 203 && !node.label) { return false; } break; @@ -22017,13 +22471,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -22035,7 +22489,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 160 || node.name.kind === 159) { + if (node.name.kind === 162 || node.name.kind === 161) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22044,7 +22498,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 198 && node.parent.parent.kind !== 199) { + if (node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -22064,7 +22518,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 67) { + if (name.kind === 69) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -22073,7 +22527,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22090,15 +22544,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 194: - case 195: case 196: - case 203: case 197: case 198: - case 199: - return false; case 205: + case 199: + case 200: + case 201: + return false; + case 207: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22114,7 +22568,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 177) { + if (expression.kind === 179) { var unaryExpression = expression; if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { expression = unaryExpression.operand; @@ -22125,32 +22579,6 @@ var ts; } return false; } - function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 32768) !== 0; - var hasError = false; - if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { - var node = _a[_i]; - if (node.name.kind === 134) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); - } - else if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer)) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; - } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; - } - } - } - return hasError; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -22176,7 +22604,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -22196,12 +22624,12 @@ var ts; return true; } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22211,11 +22639,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 213 || - node.kind === 220 || - node.kind === 219 || - node.kind === 226 || - node.kind === 225 || + if (node.kind === 215 || + node.kind === 222 || + node.kind === 221 || + node.kind === 228 || + node.kind === 227 || (node.flags & 2) || (node.flags & (1 | 1024))) { return false; @@ -22225,7 +22653,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 191) { + if (ts.isDeclaration(decl) || decl.kind === 193) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22244,7 +22672,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 190 || node.parent.kind === 217 || node.parent.kind === 246) { + if (node.parent.kind === 192 || node.parent.kind === 219 || node.parent.kind === 248) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -22291,6 +22719,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; + var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; @@ -22316,7 +22745,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 220); + ts.Debug.assert(aliasEmitInfo.node.kind === 222); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22367,6 +22796,7 @@ var ts; function createAndSetNewTextWriterWithSymbolWriter() { var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -22389,10 +22819,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 209) { + if (declaration.kind === 211) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 223 || declaration.kind === 224 || declaration.kind === 221) { + else if (declaration.kind === 225 || declaration.kind === 226 || declaration.kind === 223) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22403,7 +22833,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 220) { + if (moduleElementEmitInfo.node.kind === 222) { moduleElementEmitInfo.isVisible = true; } else { @@ -22411,12 +22841,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22448,6 +22878,11 @@ var ts; function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); } + function reportInaccessibleThisError() { + if (errorNameNode) { + diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); @@ -22455,7 +22890,9 @@ var ts; emitType(type); } else { + errorNameNode = declaration.name; resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -22465,7 +22902,9 @@ var ts; emitType(signature.type); } else { + errorNameNode = signature.name; resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function emitLines(nodes) { @@ -22503,62 +22942,63 @@ var ts; } function emitType(type) { switch (type.kind) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: + case 97: case 9: return writeTextOfNode(currentSourceFile, type); - case 186: + case 188: return emitExpressionWithTypeArguments(type); - case 149: - return emitTypeReference(type); - case 152: - return emitTypeQuery(type); - case 154: - return emitArrayType(type); - case 155: - return emitTupleType(type); - case 156: - return emitUnionType(type); - case 157: - return emitIntersectionType(type); - case 158: - return emitParenType(type); - case 150: case 151: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 154: + return emitTypeQuery(type); + case 156: + return emitArrayType(type); + case 157: + return emitTupleType(type); + case 158: + return emitUnionType(type); + case 159: + return emitIntersectionType(type); + case 160: + return emitParenType(type); + case 152: case 153: + return emitSignatureDeclarationWithJsDocComments(type); + case 155: return emitTypeLiteral(type); - case 67: + case 69: return emitEntityName(type); - case 133: + case 135: return emitEntityName(type); - case 148: + case 150: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 67) { + if (entityName.kind === 69) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 133 ? entityName.left : entityName.expression; - var right = entityName.kind === 133 ? entityName.right : entityName.name; + var left = entityName.kind === 135 ? entityName.left : entityName.expression; + var right = entityName.kind === 135 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 219 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 221 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 67 || node.expression.kind === 164); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 166); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -22634,7 +23074,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -22652,7 +23092,7 @@ var ts; } write(";"); writeLine(); - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { var nodes = resolver.collectLinkedAliases(node.expression); writeAsynchronousModuleElements(nodes); } @@ -22670,10 +23110,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 219 || - (node.parent.kind === 246 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 221 || + (node.parent.kind === 248 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -22682,7 +23122,7 @@ var ts; }); } else { - if (node.kind === 220) { + if (node.kind === 222) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -22700,23 +23140,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 211: - return writeFunctionDeclaration(node); - case 191: - return writeVariableStatement(node); case 213: - return writeInterfaceDeclaration(node); - case 212: - return writeClassDeclaration(node); - case 214: - return writeTypeAliasDeclaration(node); + return writeFunctionDeclaration(node); + case 193: + return writeVariableStatement(node); case 215: - return writeEnumDeclaration(node); + return writeInterfaceDeclaration(node); + case 214: + return writeClassDeclaration(node); case 216: + return writeTypeAliasDeclaration(node); + case 217: + return writeEnumDeclaration(node); + case 218: return writeModuleDeclaration(node); - case 219: + case 221: return writeImportEqualsDeclaration(node); - case 220: + case 222: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -22730,7 +23170,7 @@ var ts; if (node.flags & 1024) { write("default "); } - else if (node.kind !== 213) { + else if (node.kind !== 215) { write("declare "); } } @@ -22777,7 +23217,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 222) { + if (namedBindings.kind === 224) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -22803,7 +23243,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 222) { + if (node.importClause.namedBindings.kind === 224) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -22859,7 +23299,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 217) { + while (node.body.kind !== 219) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -22924,7 +23364,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 141 && (node.parent.flags & 32); + return node.parent.kind === 143 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -22934,15 +23374,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - (node.parent.parent && node.parent.parent.kind === 153)) { - ts.Debug.assert(node.parent.kind === 141 || - node.parent.kind === 140 || - node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.kind === 145 || - node.parent.kind === 146); + if (node.parent.kind === 152 || + node.parent.kind === 153 || + (node.parent.parent && node.parent.parent.kind === 155)) { + ts.Debug.assert(node.parent.kind === 143 || + node.parent.kind === 142 || + node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.kind === 147 || + node.parent.kind === 148); emitType(node.constraint); } else { @@ -22952,31 +23392,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 212: + case 214: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 213: + case 215: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 146: + case 148: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145: + case 147: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 211: + case 213: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23004,12 +23444,12 @@ var ts; if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - else if (!isImplementsList && node.expression.kind === 91) { + else if (!isImplementsList && node.expression.kind === 93) { write("null"); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -23089,16 +23529,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 209 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 211 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 139 || node.kind === 138) && ts.hasQuestionToken(node)) { + if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 139 || node.kind === 138) && node.parent.kind === 153) { + if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -23107,14 +23547,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 209) { + if (node.kind === 211) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 139 || node.kind === 138) { + else if (node.kind === 141 || node.kind === 140) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23122,7 +23562,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23148,7 +23588,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { elements.push(element); } } @@ -23214,7 +23654,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 143 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 145 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23227,7 +23667,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 143 + return accessor.kind === 145 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -23236,7 +23676,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 144) { + if (accessorWithTypeAnnotation.kind === 146) { if (accessorWithTypeAnnotation.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -23282,17 +23722,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 211) { + if (node.kind === 213) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 141) { + else if (node.kind === 143) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 211) { + if (node.kind === 213) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 142) { + else if (node.kind === 144) { write("constructor"); } else { @@ -23309,11 +23749,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 146 || node.kind === 151) { + if (node.kind === 148 || node.kind === 153) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 147) { + if (node.kind === 149) { write("["); } else { @@ -23322,20 +23762,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 147) { + if (node.kind === 149) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 150 || node.kind === 151; - if (isFunctionTypeOrConstructorType || node.parent.kind === 153) { + var isFunctionTypeOrConstructorType = node.kind === 152 || node.kind === 153; + if (isFunctionTypeOrConstructorType || node.parent.kind === 155) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 142 && !(node.flags & 32)) { + else if (node.kind !== 144 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23346,23 +23786,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 146: + case 148: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 145: + case 147: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147: + case 149: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 141: - case 140: + case 143: + case 142: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23370,7 +23810,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23383,7 +23823,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 211: + case 213: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23415,9 +23855,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.parent.kind === 153) { + if (node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23433,22 +23873,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 142: + case 144: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 146: + case 148: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 145: + case 147: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23456,7 +23896,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23468,7 +23908,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 211: + case 213: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23479,12 +23919,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 159) { + if (bindingPattern.kind === 161) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 160) { + else if (bindingPattern.kind === 162) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23503,10 +23943,10 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 185) { + if (bindingElement.kind === 187) { write(" "); } - else if (bindingElement.kind === 161) { + else if (bindingElement.kind === 163) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); @@ -23516,7 +23956,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 67); + ts.Debug.assert(bindingElement.name.kind === 69); if (bindingElement.dotDotDotToken) { write("..."); } @@ -23528,39 +23968,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 211: - case 216: - case 219: case 213: - case 212: - case 214: + case 218: + case 221: case 215: + case 214: + case 216: + case 217: return emitModuleElement(node, isModuleElementVisible(node)); - case 191: + case 193: return emitModuleElement(node, isVariableStatementVisible(node)); - case 220: + case 222: return emitModuleElement(node, !node.importClause); - case 226: + case 228: return emitExportDeclaration(node); + case 144: + case 143: case 142: + return writeFunctionDeclaration(node); + case 148: + case 147: + case 149: + return emitSignatureDeclarationWithJsDocComments(node); + case 145: + case 146: + return emitAccessorDeclaration(node); case 141: case 140: - return writeFunctionDeclaration(node); - case 146: - case 145: - case 147: - return emitSignatureDeclarationWithJsDocComments(node); - case 143: - case 144: - return emitAccessorDeclaration(node); - case 139: - case 138: return emitPropertyDeclaration(node); - case 245: + case 247: return emitEnumMemberDeclaration(node); - case 225: + case 227: return emitExportAssignment(node); - case 246: + case 248: return emitSourceFile(node); } } @@ -23603,5471 +24043,6 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; - function emitFiles(resolver, host, targetSourceFile) { - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; - var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; - if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - else { - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); - return { - emitSkipped: false, - diagnostics: diagnostics, - sourceMaps: sourceMapDataList - }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { - return false; - } - } - } - return true; - } - function emitJavaScript(jsFilePath, root) { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var currentSourceFile; - var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; - var computedPropertyNamesToGeneratedNames; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStars; - var writeEmittedFiles = writeJavaScriptFile; - var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - var emit = emitNodeWithCommentsAndWithoutSourcemap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; - var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; - var sourceMapData; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); - return; - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - emit(sourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_19)) { - tempFlags |= flags; - return name_19; - } - } - while (true) { - var count = tempFlags & 268435455; - tempFlags++; - if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; - } - } - } - } - function makeUniqueName(baseName) { - if (baseName.charCodeAt(baseName.length - 1) !== 95) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 67: - return makeUniqueName(node.text); - case 216: - case 215: - return generateNameForModuleOrEnum(node); - case 220: - case 226: - return generateNameForImportOrExportDeclaration(node); - case 211: - case 212: - case 225: - return generateNameForExportDefault(); - case 184: - return generateNameForClassExpression(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - function initializeEmitterWithSourceMaps() { - var sourceMapDir; - var sourceMapSourceIndex = -1; - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; - } - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } - } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - var name_21 = node.name; - if (!name_21 || name_21.kind !== 134) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - recordScopeNameStart(scopeName); - } - else if (node.kind === 211 || - node.kind === 171 || - node.kind === 141 || - node.kind === 140 || - node.kind === 143 || - node.kind === 144 || - node.kind === 216 || - node.kind === 212 || - node.kind === 215) { - if (node.name) { - var name_22 = node.name; - scopeName = name_22.kind === 134 - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); - } - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 246) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); - } - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(67); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - function emitTokenText(tokenKind, startPos, emitFn) { - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); - } - else { - write(tokenString); - } - return startPos + tokenString.length; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, false, false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); - } - if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - } - switch (node.kind) { - case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); - case 11: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - var isLast = node.kind === 11 || node.kind === 14; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); - }); - } - write("]"); - } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - if (node.template.kind === 181) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 179 - && templateSpan.expression.operatorToken.kind === 24; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); - } - function emitTemplateExpression(node) { - if (languageVersion >= 2) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 170 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; - if (i > 0 || headEmitted) { - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); - } - } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 166: - case 167: - return parent.expression === template; - case 168: - case 170: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1; - } - } - function comparePrecedenceToBinaryPlus(expression) { - switch (expression.kind) { - case 179: - switch (expression.operatorToken.kind) { - case 37: - case 38: - case 39: - return 1; - case 35: - case 36: - return 0; - default: - return -1; - } - case 182: - case 180: - return -1; - default: - return 1; - } - } - } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); - } - function jsxEmitReact(node) { - function emitTagName(name) { - if (name.kind === 67 && ts.isIntrinsicJsxName(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } - } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(67); - syntheticReactRef.text = 'React'; - syntheticReactRef.parent = openingNode; - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - if (openingNode.attributes.length === 0) { - write("null"); - } - else { - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); - var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 237) { - if (i_1 === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i_1 > 0) { - write(", "); - } - emit(attrs[i_1].expression); - } - else { - ts.Debug.assert(attrs[i_1].kind === 236); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i_1 > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i_1]); - } - } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); - } - else { - write("{"); - for (var i = 0; i < attrs.length; i++) { - if (i > 0) { - write(", "); - } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - if (children) { - for (var i = 0; i < children.length; i++) { - if (children[i].kind === 238 && !(children[i].expression)) { - continue; - } - if (children[i].kind === 234) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); - } - } - else { - write(", "); - emit(children[i]); - } - } - } - write(")"); - emitTrailingComments(openingNode); - } - if (node.kind === 231) { - emitJsxElement(node.openingElement, node.children); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxElement(node); - } - } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); - } - } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); - } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 237) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 236); - emitJsxAttribute(attribs[i]); - } - } - } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 232)) { - write(" "); - } - emitAttributes(node.attributes); - if (node.kind === 232) { - write("/>"); - } - else { - write(">"); - } - } - function emitJsxClosingElement(node) { - write(""); - } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 231) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxOpeningOrSelfClosingElement(node); - } - } - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 161); - if (node.kind === 9) { - emitLiteral(node); - } - else if (node.kind === 134) { - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write("\""); - if (node.kind === 8) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - write("\""); - } - } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 162: - case 179: - case 166: - case 239: - case 134: - case 180: - case 137: - case 173: - case 195: - case 165: - case 225: - case 193: - case 186: - case 197: - case 198: - case 199: - case 194: - case 232: - case 233: - case 237: - case 238: - case 167: - case 170: - case 178: - case 177: - case 202: - case 244: - case 183: - case 204: - case 168: - case 188: - case 206: - case 169: - case 174: - case 175: - case 196: - case 203: - case 182: - return true; - case 161: - case 245: - case 136: - case 243: - case 139: - case 209: - return parent.initializer === node; - case 164: - return parent.expression === node; - case 172: - case 171: - return parent.body === node; - case 219: - return parent.moduleReference === node; - case 133: - return parent.left === node; - } - return false; - } - function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048) { - write("_arguments"); - return; - } - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 246) { - if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - else { - write(getGeneratedNameForNode(container)); - write("."); - } - } - else if (languageVersion < 2) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 221) { - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); - return; - } - else if (declaration.kind === 224) { - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); - if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); - } - else { - write("."); - write(identifier); - } - return; - } - } - declaration = resolver.getReferencedNestedRedeclaration(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function isNameOfNestedRedeclaration(node) { - if (languageVersion < 2) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 161: - case 212: - case 215: - case 209: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); - } - } - return false; - } - function emitIdentifier(node) { - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - emitExpressionIdentifier(node); - } - else if (isNameOfNestedRedeclaration(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2) { - write("_this"); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { - write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write("]"); - } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); - } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); - } - function emitYieldExpression(node) { - write(ts.tokenToString(112)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } - } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(112)); - write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } - } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 179 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 180 && node.parent.condition === node) { - return true; - } - return false; - } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 67: - case 162: - case 164: - case 165: - case 166: - case 170: - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 183) { - e = e.expression; - emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 183) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 183; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); - write("]"); - } - else { - emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } - write("{"); - if (numElements > 0) { - var properties = node.properties; - if (numElements === properties.length) { - emitLinePreservingList(node, properties, languageVersion >= 1, true); - } - else { - var multiLine = (node.flags & 2048) !== 0; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, multiLine, false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - } - write("}"); - } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048) !== 0; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - var tempVar = createAndRecordTempVariable(0); - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 143 || property.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 243) { - emit(property.initializer); - } - else if (property.kind === 244) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 141) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2) { - var numProperties = properties.length; - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 134) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } - } - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(179, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(164); - result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(21); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(165); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - while (expr.kind === 169 || expr.kind === 187) { - expr = expr.expression; - } - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 167 && - expr.kind !== 8) { - return expr; - } - var node = ts.createSynthesizedNode(170); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - function isNamespaceExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 246; - } - function emitShorthandPropertyAssignment(node) { - writeTextOfNode(currentSourceFile, node.name); - if (languageVersion < 2 || isNamespaceExportReference(node.name)) { - write(": "); - emit(node.name); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 164 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 164 || node.kind === 165 - ? resolver.getConstantValue(node) - : undefined; - } - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - var shouldEmitSpace; - if (!indentedBeforeDot) { - if (node.expression.kind === 8) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; - } - else { - var constantValue = tryGetConstEnumValue(node.expression); - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 67) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 67: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 133: - emitQualifiedNameAsExpression(node, useFallback); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 183; }); - } - function skipParentheses(node) { - while (node.kind === 170 || node.kind === 169 || node.kind === 187) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 67 || node.kind === 95 || node.kind === 93) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 164) { - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 165) { - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 93) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 93) { - emitThis(target); - } - else { - emit(target); - } - } - else { - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, false, false, false, true); - write(")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var superCall = false; - if (node.expression.kind === 93) { - emitSuper(node.expression); - superCall = true; - } - else { - emit(node.expression); - superCall = node.expression.kind === 164 && node.expression.expression.kind === 93; - } - if (superCall && languageVersion < 2) { - write(".call("); - emitThis(node.expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - if (languageVersion === 1 && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, false, false, false, false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172) { - if (node.expression.kind === 169 || node.expression.kind === 187) { - var operand = node.expression.expression; - while (operand.kind === 169 || operand.kind === 187) { - operand = operand.expression; - } - if (operand.kind !== 177 && - operand.kind !== 175 && - operand.kind !== 174 && - operand.kind !== 173 && - operand.kind !== 178 && - operand.kind !== 167 && - !(operand.kind === 166 && node.parent.kind === 167) && - !(operand.kind === 171 && node.parent.kind === 166) && - !(operand.kind === 8 && node.parent.kind === 164)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(76)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(101)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(99)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 67 || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 || node.parent.kind === 161); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); - } - function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - write(ts.tokenToString(node.operator)); - if (node.operand.kind === 177) { - var operand = node.operand; - if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { - write(" "); - } - else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 41)) { - write(" "); - } - } - emit(node.operand); - if (exportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 40) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, false); - } - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = node; - while (current) { - if (current.kind === 246) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); - } - else if (ts.isFunctionLike(current) || current.kind === 217) { - return false; - } - else { - current = current.parent; - } - } - } - function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 55 && - (node.left.kind === 163 || node.left.kind === 162)) { - emitDestructuring(node, node.parent.kind === 193); - } - else { - var exportChanged = node.operatorToken.kind >= 55 && - node.operatorToken.kind <= 66 && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - if (exportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 190) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15, node.pos); - write(" "); - emitToken(16, node.statements.end); - return; - } - emitToken(15, node.pos); - increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 217) { - ts.Debug.assert(node.parent.kind === 216); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 217) { - emitTempDeclarations(true); - } - decreaseIndent(); - writeLine(); - emitToken(16, node.statements.end); - scopeEmitEnd(); - } - function emitEmbeddedStatement(node) { - if (node.kind === 190) { - write(" "); - emit(node); - } - else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); - } - } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 172); - write(";"); - } - function emitIfStatement(node) { - var endPos = emitToken(86, node.pos); - write(" "); - endPos = emitToken(17, endPos); - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(78, node.thenStatement.end); - if (node.elseStatement.kind === 194) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - write("do"); - emitEmbeddedStatement(node.statement); - if (node.statement.kind === 190) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); - write(");"); - } - function emitWhileStatement(node) { - write("while ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, true)) { - return false; - } - var tokenKind = 100; - if (decl && languageVersion >= 2) { - if (ts.isLet(decl)) { - tokenKind = 106; - } - else if (ts.isConst(decl)) { - tokenKind = 72; - } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); - } - else { - switch (tokenKind) { - case 100: - write("var "); - break; - case 106: - write("let "); - break; - case 72: - write("const "); - break; - } - } - return true; - } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { - write(", "); - } - emit(decl); - } - return started; - } - function emitForStatement(node) { - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 199) { - return emitDownLevelForOfStatement(node); - } - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 198) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.statement); - } - function emitDownLevelForOfStatement(node) { - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - var rhsIsIdentifier = node.expression.kind === 67; - var counter = createTempVariable(268435456); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - emitStart(node.expression); - write("var "); - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - if (!rhsIsIdentifier) { - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.initializer); - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.initializer); - emitToken(18, node.expression.end); - write(" {"); - writeLine(); - increaseIndent(); - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 210) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - emitDestructuring(declaration, false, rhsIterationValue); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - emitNodeWithoutSourceMap(createTempVariable(0)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - var assignmentExpression = createBinaryExpression(node.initializer, 55, rhsIterationValue, false); - if (node.initializer.kind === 162 || node.initializer.kind === 163) { - emitDestructuring(assignmentExpression, true, undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (node.statement.kind === 190) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - writeLine(); - decreaseIndent(); - write("}"); - } - function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 201 ? 68 : 73, node.pos); - emitOptional(" ", node.label); - write(";"); - } - function emitReturnStatement(node) { - emitToken(92, node.pos); - emitOptional(" ", node.expression); - write(";"); - } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitSwitchStatement(node) { - var endPos = emitToken(94, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.expression); - endPos = emitToken(18, node.expression.end); - write(" "); - emitCaseBlock(node.caseBlock, endPos); - } - function emitCaseBlock(node, startPos) { - emitToken(15, startPos); - increaseIndent(); - emitLines(node.clauses); - decreaseIndent(); - writeLine(); - emitToken(16, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 239) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(70, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.variableDeclaration); - emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(74, node.pos); - write(";"); - } - function emitLabelledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 216); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8); - zero.text = "0"; - var result = ts.createSynthesizedNode(175); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 246) { - ts.Debug.assert(!!(node.flags & 1024) || node.kind === 225); - if (compilerOptions.module === 1 || compilerOptions.module === 2 || compilerOptions.module === 3) { - if (!currentSourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 1) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); - writeLine(); - } - else if (languageVersion === 0) { - write("exports.__esModule = true;"); - writeLine(); - } - } - } - } - } - function emitExportMemberAssignment(node) { - if (node.flags & 1) { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4 && node.parent === currentSourceFile) { - write(exportFunctionForFile + "(\""); - if (node.flags & 1024) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 1024) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0) { - write("exports[\"default\"]"); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } - } - function emitExportMemberAssignments(name) { - if (compilerOptions.module === 4) { - return; - } - if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } - } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(compilerOptions.module === 4); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; - } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - var canDefineTempVariablesInPlace = false; - if (root.kind === 209) { - var isExported = ts.getCombinedNodeFlags(root) & 1; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 136) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 179) { - emitAssignmentExpression(root); - } - else { - ts.Debug.assert(!isAssignmentExpressionStatement); - emitBindingElement(root, value); - } - function emitAssignment(name, value) { - if (emitCount++) { - write(", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 || name.parent.kind === 161); - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - if (exportChanged) { - write(")"); - } - } - function ensureIdentifier(expr, reuseIdentifierExpressions) { - if (expr.kind === 67 && reuseIdentifierExpressions) { - return expr; - } - var identifier = createTempVariable(0); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - return identifier; - } - function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value, true); - var equals = ts.createSynthesizedNode(179); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(180); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(52); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(53); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 67) { - return createElementAccessExpression(object, syntheticName); - } - return createPropertyAccessExpression(object, syntheticName); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(166); - var sliceIdentifier = ts.createSynthesizedNode(67); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; - if (p.kind === 243 || p.kind === 244) { - var propName = p.name; - emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); - } - } - } - function emitArrayLiteralAssignment(target, value) { - var elements = target.elements; - if (elements.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); - } - } - } - } - function emitDestructuringAssignment(target, value) { - if (target.kind === 179 && target.operatorToken.kind === 55) { - value = createDefaultValueCheck(value, target.right); - target = target.left; - } - if (target.kind === 163) { - emitObjectLiteralAssignment(target, value); - } - else if (target.kind === 162) { - emitArrayLiteralAssignment(target, value); - } - else { - emitAssignment(target, value); - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { - if (root.parent.kind !== 170) { - write("("); - } - value = ensureIdentifier(value, true); - emitDestructuringAssignment(target, value); - write(", "); - emit(value); - if (root.parent.kind !== 170) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - if (target.initializer) { - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; - } - else if (!value) { - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 159) { - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 185) { - if (!element.dotDotDotToken) { - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value); - } - } - } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - else { - var initializer = node.initializer; - if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 16384); - if (isUninitializedLet && - node.parent.parent.kind !== 198 && - node.parent.parent.kind !== 199) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 185) { - return; - } - var name = node.name; - if (name.kind === 67) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 209 && node.parent.kind !== 161)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && - languageVersion >= 2 && - node.parent.kind === 246; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1) { - if (isES6ExportedDeclaration(node)) { - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 1)) { - return true; - } - if (isES6ExportedDeclaration(node)) { - return true; - } - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2) { - if (ts.isBindingPattern(node.name)) { - var name_23 = createTempVariable(0); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_23); - emit(name_23); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2) { - var tempIndex = 0; - ts.forEach(node.parameters, function (parameter) { - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); - } - else { - emit(tempParameters[tempIndex]); - write(" = "); - emit(initializer); - } - write(";"); - tempIndex++; - } - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); - } - }); - } - } - function emitRestParameter(node) { - if (languageVersion < 2 && ts.hasRestParameter(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - if (ts.isBindingPattern(restParam.name)) { - return; - } - var tempName = createTempVariable(268435456).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitAccessor(node) { - write(node.kind === 143 ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); - } - function shouldEmitAsArrowFunction(node) { - return node.kind === 172 && languageVersion >= 2; - } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 171) { - return !!node.name; - } - if (node.kind === 211) { - return !!node.name || languageVersion < 2; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitCommentsOnNotEmittedNode(node); - } - if (node.kind !== 141 && node.kind !== 140 && - node.parent && node.parent.kind !== 243 && - node.parent.kind !== 166) { - emitLeadingComments(node); - } - emitStart(node); - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - write("function"); - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 211 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (node.kind !== 141 && node.kind !== 140) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 172; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; - var args; - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments"); - } - else { - write(", void 0"); - } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); - } - else { - write(", Promise"); - } - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } - emitFunctionBody(node); - write(")"); - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitFunctionBody(node) { - if (!node.body) { - write(" { }"); - } - else { - if (node.body.kind === 190) { - emitBlockFunctionBody(node, node.body); - } - else { - emitExpressionFunctionBody(node, node.body); - } - } - } - function emitSignatureAndBody(node) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 || node.flags & 512) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - write(" "); - var current = body; - while (current.kind === 169) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 163); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedComments(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - scopeEmitEnd(); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedComments(body.statements); - var startIndex = emitDirectivePrologues(body.statements, true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16, body.statements.end); - scopeEmitEnd(); - } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 193) { - var expr = statement.expression; - if (expr && expr.kind === 166) { - var func = expr.expression; - if (func && func.kind === 93) { - return statement; - } - } - } - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 112) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 9 || memberName.kind === 8) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 134) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 139 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { - properties.push(member); - } - } - return properties; - } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; - emitPropertyDeclaration(node, property); - } - } - function emitPropertyDeclaration(node, property, receiver, isExpression) { - writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - emit(receiver); - } - else { - if (property.flags & 128) { - emitDeclarationName(node); - } - else { - write("this"); - } - } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 189) { - writeLine(); - write(";"); - } - else if (member.kind === 141 || node.kind === 140) { - if (!member.body) { - return emitCommentsOnNotEmittedNode(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 143 || member.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 141 || node.kind === 140) && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - else if (member.kind === 141 || - member.kind === 143 || - member.kind === 144) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 128) { - write("static "); - } - if (member.kind === 143) { - write("get "); - } - else if (member.kind === 144) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 189) { - writeLine(); - write(";"); - } - } - } - function emitConstructor(node, baseTypeElement) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitConstructorWorker(node, baseTypeElement) { - var hasInstancePropertyWithInitializer = false; - ts.forEach(node.members, function (member) { - if (member.kind === 142 && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { - return; - } - if (ctor) { - emitLeadingComments(ctor); - } - emitStart(ctor || node); - if (languageVersion < 2) { - write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); - } - else { - write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - if (baseTypeElement) { - write("(...args)"); - } - else { - write("()"); - } - } - } - var startIndex = 0; - write(" {"); - scopeEmitStart(node, "constructor"); - increaseIndent(); - if (ctor) { - startIndex = emitDirectivePrologues(ctor.body.statements, true); - emitDetachedComments(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); - } - else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2) { - write("_super.apply(this, arguments);"); - } - else { - write("super(...args);"); - } - emitEnd(baseTypeElement); - } - } - emitPropertyDeclarations(node, getInitializedProperties(node, false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } - } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); - } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2) { - emitClassLikeDeclarationBelowES6(node); - } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 212) { - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - } - var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184; - var tempVariable; - if (isClassExpressionWithStaticProperties) { - tempVariable = createAndRecordTempVariable(0); - write("("); - increaseIndent(); - emit(tempVariable); - write(" = "); - } - write("class"); - if ((node.name || !(node.flags & 1024)) && !thisNodeIsDecorated) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - scopeEmitStart(node); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - if (thisNodeIsDecorated) { - write(";"); - } - if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, tempVariable, true); - } - write(","); - writeLine(); - emit(tempVariable); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); - } - if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 212) { - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - scopeEmitStart(node); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, true)); - writeLine(); - emitDecoratorsOfClass(node); - writeLine(); - emitToken(16, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(true); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - emitStart(node); - write(")("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write(")"); - if (node.kind === 212) { - write(";"); - } - emitEnd(node); - if (node.kind === 212) { - emitExportMemberAssignment(node); - } - if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 128)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 128); - emitDecoratorsOfConstructor(node); - } - function emitDecoratorsOfConstructor(node) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - if (!decorators && !hasDecoratedParameters) { - return; - } - writeLine(); - emitStart(node); - emitDeclarationName(node); - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); - emitSerializedTypeMetadata(node, argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(");"); - emitEnd(node); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.flags & 128) !== staticFlag) { - continue; - } - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - if (member.kind === 141) { - functionLikeMember = member; - } - } - writeLine(); - emitStart(member); - if (member.kind !== 139) { - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(","); - increaseIndent(); - writeLine(); - } - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - if (member.kind !== 139) { - write(", Object.getOwnPropertyDescriptor("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write("))"); - decreaseIndent(); - } - write(");"); - emitEnd(member); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); - emit(decorator.expression); - write(")"); - emitEnd(decorator); - }); - leadingComma = true; - } - ++parameterIndex; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - switch (node.kind) { - case 141: - case 143: - case 144: - case 139: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - switch (node.kind) { - case 141: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - switch (node.kind) { - case 212: - case 141: - case 144: - return true; - } - return false; - } - function emitSerializedTypeOfNode(node) { - switch (node.kind) { - case 212: - write("Function"); - return; - case 139: - emitSerializedTypeNode(node.type); - return; - case 136: - emitSerializedTypeNode(node.type); - return; - case 143: - emitSerializedTypeNode(node.type); - return; - case 144: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 101: - write("void 0"); - return; - case 158: - emitSerializedTypeNode(node.type); - return; - case 150: - case 151: - write("Function"); - return; - case 154: - case 155: - write("Array"); - return; - case 148: - case 118: - write("Boolean"); - return; - case 128: - case 9: - write("String"); - return; - case 126: - write("Number"); - return; - case 129: - write("Symbol"); - return; - case 149: - emitSerializedTypeReferenceNode(node); - return; - case 152: - case 153: - case 156: - case 157: - case 115: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - function emitSerializedParameterTypesOfNode(node) { - if (node) { - var valueDeclaration; - if (node.kind === 212) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; - if (parameterCount > 0) { - for (var i = 0; i < parameterCount; i++) { - if (i > 0) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType.kind === 154) { - parameterType = parameterType.elementType; - } - else if (parameterType.kind === 149 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node) && node.type) { - emitSerializedTypeNode(node.type); - return; - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitCommentsOnNotEmittedNode(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - scopeEmitStart(node); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 216) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); - } - function emitModuleDeclaration(node) { - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitCommentsOnNotEmittedNode(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - if (node.body.kind === 217) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - scopeEmitStart(node); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16, moduleBlock.statements.end); - scopeEmitEnd(); - } - write(")("); - if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 67 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 219) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 220 && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (languageVersion < 2) { - return emitExternalImportDeclaration(node); - } - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 222) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 219 && (node.flags & 1) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (compilerOptions.module !== 2) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - if (!isExportedImport) - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - var isNakedImport = 220 && !node.importClause; - if (!isNakedImport) { - write("var "); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - var variableDeclarationIsHoisted = shouldHoistVariable(node, true); - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(compilerOptions.module !== 4); - if (languageVersion < 2) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - if (compilerOptions.module !== 2) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - writeLine(); - write("__export("); - if (compilerOptions.module !== 2) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(languageVersion >= 2); - var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= 2) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 211 && - expression.kind !== 212) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0) { - write("[\"default\"] = "); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = {}; - exportEquals = undefined; - hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 220: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { - externalImports.push(node); - } - break; - case 219: - if (node.moduleReference.kind === 230 && resolver.isReferencedAliasDeclaration(node)) { - externalImports.push(node); - } - break; - case 226: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStars = true; - } - else if (resolver.isValueAliasDeclaration(node)) { - externalImports.push(node); - } - } - else { - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_24 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_24] || (exportSpecifiers[name_24] = [])).push(specifier); - } - } - break; - case 225: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStars) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - if (node.kind === 220 && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 226 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; - var skipNode = importNode.kind === 226 || - (importNode.kind === 220 && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - if (!hasExportStars) { - return undefined; - } - if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { - var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; - if (externalImport.kind === 226 && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - return emitExportStarFunction(undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - writeExportedName(specifier.name); - } - } - } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; - if (externalImport.kind !== 226) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - if (node.kind !== 67 && node.flags & 1024) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 67) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { - var local = hoistedVars[i]; - var name_25 = local.kind === 67 - ? local - : local.name; - if (name_25) { - var text = ts.unescapeIdentifier(name_25.text); - if (ts.hasProperty(seen, text)) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 212 || local.kind === 216 || local.kind === 215) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 67 ? local.parent : local); - if (flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; - writeLine(); - emit(f); - if (f.flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2) { - return; - } - if (node.kind === 211) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 212) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 215) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 216) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 209 || node.kind === 161) { - if (shouldHoistVariable(node, false)) { - var name_26 = node.name; - if (name_26.kind === 67) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_26); - } - else { - ts.forEachChild(name_26, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - return (ts.getCombinedNodeFlags(node) & 49152) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 246; - } - function isCurrentFileSystemExternalModule() { - return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); - emitTempDeclarations(true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 220: - if (!entry.importClause) { - break; - } - case 219: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 226: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_2]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - writeLine(); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { - var statement = node.statements[i]; - switch (statement.kind) { - case 211: - case 220: - continue; - case 226: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 219: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - continue; - } - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); - } - function emitSystemModule(node, startIndex) { - collectExternalModuleInfo(node); - ts.Debug.assert(!exportFunctionForFile); - exportFunctionForFile = makeUniqueName("exports"); - writeLine(); - write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - write("["); - var groupIndices = {}; - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ") {"); - writeLine(); - increaseIndent(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitAMDDependencies(node, includeNonAmdDependencies) { - var aliasedModuleNames = []; - var unaliasedModuleNames = []; - var importAliasNames = []; - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); - } - } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; - var externalModuleName = getExternalModuleNameText(importNode); - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - write("[\"require\", \"exports\""); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } - write("], function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - } - function emitAMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, true); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(false); - } - function emitUMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); - emitAMDDependencies(node, false); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node, startIndex) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); - } - } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2: - jsxEmitReact(node); - break; - case 1: - default: - jsxEmitPreserve(node); - break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpace(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - if (result) { - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); - } - else { - return s; - } - }); - } - return result; - } - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1: - default: - return ts.getTextOfNode(node, true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2: - write("\""); - write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); - break; - case 1: - default: - writer.writeLiteral(ts.getTextOfNode(node, true)); - break; - } - } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2: - emit(node.expression); - break; - } - } - } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - return i; - } - } - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - writeLine(); - emitShebang(); - emitDetachedComments(node); - var startIndex = emitDirectivePrologues(node.statements, false); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= 2) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === 2) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === 4) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === 3) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } - } - else { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - emitLeadingComments(node.endOfFileToken); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2) { - return emitCommentsOnNotEmittedNode(node); - } - if (isSpecializedCommentHandling(node)) { - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - case 213: - case 211: - case 220: - case 219: - case 214: - case 225: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 191: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 216: - return shouldEmitModuleDeclaration(node); - case 215: - return shouldEmitEnumDeclaration(node); - } - ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 190 && - node.parent && - node.parent.kind === 172 && - node.parent.body === node && - compilerOptions.target <= 1) { - return false; - } - return true; - } - function emitJavaScriptWorker(node) { - switch (node.kind) { - case 67: - return emitIdentifier(node); - case 136: - return emitParameter(node); - case 141: - case 140: - return emitMethod(node); - case 143: - case 144: - return emitAccessor(node); - case 95: - return emitThis(node); - case 93: - return emitSuper(node); - case 91: - return write("null"); - case 97: - return write("true"); - case 82: - return write("false"); - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - return emitLiteral(node); - case 181: - return emitTemplateExpression(node); - case 188: - return emitTemplateSpan(node); - case 231: - case 232: - return emitJsxElement(node); - case 234: - return emitJsxText(node); - case 238: - return emitJsxExpression(node); - case 133: - return emitQualifiedName(node); - case 159: - return emitObjectBindingPattern(node); - case 160: - return emitArrayBindingPattern(node); - case 161: - return emitBindingElement(node); - case 162: - return emitArrayLiteral(node); - case 163: - return emitObjectLiteral(node); - case 243: - return emitPropertyAssignment(node); - case 244: - return emitShorthandPropertyAssignment(node); - case 134: - return emitComputedPropertyName(node); - case 164: - return emitPropertyAccess(node); - case 165: - return emitIndexedAccess(node); - case 166: - return emitCallExpression(node); - case 167: - return emitNewExpression(node); - case 168: - return emitTaggedTemplateExpression(node); - case 169: - return emit(node.expression); - case 187: - return emit(node.expression); - case 170: - return emitParenExpression(node); - case 211: - case 171: - case 172: - return emitFunctionDeclaration(node); - case 173: - return emitDeleteExpression(node); - case 174: - return emitTypeOfExpression(node); - case 175: - return emitVoidExpression(node); - case 176: - return emitAwaitExpression(node); - case 177: - return emitPrefixUnaryExpression(node); - case 178: - return emitPostfixUnaryExpression(node); - case 179: - return emitBinaryExpression(node); - case 180: - return emitConditionalExpression(node); - case 183: - return emitSpreadElementExpression(node); - case 182: - return emitYieldExpression(node); - case 185: - return; - case 190: - case 217: - return emitBlock(node); - case 191: - return emitVariableStatement(node); - case 192: - return write(";"); - case 193: - return emitExpressionStatement(node); - case 194: - return emitIfStatement(node); - case 195: - return emitDoStatement(node); - case 196: - return emitWhileStatement(node); - case 197: - return emitForStatement(node); - case 199: - case 198: - return emitForInOrForOfStatement(node); - case 200: - case 201: - return emitBreakOrContinueStatement(node); - case 202: - return emitReturnStatement(node); - case 203: - return emitWithStatement(node); - case 204: - return emitSwitchStatement(node); - case 239: - case 240: - return emitCaseOrDefaultClause(node); - case 205: - return emitLabelledStatement(node); - case 206: - return emitThrowStatement(node); - case 207: - return emitTryStatement(node); - case 242: - return emitCatchClause(node); - case 208: - return emitDebuggerStatement(node); - case 209: - return emitVariableDeclaration(node); - case 184: - return emitClassExpression(node); - case 212: - return emitClassDeclaration(node); - case 213: - return emitInterfaceDeclaration(node); - case 215: - return emitEnumDeclaration(node); - case 245: - return emitEnumMember(node); - case 216: - return emitModuleDeclaration(node); - case 220: - return emitImportDeclaration(node); - case 219: - return emitImportEqualsDeclaration(node); - case 226: - return emitExportDeclaration(node); - case 225: - return emitExportAssignment(node); - case 246: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } - function isTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; - } - function getLeadingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - return getLeadingCommentsWithoutDetachedComments(); - } - else { - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - } - } - } - function getTrailingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - } - } - } - function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, false); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, true); - } - function emitLeadingCommentsWorker(node, isEmittedNode) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (isEmittedNode) { - leadingComments = getLeadingCommentsToEmit(node); - } - else { - if (node.pos === 0) { - leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); - } - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitTrailingComments(node) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = getTrailingCommentsToEmit(node); - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); - } - function emitTrailingCommentsOfPosition(pos) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); - } - function emitLeadingCommentsOfPositionWorker(pos) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (hasDetachedComments(pos)) { - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); - } - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - } - } - function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); - if (shebang) { - write(shebang); - } - } - } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); - } - } - } - ts.emitFiles = emitFiles; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -29323,6 +24298,5552 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }; + function emitFiles(resolver, host, targetSourceFile) { + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + var jsxDesugaring = host.getCompilerOptions().jsx !== 1; + var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + else { + if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + return false; + } + } + } + return true; + } + function emitJavaScript(jsFilePath, root) { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var exportFunctionForFile; + var generatedNameSet = {}; + var nodeToGeneratedName = []; + var computedPropertyNamesToGeneratedNames; + var extendsEmitted = false; + var decorateEmitted = false; + var paramEmitted = false; + var awaiterEmitted = false; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStars; + var writeEmittedFiles = writeJavaScriptFile; + var detachedCommentsInfo; + var writeComment = ts.writeCommentRange; + var emit = emitNodeWithCommentsAndWithoutSourcemap; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; + var sourceMapData; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var moduleEmitDelegates = (_a = {}, + _a[5] = emitES6Module, + _a[2] = emitAMDModule, + _a[4] = emitSystemModule, + _a[3] = emitUMDModule, + _a[1] = emitCommonJSModule, + _a + ); + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emitSourceFile(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + emit(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_19 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_19)) { + tempFlags |= flags; + return name_19; + } + } + while (true) { + var count = tempFlags & 268435455; + tempFlags++; + if (count !== 8 && count !== 13) { + var name_20 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_20)) { + return name_20; + } + } + } + } + function makeUniqueName(baseName) { + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69: + return makeUniqueName(node.text); + case 218: + case 217: + return generateNameForModuleOrEnum(node); + case 222: + case 228: + return generateNameForImportOrExportDeclaration(node); + case 213: + case 214: + case 227: + return generateNameForExportDefault(); + case 186: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + var name_21 = node.name; + if (!name_21 || name_21.kind !== 136) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + recordScopeNameStart(scopeName); + } + else if (node.kind === 213 || + node.kind === 173 || + node.kind === 143 || + node.kind === 142 || + node.kind === 145 || + node.kind === 146 || + node.kind === 218 || + node.kind === 214 || + node.kind === 217) { + if (node.name) { + var name_22 = node.name; + scopeName = name_22.kind === 136 + ? ts.getTextOfNode(name_22) + : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { + if (typeof JSON !== "undefined") { + var map_1 = { + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); + sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithSourceMap(node) { + if (node) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind !== 248) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMap(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNodeWithoutSourceMap(node); + } + } + } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithCommentsAndWithSourcemap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, false, false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98: + case 66: + case 111: + case 79: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText("\"", node.text, "\""); + } + if (node.parent) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + switch (node.kind) { + case 9: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var isLast = node.kind === 11 || node.kind === 14; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + if (node.template.kind === 183) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 181 + && templateSpan.expression.operatorToken.kind === 24; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + if (languageVersion >= 2) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 172 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 168: + case 169: + return parent.expression === template; + case 170: + case 172: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 181: + switch (expression.operatorToken.kind) { + case 37: + case 39: + case 40: + return 1; + case 35: + case 36: + return 0; + default: + return -1; + } + case 184: + case 182: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + function emitTagName(name) { + if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitAttributeName(name) { + if (/[A-Za-z_]+[\w*]/.test(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69); + syntheticReactRef.text = "React"; + syntheticReactRef.parent = openingNode; + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + if (openingNode.attributes.length === 0) { + write("null"); + } + else { + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 239; })) { + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); + var haveOpenedObjectLiteral = false; + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 239) { + if (i_1 === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i_1 > 0) { + write(", "); + } + emit(attrs[i_1].expression); + } + else { + ts.Debug.assert(attrs[i_1].kind === 238); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i_1 > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i_1]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); + } + else { + write("{"); + for (var i = 0; i < attrs.length; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + if (children) { + for (var i = 0; i < children.length; i++) { + if (children[i].kind === 240 && !(children[i].expression)) { + continue; + } + if (children[i].kind === 236) { + var text = getTextToEmit(children[i]); + if (text !== undefined) { + write(", \""); + write(text); + write("\""); + } + } + else { + write(", "); + emit(children[i]); + } + } + } + write(")"); + emitTrailingComments(openingNode); + } + if (node.kind === 233) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 239) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 238); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 234)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 234) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 233) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxOpeningOrSelfClosingElement(node); + } + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 163); + if (node.kind === 9) { + emitLiteral(node); + } + else if (node.kind === 136) { + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write("\""); + if (node.kind === 8) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 164: + case 189: + case 181: + case 168: + case 241: + case 136: + case 182: + case 139: + case 175: + case 197: + case 167: + case 227: + case 195: + case 188: + case 199: + case 200: + case 201: + case 196: + case 234: + case 235: + case 239: + case 240: + case 169: + case 172: + case 180: + case 179: + case 204: + case 246: + case 185: + case 206: + case 170: + case 190: + case 208: + case 171: + case 176: + case 177: + case 198: + case 205: + case 184: + return true; + case 163: + case 247: + case 138: + case 245: + case 141: + case 211: + return parent.initializer === node; + case 166: + return parent.expression === node; + case 174: + case 173: + return parent.body === node; + case 221: + return parent.moduleReference === node; + case 135: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + if (resolver.getNodeCheckFlags(node) & 2048) { + write("_arguments"); + return; + } + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 248) { + if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + else { + write(getGeneratedNameForNode(container)); + write("."); + } + } + else if (modulekind !== 5) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 223) { + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 ? "[\"default\"]" : ".default"); + return; + } + else if (declaration.kind === 226) { + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_23 = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + if (languageVersion === 0 && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } + return; + } + } + declaration = resolver.getReferencedNestedRedeclaration(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function isNameOfNestedRedeclaration(node) { + if (languageVersion < 2) { + var parent_6 = node.parent; + switch (parent_6.kind) { + case 163: + case 214: + case 217: + case 211: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + } + } + return false; + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedRedeclaration(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 181 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 182 && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69: + case 164: + case 166: + case 167: + case 168: + case 172: + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 185) { + e = e.expression; + emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 185) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 185; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + write("]"); + } + else { + emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + if (numElements === properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + else { + var multiLine = (node.flags & 2048) !== 0; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, multiLine, false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = (node.flags & 2048) !== 0; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + var tempVar = createAndRecordTempVariable(0); + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 145 || property.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 245) { + emit(property.initializer); + } + else if (property.kind === 246) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 143) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 136) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(181, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(166); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(167); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + while (expr.kind === 171 || expr.kind === 189) { + expr = expr.expression; + } + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 169 && + expr.kind !== 8) { + return expr; + } + var node = ts.createSynthesizedNode(172); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 248; + } + function emitShorthandPropertyAssignment(node) { + writeTextOfNode(currentSourceFile, node.name); + if (languageVersion < 2 || isNamespaceExportReference(node.name)) { + write(": "); + emit(node.name); + } + if (languageVersion >= 2 && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 166 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 166 || node.kind === 167 + ? resolver.getConstantValue(node) + : undefined; + } + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var shouldEmitSpace; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 135: + emitQualifiedNameAsExpression(node, useFallback); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 185; }); + } + function skipParentheses(node) { + while (node.kind === 172 || node.kind === 171 || node.kind === 189) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 || node.kind === 97 || node.kind === 95) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 166) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 167) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false, false, true); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 95) { + emitSuper(node.expression); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 166 && node.expression.expression.kind === 95; + } + if (superCall && languageVersion < 2) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + if (languageVersion === 1 && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, false, false, false, false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174) { + if (node.expression.kind === 171 || node.expression.kind === 189) { + var operand = node.expression.expression; + while (operand.kind === 171 || operand.kind === 189) { + operand = operand.expression; + } + if (operand.kind !== 179 && + operand.kind !== 177 && + operand.kind !== 176 && + operand.kind !== 175 && + operand.kind !== 180 && + operand.kind !== 169 && + !(operand.kind === 168 && node.parent.kind === 169) && + !(operand.kind === 173 && node.parent.kind === 168) && + !(operand.kind === 8 && node.parent.kind === 166)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 || node.parent.kind === 163); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 179) { + var operand = node.operand; + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { + write(" "); + } + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 248) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 219) { + return false; + } + else { + current = current.parent; + } + } + } + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60) { + var synthesizedLHS; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(167, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 && + leftHandSideExpression.argumentExpression.kind !== 9) { + var tempArgumentExpression = createAndRecordTempVariable(268435456); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(166, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 56 && + (node.left.kind === 165 || node.left.kind === 164)) { + emitDestructuring(node, node.parent.kind === 195); + } + else { + var exportChanged = node.operatorToken.kind >= 56 && + node.operatorToken.kind <= 68 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 || node.operatorToken.kind === 60) { + emitExponentiationOperator(node); + } + else { + emit(node.left); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 192) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15, node.pos); + write(" "); + emitToken(16, node.statements.end); + return; + } + emitToken(15, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 219) { + ts.Debug.assert(node.parent.kind === 218); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 219) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(16, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 192) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, node.expression.kind === 174); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88, node.pos); + write(" "); + endPos = emitToken(17, endPos); + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80, node.thenStatement.end); + if (node.elseStatement.kind === 196) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 192) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + return false; + } + var tokenKind = 102; + if (decl && languageVersion >= 2) { + if (ts.isLet(decl)) { + tokenKind = 108; + } + else if (ts.isConst(decl)) { + tokenKind = 74; + } + } + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + write(" "); + } + else { + switch (tokenKind) { + case 102: + write("var "); + break; + case 108: + write("let "); + break; + case 74: + write("const "); + break; + } + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function emitForStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 201) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 200) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + var rhsIsIdentifier = node.expression.kind === 69; + var counter = createTempVariable(268435456); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(18, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 212) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(0)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); + if (node.initializer.kind === 164 || node.initializer.kind === 165) { + emitDestructuring(assignmentExpression, true, undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 192) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 203 ? 70 : 75, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(94, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.expression); + endPos = emitToken(18, node.expression.end); + write(" "); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(15, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 241) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.variableDeclaration); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 218); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8); + zero.text = "0"; + var result = ts.createSynthesizedNode(177); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 248) { + ts.Debug.assert(!!(node.flags & 1024) || node.kind === 227); + if (modulekind === 1 || modulekind === 2 || modulekind === 3) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1) { + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1) { + writeLine(); + emitStart(node); + if (modulekind === 4 && node.parent === currentSourceFile) { + write(exportFunctionForFile + "(\""); + if (node.flags & 1024) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 1024) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === 4) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === 4); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 || name.parent.kind === 163); + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + if (exportChanged) { + write(")"); + } + } + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + return identifier; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + var canDefineTempVariablesInPlace = false; + if (root.kind === 211) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 138) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 181) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + emitBindingElement(root, value); + } + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 69 && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue) { + value = ensureIdentifier(value, true); + var equals = ts.createSynthesizedNode(181); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(182); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + var syntheticName = ts.createSynthesizedNode(propName.kind); + syntheticName.text = propName.text; + if (syntheticName.kind !== 69) { + return createElementAccessExpression(object, syntheticName); + } + return createPropertyAccessExpression(object, syntheticName); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(168); + var sliceIdentifier = ts.createSynthesizedNode(69); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 245 || p.kind === 246) { + var propName = p.name; + var target_1 = p.kind === 246 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 187) { + if (e.kind !== 185) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 246) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + } + target = target.name; + } + else if (target.kind === 181 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 165) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 164) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value, emitCount > 0); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 172) { + write("("); + } + value = ensureIdentifier(value, true); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 172) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 161) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 187) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, emitCount > 0); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2) { + emitDestructuring(node, false); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + var initializer = node.initializer; + if (!initializer && languageVersion < 2) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && + (getCombinedFlagsForIdentifier(node.name) & 16384); + if (isUninitializedLet && + node.parent.parent.kind !== 200 && + node.parent.parent.kind !== 201) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 187) { + return; + } + var name = node.name; + if (name.kind === 69) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function getCombinedFlagsForIdentifier(node) { + if (!node.parent || (node.parent.kind !== 211 && node.parent.kind !== 163)) { + return 0; + } + return ts.getCombinedNodeFlags(node.parent); + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1) && + modulekind === 5 && + node.parent.kind === 248; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + if (!(node.flags & 1)) { + return true; + } + if (isES6ExportedDeclaration(node)) { + return true; + } + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name_24 = createTempVariable(0); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_24); + emit(name_24); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2) { + var tempIndex = 0; + ts.forEach(node.parameters, function (parameter) { + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, false, tempParameters[tempIndex]); + } + else { + emit(tempParameters[tempIndex]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 145 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 174 && languageVersion >= 2; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 173) { + return !!node.name; + } + if (node.kind === 213) { + return !!node.name || languageVersion < 2; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + if (node.kind !== 143 && node.kind !== 142 && + node.parent && node.parent.kind !== 245 && + node.parent.kind !== 168) { + emitLeadingComments(node); + } + emitStart(node); + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== 5 && node.kind === 213 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (node.kind !== 143 && node.kind !== 142) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, false, false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 174; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var args; + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments"); + } + else { + write(", void 0"); + } + if (promiseConstructor) { + write(", "); + emitNodeWithoutSourceMap(promiseConstructor); + } + else { + write(", Promise"); + } + if (hasLexicalArguments) { + write(", function* (_arguments)"); + } + else { + write(", function* ()"); + } + emitFunctionBody(node); + write(")"); + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + write(" { }"); + } + else { + if (node.body.kind === 192) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync && languageVersion === 2) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 || node.flags & 512) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + write(" "); + var current = body; + while (current.kind === 171) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 165); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 195) { + var expr = statement.expression; + if (expr && expr.kind === 168) { + var func = expr.expression; + if (func && func.kind === 95) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 9 || memberName.kind === 8) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 136) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 141 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0; _a < properties.length; _a++) { + var property = properties[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 128) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 191) { + writeLine(); + write(";"); + } + else if (member.kind === 143 || node.kind === 142) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 145 || member.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 143 || node.kind === 142) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 143 || + member.kind === 145 || + member.kind === 146) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 128) { + write("static "); + } + if (member.kind === 145) { + write("get "); + } + else if (member.kind === 146) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 191) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + var hasInstancePropertyWithInitializer = false; + ts.forEach(node.members, function (member) { + if (member.kind === 144 && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + if (member.kind === 141 && member.initializer && (member.flags & 128) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== 5 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var thisNodeIsDecorated = ts.nodeIsDecorated(node); + if (node.kind === 214) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + } + var staticProperties = getInitializedProperties(node, true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + if ((node.name || (node.flags & 1024 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + scopeEmitStart(node); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + if (thisNodeIsDecorated) { + write(";"); + } + if (isClassExpressionWithStaticProperties) { + for (var _a = 0; _a < staticProperties.length; _a++) { + var property = staticProperties[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, tempVariable, true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node); + } + if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 214) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, true)); + writeLine(); + emitDecoratorsOfClass(node); + writeLine(); + emitToken(16, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(true); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 214) { + write(";"); + } + emitEnd(node); + if (node.kind === 214) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 128)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node) { + emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, 128); + emitDecoratorsOfConstructor(node); + } + function emitDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + if (!decorators && !hasDecoratedParameters) { + return; + } + writeLine(); + emitStart(node); + emitDeclarationName(node); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + emitSerializedTypeMetadata(node, argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(");"); + emitEnd(node); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.flags & 128) !== staticFlag) { + continue; + } + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + if (!ts.nodeOrChildIsDecorated(member)) { + continue; + } + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + if (member.kind === 143) { + functionLikeMember = member; + } + } + writeLine(); + emitStart(member); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + if (languageVersion > 0) { + if (member.kind !== 141) { + write(", null"); + } + else { + write(", void 0"); + } + } + write(");"); + emitEnd(member); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + emitStart(decorator); + write("__param(" + parameterIndex + ", "); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + switch (node.kind) { + case 143: + case 145: + case 146: + case 141: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + switch (node.kind) { + case 143: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + switch (node.kind) { + case 214: + case 143: + case 146: + return true; + } + return false; + } + function emitSerializedTypeOfNode(node) { + switch (node.kind) { + case 214: + write("Function"); + return; + case 141: + emitSerializedTypeNode(node.type); + return; + case 138: + emitSerializedTypeNode(node.type); + return; + case 145: + emitSerializedTypeNode(node.type); + return; + case 146: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103: + write("void 0"); + return; + case 160: + emitSerializedTypeNode(node.type); + return; + case 152: + case 153: + write("Function"); + return; + case 156: + case 157: + write("Array"); + return; + case 150: + case 120: + write("Boolean"); + return; + case 130: + case 9: + write("String"); + return; + case 128: + write("Number"); + return; + case 131: + write("Symbol"); + return; + case 151: + emitSerializedTypeReferenceNode(node); + return; + case 154: + case 155: + case 158: + case 159: + case 117: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + function emitSerializedParameterTypesOfNode(node) { + if (node) { + var valueDeclaration; + if (node.kind === 214) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 156) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 151 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 218) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 219) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 221) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 222 && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== 5) { + return emitExternalImportDeclaration(node); + } + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 224) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 221 && (node.flags & 1) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (modulekind !== 2) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + if (!isExportedImport) + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + var isNakedImport = 222 && !node.importClause; + if (!isNakedImport) { + write("var "); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== 4); + if (modulekind !== 5) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + if (modulekind !== 2) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + writeLine(); + write("__export("); + if (modulekind !== 2) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === 5); + var needsComma = false; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === 5) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 213 && + expression.kind !== 214) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === 4) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStars = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 222: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, true)) { + externalImports.push(node); + } + break; + case 221: + if (node.moduleReference.kind === 232 && resolver.isReferencedAliasDeclaration(node)) { + externalImports.push(node); + } + break; + case 228: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStars = true; + } + else if (resolver.isValueAliasDeclaration(node)) { + externalImports.push(node); + } + } + else { + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_25 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_25] || (exportSpecifiers[name_25] = [])).push(specifier); + } + } + break; + case 227: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStars) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + if (node.kind === 222 && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 228 && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + var skipNode = importNode.kind === 228 || + (importNode.kind === 222 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStars) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 228 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 228) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 69 && node.flags & 1024) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + var name_26 = local.kind === 69 + ? local + : local.name; + if (name_26) { + var text = ts.unescapeIdentifier(name_26.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 214 || local.kind === 218 || local.kind === 217) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2) { + return; + } + if (node.kind === 213) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 214) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 217) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 211 || node.kind === 163) { + if (shouldHoistVariable(node, false)) { + var name_27 = node.name; + if (name_27.kind === 69) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_27); + } + else { + ts.forEachChild(name_27, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 49152) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 248; + } + function isCurrentFileSystemExternalModule() { + return modulekind === 4 && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); + emitTempDeclarations(true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 222: + if (!entry.importClause) { + break; + } + case 221: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 228: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + case 213: + case 222: + continue; + case 228: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 221: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSystemModule(node) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + writeLine(); + write("System.register("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push("\"" + amdDependency.path + "\""); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + } + } + for (var _c = 0; _c < externalImports.length; _c++) { + var importNode = externalImports[_c]; + var externalModuleName = getExternalModuleNameText(importNode); + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write("[\"require\", \"exports\""); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + emitAMDDependencies(node, true); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(false); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, false); + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2: + jsxEmitReact(node); + break; + case 1: + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; + } + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1: + default: + return ts.getTextOfNode(node, true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2: + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); + break; + case 1: + default: + writer.writeLiteral(ts.getTextOfNode(node, true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2: + emit(node.expression); + break; + } + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + if (!compilerOptions.noEmitHelpers) { + if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedComments(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + emitModule(node); + } + else { + var startIndex = emitDirectivePrologues(node.statements, false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 215: + case 213: + case 222: + case 221: + case 216: + case 227: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 193: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 218: + return shouldEmitModuleDeclaration(node); + case 217: + return shouldEmitEnumDeclaration(node); + } + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 192 && + node.parent && + node.parent.kind === 174 && + node.parent.body === node && + compilerOptions.target <= 1) { + return false; + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 69: + return emitIdentifier(node); + case 138: + return emitParameter(node); + case 143: + case 142: + return emitMethod(node); + case 145: + case 146: + return emitAccessor(node); + case 97: + return emitThis(node); + case 95: + return emitSuper(node); + case 93: + return write("null"); + case 99: + return write("true"); + case 84: + return write("false"); + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + return emitLiteral(node); + case 183: + return emitTemplateExpression(node); + case 190: + return emitTemplateSpan(node); + case 233: + case 234: + return emitJsxElement(node); + case 236: + return emitJsxText(node); + case 240: + return emitJsxExpression(node); + case 135: + return emitQualifiedName(node); + case 161: + return emitObjectBindingPattern(node); + case 162: + return emitArrayBindingPattern(node); + case 163: + return emitBindingElement(node); + case 164: + return emitArrayLiteral(node); + case 165: + return emitObjectLiteral(node); + case 245: + return emitPropertyAssignment(node); + case 246: + return emitShorthandPropertyAssignment(node); + case 136: + return emitComputedPropertyName(node); + case 166: + return emitPropertyAccess(node); + case 167: + return emitIndexedAccess(node); + case 168: + return emitCallExpression(node); + case 169: + return emitNewExpression(node); + case 170: + return emitTaggedTemplateExpression(node); + case 171: + return emit(node.expression); + case 189: + return emit(node.expression); + case 172: + return emitParenExpression(node); + case 213: + case 173: + case 174: + return emitFunctionDeclaration(node); + case 175: + return emitDeleteExpression(node); + case 176: + return emitTypeOfExpression(node); + case 177: + return emitVoidExpression(node); + case 178: + return emitAwaitExpression(node); + case 179: + return emitPrefixUnaryExpression(node); + case 180: + return emitPostfixUnaryExpression(node); + case 181: + return emitBinaryExpression(node); + case 182: + return emitConditionalExpression(node); + case 185: + return emitSpreadElementExpression(node); + case 184: + return emitYieldExpression(node); + case 187: + return; + case 192: + case 219: + return emitBlock(node); + case 193: + return emitVariableStatement(node); + case 194: + return write(";"); + case 195: + return emitExpressionStatement(node); + case 196: + return emitIfStatement(node); + case 197: + return emitDoStatement(node); + case 198: + return emitWhileStatement(node); + case 199: + return emitForStatement(node); + case 201: + case 200: + return emitForInOrForOfStatement(node); + case 202: + case 203: + return emitBreakOrContinueStatement(node); + case 204: + return emitReturnStatement(node); + case 205: + return emitWithStatement(node); + case 206: + return emitSwitchStatement(node); + case 241: + case 242: + return emitCaseOrDefaultClause(node); + case 207: + return emitLabelledStatement(node); + case 208: + return emitThrowStatement(node); + case 209: + return emitTryStatement(node); + case 244: + return emitCatchClause(node); + case 210: + return emitDebuggerStatement(node); + case 211: + return emitVariableDeclaration(node); + case 186: + return emitClassExpression(node); + case 214: + return emitClassDeclaration(node); + case 215: + return emitInterfaceDeclaration(node); + case 217: + return emitEnumDeclaration(node); + case 247: + return emitEnumMember(node); + case 218: + return emitModuleDeclaration(node); + case 222: + return emitImportDeclaration(node); + case 221: + return emitImportEqualsDeclaration(node); + case 228: + return emitExportDeclaration(node); + case 227: + return emitExportAssignment(node); + case 248: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + function isTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + return getLeadingCommentsWithoutDetachedComments(); + } + else { + return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + } + } + } + function getTrailingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + } + } + } + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); + ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedComments(node) { + var leadingComments; + if (compilerOptions.removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } + var _a; + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + } + } + } + ts.emitFiles = emitFiles; })(ts || (ts = {})); var ts; (function (ts) { @@ -29369,11 +29890,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -29383,13 +29904,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, loadOnlyDts, failedLookupLocation, host) { - if (loadOnlyDts) { - return tryLoad(".d.ts"); - } - else { - return ts.forEach(ts.supportedExtensions, tryLoad); - } + function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { + return ts.forEach(ts.supportedJsExtensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -29401,7 +29917,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, loadOnlyDts, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -29413,7 +29929,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -29422,7 +29938,7 @@ var ts; else { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -29432,11 +29948,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host); + var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -29454,16 +29970,17 @@ var ts; return i === 0 || (i === 1 && name.charCodeAt(0) === 46); } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - if (moduleName.indexOf('!') != -1) { + if (moduleName.indexOf("!") != -1) { return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { return undefined; } @@ -29763,7 +30280,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(fileName); + return filesByName.get(fileName) || filesByName.get(ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory())); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -29849,13 +30366,18 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; + collect(node, true); + } + file.imports = imports || emptyArray; + function collect(node, allowRelativeModuleNames) { switch (node.kind) { - case 220: - case 219: - case 226: + case 222: + case 221: + case 228: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -29863,24 +30385,35 @@ var ts; if (!moduleNameExpr.text) { break; } - (imports || (imports = [])).push(moduleNameExpr); + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - case 216: - if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9) { - var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); - if (moduleName) { - (imports || (imports = [])).push(moduleName); + case 168: + if (isJavaScriptFile && ts.isRequireCall(node)) { + var jsImports = node.arguments; + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === 9) { + imports.push(jsImports[i]); } } + } + } + break; + case 218: + if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + collect(node, false); }); } break; } + if (ts.isSourceFileJavaScript(file)) { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames); }); + } } - file.imports = imports || emptyArray; } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; @@ -29923,48 +30456,46 @@ var ts; } } function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); - if (filesByName.contains(canonicalName)) { - return getSourceFileFromCache(fileName, canonicalName, false); + if (filesByName.contains(fileName)) { + return getSourceFileFromCache(fileName, false); } - else { - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); - if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); - } - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(canonicalName, file); - if (file) { - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - filesByName.set(canonicalAbsolutePath, file); - var basePath = ts.getDirectoryPath(fileName); - if (!options.noResolve) { - processReferencedFiles(file, basePath); - } - processImportedModules(file, basePath); - if (isDefaultLib) { - file.isDefaultLib = true; - files.unshift(file); - } - else { - files.push(file); - } - } - return file; + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + if (filesByName.contains(normalizedAbsolutePath)) { + var file_1 = getSourceFileFromCache(normalizedAbsolutePath, true); + filesByName.set(fileName, file_1); + return file_1; } - function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName.get(canonicalName); + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(fileName, file); + if (file) { + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + filesByName.set(normalizedAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath); + } + processImportedModules(file, basePath); + if (isDefaultLib) { + file.isDefaultLib = true; + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + function getSourceFileFromCache(fileName, useAbsolutePath) { + var file = filesByName.get(fileName); if (file && host.useCaseSensitiveFileNames()) { var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; - if (canonicalName !== sourceFileName) { + if (ts.normalizeSlashes(fileName) !== ts.normalizeSlashes(sourceFileName)) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } @@ -30125,8 +30656,8 @@ var ts; var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - if (options.module && languageVersion >= 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + if (options.module === 5 && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } if (options.outDir || options.sourceRoot || @@ -30160,10 +30691,6 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.experimentalAsyncFunctions && - options.target !== 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); - } } } ts.createProgram = createProgram; @@ -30240,11 +30767,12 @@ var ts; "commonjs": 1, "amd": 2, "system": 4, - "umd": 3 + "umd": 3, + "es6": 5 }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", @@ -30385,11 +30913,6 @@ var ts; type: "boolean", description: ts.Diagnostics.Watch_input_files }, - { - name: "experimentalAsyncFunctions", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions - }, { name: "experimentalDecorators", type: "boolean", @@ -30576,6 +31099,9 @@ var ts; } if (opt.isFilePath) { value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } options[opt.name] = value; } @@ -30604,20 +31130,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_27 = sysFiles[i]; - if (ts.fileExtensionIs(name_27, ".d.ts")) { - var baseName = name_27.substr(0, name_27.length - ".d.ts".length); + var name_28 = sysFiles[i]; + if (ts.fileExtensionIs(name_28, ".d.ts")) { + var baseName = name_28.substr(0, name_28.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_27); + fileNames.push(name_28); } } - else if (ts.fileExtensionIs(name_27, ".ts")) { - if (!ts.contains(sysFiles, name_27 + "x")) { - fileNames.push(name_27); + else if (ts.fileExtensionIs(name_28, ".ts")) { + if (!ts.contains(sysFiles, name_28 + "x")) { + fileNames.push(name_28); } } else { - fileNames.push(name_27); + fileNames.push(name_28); } } } @@ -30701,6 +31227,15 @@ var ts; reportDiagnostic(diagnostics[i]); } } + function reportWatchDiagnostic(diagnostic) { + var output = new Date().toLocaleTimeString() + " - "; + if (diagnostic.file) { + var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); + output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; + } + output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; + ts.sys.write(output); + } function padLeft(s, length) { while (s.length < length) { s = " " + s; @@ -30794,7 +31329,7 @@ var ts; if (configFileName) { var result = ts.readConfigFile(configFileName, ts.sys.readFile); if (result.error) { - reportDiagnostic(result.error); + reportWatchDiagnostic(result.error); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } var configObject = result.config; @@ -30819,7 +31354,7 @@ var ts; return ts.sys.exit(compileResult.exitStatus); } setCachedProgram(compileResult.program); - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); + reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); } function getSourceFile(fileName, languageVersion, onError) { if (cachedProgram) { @@ -30830,7 +31365,7 @@ var ts; } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && compilerOptions.watch) { - sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { return sourceFileChanged(sourceFile); }); + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (fileName, removed) { return sourceFileChanged(sourceFile, removed); }); } return sourceFile; } @@ -30848,9 +31383,15 @@ var ts; } cachedProgram = program; } - function sourceFileChanged(sourceFile) { + function sourceFileChanged(sourceFile, removed) { sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; + if (removed) { + var index = rootFileNames.indexOf(sourceFile.fileName); + if (index >= 0) { + rootFileNames.splice(index, 1); + } + } startTimer(); } function configFileChanged() { @@ -30865,7 +31406,7 @@ var ts; } function recompile() { timerHandle = undefined; - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation)); + reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation)); performCompilation(); } } @@ -30993,7 +31534,7 @@ var ts; } function writeConfigFile(options, fileNames) { var currentDirectory = ts.sys.getCurrentDirectory(); - var file = ts.combinePaths(currentDirectory, 'tsconfig.json'); + var file = ts.combinePaths(currentDirectory, "tsconfig.json"); if (ts.sys.fileExists(file)) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)); } @@ -31013,10 +31554,10 @@ var ts; function serializeCompilerOptions(options) { var result = {}; var optionsNameMap = ts.getOptionNameMap().optionNameMap; - for (var name_28 in options) { - if (ts.hasProperty(options, name_28)) { - var value = options[name_28]; - switch (name_28) { + for (var name_29 in options) { + if (ts.hasProperty(options, name_29)) { + var value = options[name_29]; + switch (name_29) { case "init": case "watch": case "version": @@ -31024,17 +31565,17 @@ var ts; case "project": break; default: - var optionDefinition = optionsNameMap[name_28.toLowerCase()]; + var optionDefinition = optionsNameMap[name_29.toLowerCase()]; if (optionDefinition) { if (typeof optionDefinition.type === "string") { - result[name_28] = value; + result[name_29] = value; } else { var typeMap = optionDefinition.type; for (var key in typeMap) { if (ts.hasProperty(typeMap, key)) { if (typeMap[key] === value) - result[name_28] = key; + result[name_29] = key; } } } diff --git a/lib/tsserver.js b/lib/tsserver.js index 82199e1222d..0368e826f13 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -410,8 +410,11 @@ var ts; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { - Debug.assert(!headChain.next); - headChain.next = tailChain; + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; @@ -650,6 +653,7 @@ var ts; } ts.fileExtensionIs = fileExtensionIs; ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -949,10 +953,14 @@ var ts; close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { + if (curr.mtime.getTime() === 0) { + callback(fileName, true); + return; + } if (+curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, false); } }, resolvePath: function (path) { @@ -1050,7 +1058,7 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, @@ -1138,7 +1146,7 @@ var ts; Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -1156,10 +1164,9 @@ var ts; An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, @@ -1188,10 +1195,6 @@ var ts; An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -1202,6 +1205,10 @@ var ts; _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "'=' can only be used in an object literal property inside a destructuring assignment." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1326,7 +1333,7 @@ var ts; In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, @@ -1414,6 +1421,9 @@ var ts; yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A module cannot have multiple default exports." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -1514,7 +1524,7 @@ var ts; Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1526,7 +1536,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -1547,7 +1557,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -1568,7 +1578,6 @@ var ts; Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, @@ -1615,81 +1624,83 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } }; })(ts || (ts = {})); var ts; (function (ts) { function tokenIsIdentifierOrKeyword(token) { - return token >= 67; + return token >= 69; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { - "abstract": 113, - "any": 115, - "as": 114, - "boolean": 118, - "break": 68, - "case": 69, - "catch": 70, - "class": 71, - "continue": 73, - "const": 72, - "constructor": 119, - "debugger": 74, - "declare": 120, - "default": 75, - "delete": 76, - "do": 77, - "else": 78, - "enum": 79, - "export": 80, - "extends": 81, - "false": 82, - "finally": 83, - "for": 84, - "from": 131, - "function": 85, - "get": 121, - "if": 86, - "implements": 104, - "import": 87, - "in": 88, - "instanceof": 89, - "interface": 105, - "is": 122, - "let": 106, - "module": 123, - "namespace": 124, - "new": 90, - "null": 91, - "number": 126, - "package": 107, - "private": 108, - "protected": 109, - "public": 110, - "require": 125, - "return": 92, - "set": 127, - "static": 111, - "string": 128, - "super": 93, - "switch": 94, - "symbol": 129, - "this": 95, - "throw": 96, - "true": 97, - "try": 98, - "type": 130, - "typeof": 99, - "var": 100, - "void": 101, - "while": 102, - "with": 103, - "yield": 112, - "async": 116, - "await": 117, - "of": 132, + "abstract": 115, + "any": 117, + "as": 116, + "boolean": 120, + "break": 70, + "case": 71, + "catch": 72, + "class": 73, + "continue": 75, + "const": 74, + "constructor": 121, + "debugger": 76, + "declare": 122, + "default": 77, + "delete": 78, + "do": 79, + "else": 80, + "enum": 81, + "export": 82, + "extends": 83, + "false": 84, + "finally": 85, + "for": 86, + "from": 133, + "function": 87, + "get": 123, + "if": 88, + "implements": 106, + "import": 89, + "in": 90, + "instanceof": 91, + "interface": 107, + "is": 124, + "let": 108, + "module": 125, + "namespace": 126, + "new": 92, + "null": 93, + "number": 128, + "package": 109, + "private": 110, + "protected": 111, + "public": 112, + "require": 127, + "return": 94, + "set": 129, + "static": 113, + "string": 130, + "super": 95, + "switch": 96, + "symbol": 131, + "this": 97, + "throw": 98, + "true": 99, + "try": 100, + "type": 132, + "typeof": 101, + "var": 102, + "void": 103, + "while": 104, + "with": 105, + "yield": 114, + "async": 118, + "await": 119, + "of": 134, "{": 15, "}": 16, "(": 17, @@ -1711,37 +1722,39 @@ var ts; "=>": 34, "+": 35, "-": 36, + "**": 38, "*": 37, - "/": 38, - "%": 39, - "++": 40, - "--": 41, - "<<": 42, + "/": 39, + "%": 40, + "++": 41, + "--": 42, + "<<": 43, ">": 43, - ">>>": 44, - "&": 45, - "|": 46, - "^": 47, - "!": 48, - "~": 49, - "&&": 50, - "||": 51, - "?": 52, - ":": 53, - "=": 55, - "+=": 56, - "-=": 57, - "*=": 58, - "/=": 59, - "%=": 60, - "<<=": 61, - ">>=": 62, - ">>>=": 63, - "&=": 64, - "|=": 65, - "^=": 66, - "@": 54 + ">>": 44, + ">>>": 45, + "&": 46, + "|": 47, + "^": 48, + "!": 49, + "~": 50, + "&&": 51, + "||": 52, + "?": 53, + ":": 54, + "=": 56, + "+=": 57, + "-=": 58, + "*=": 59, + "**=": 60, + "/=": 61, + "%=": 62, + "<<=": 63, + ">>=": 64, + ">>>=": 65, + "&=": 66, + "|=": 67, + "^=": 68, + "@": 55 }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; @@ -2143,8 +2156,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 67 || token > 103; }, - isReservedWord: function () { return token >= 68 && token <= 103; }, + isIdentifier: function () { return token === 69 || token > 105; }, + isReservedWord: function () { return token >= 70 && token <= 105; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2166,16 +2179,6 @@ var ts; onError(message, length || 0); } } - function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); - } function scanNumber() { var start = pos; while (isDigit(text.charCodeAt(pos))) @@ -2430,12 +2433,12 @@ var ts; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { + if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92) { ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); @@ -2458,7 +2461,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 67; + return token = 69; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -2537,7 +2540,7 @@ var ts; } return pos += 2, token = 31; } - return pos++, token = 48; + return pos++, token = 49; case 34: case 39: tokenValue = scanString(); @@ -2546,42 +2549,48 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 60; + return pos += 2, token = 62; } - return pos++, token = 39; + return pos++, token = 40; case 38: if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 50; + return pos += 2, token = 51; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; + return pos += 2, token = 66; } - return pos++, token = 45; + return pos++, token = 46; case 40: return pos++, token = 17; case 41: return pos++, token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; + return pos += 2, token = 59; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 38; } return pos++, token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 40; + return pos += 2, token = 41; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 56; + return pos += 2, token = 57; } return pos++, token = 35; case 44: return pos++, token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 41; + return pos += 2, token = 42; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 57; + return pos += 2, token = 58; } return pos++, token = 36; case 46: @@ -2636,9 +2645,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; + return pos += 2, token = 61; } - return pos++, token = 38; + return pos++, token = 39; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2686,7 +2695,7 @@ var ts; tokenValue = "" + scanNumber(); return token = 8; case 58: - return pos++, token = 53; + return pos++, token = 54; case 59: return pos++, token = 23; case 60: @@ -2701,14 +2710,16 @@ var ts; } if (text.charCodeAt(pos + 1) === 60) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 61; + return pos += 3, token = 63; } - return pos += 2, token = 42; + return pos += 2, token = 43; } if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 28; } - if (text.charCodeAt(pos + 1) === 47 && languageVariant === 1) { + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { return pos += 2, token = 26; } return pos++, token = 25; @@ -2731,7 +2742,7 @@ var ts; if (text.charCodeAt(pos + 1) === 62) { return pos += 2, token = 34; } - return pos++, token = 55; + return pos++, token = 56; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2744,35 +2755,35 @@ var ts; } return pos++, token = 27; case 63: - return pos++, token = 52; + return pos++, token = 53; case 91: return pos++, token = 19; case 93: return pos++, token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 66; + return pos += 2, token = 68; } - return pos++, token = 47; + return pos++, token = 48; case 123: return pos++, token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 51; + return pos += 2, token = 52; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; + return pos += 2, token = 67; } - return pos++, token = 46; + return pos++, token = 47; case 125: return pos++, token = 16; case 126: - return pos++, token = 49; + return pos++, token = 50; case 64: - return pos++, token = 54; + return pos++, token = 55; case 92: var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); @@ -2780,9 +2791,9 @@ var ts; error(ts.Diagnostics.Invalid_character); return pos++, token = 0; default: - if (isIdentifierStart(ch)) { + if (isIdentifierStart(ch, languageVersion)) { pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92) { @@ -2809,14 +2820,14 @@ var ts; if (text.charCodeAt(pos) === 62) { if (text.charCodeAt(pos + 1) === 62) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 63; + return pos += 3, token = 65; } - return pos += 2, token = 44; + return pos += 2, token = 45; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 62; + return pos += 2, token = 64; } - return pos++, token = 43; + return pos++, token = 44; } if (text.charCodeAt(pos) === 61) { return pos++, token = 29; @@ -2825,7 +2836,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 38 || token === 59) { + if (token === 39 || token === 61) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2859,7 +2870,7 @@ var ts; } p++; } - while (p < end && isIdentifierPart(text.charCodeAt(p))) { + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; @@ -2902,14 +2913,14 @@ var ts; break; } } - return token = 234; + return token = 236; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) { + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { pos++; } else { @@ -3044,11 +3055,12 @@ var ts; "commonjs": 1, "amd": 2, "system": 4, - "umd": 3 + "umd": 3, + "es6": 5 }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", @@ -3189,11 +3201,6 @@ var ts; type: "boolean", description: ts.Diagnostics.Watch_input_files }, - { - name: "experimentalAsyncFunctions", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions - }, { name: "experimentalDecorators", type: "boolean", @@ -3380,6 +3387,9 @@ var ts; } if (opt.isFilePath) { value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } options[opt.name] = value; } @@ -3463,7 +3473,8 @@ var ts; increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); @@ -3525,7 +3536,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 246) { + while (node && node.kind !== 248) { node = node.parent; } return node; @@ -3616,15 +3627,15 @@ var ts; return current; } switch (current.kind) { - case 246: + case 248: + case 220: + case 244: case 218: - case 242: - case 216: - case 197: - case 198: case 199: + case 200: + case 201: return current; - case 190: + case 192: if (!isFunctionLike(current.parent)) { return current; } @@ -3635,9 +3646,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 209 && + declaration.kind === 211 && declaration.parent && - declaration.parent.kind === 242; + declaration.parent.kind === 244; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3673,22 +3684,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 246: + case 248: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 209: - case 161: - case 212: - case 184: - case 213: - case 216: - case 215: - case 245: case 211: - case 171: + case 163: + case 214: + case 186: + case 215: + case 218: + case 217: + case 247: + case 213: + case 173: errorNode = node.name; break; } @@ -3705,16 +3716,20 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 8192) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 215 && isConst(node); + return node.kind === 217 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 161 || isBindingPattern(node))) { + while (node && (node.kind === 163 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3722,14 +3737,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 209) { + if (node.kind === 211) { node = node.parent; } - if (node && node.kind === 210) { + if (node && node.kind === 212) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 191) { + if (node && node.kind === 193) { flags |= node.flags; } return flags; @@ -3744,7 +3759,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 193 && node.expression.kind === 9; + return node.kind === 195 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3752,7 +3767,7 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 136 || node.kind === 135) ? + var commentRanges = (node.kind === 138 || node.kind === 137) ? ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode); return ts.filter(commentRanges, isJsDocComment); @@ -3766,68 +3781,69 @@ var ts; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (149 <= node.kind && node.kind <= 158) { + if (151 <= node.kind && node.kind <= 160) { return true; } switch (node.kind) { - case 115: - case 126: + case 117: case 128: - case 118: - case 129: + case 130: + case 120: + case 131: return true; - case 101: - return node.parent.kind !== 175; + case 103: + return node.parent.kind !== 177; case 9: - return node.parent.kind === 136; - case 186: + return node.parent.kind === 138; + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 67: - if (node.parent.kind === 133 && node.parent.right === node) { + case 69: + if (node.parent.kind === 135 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 164 && node.parent.name === node) { + else if (node.parent.kind === 166 && node.parent.name === node) { node = node.parent; } - case 133: - case 164: - ts.Debug.assert(node.kind === 67 || node.kind === 133 || node.kind === 164, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 69 || node.kind === 135 || node.kind === 166, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 135: + case 166: + case 97: var parent_1 = node.parent; - if (parent_1.kind === 152) { + if (parent_1.kind === 154) { return false; } - if (149 <= parent_1.kind && parent_1.kind <= 158) { + if (151 <= parent_1.kind && parent_1.kind <= 160) { return true; } switch (parent_1.kind) { - case 186: + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 135: + case 137: return node === parent_1.constraint; - case 139: - case 138: - case 136: - case 209: - return node === parent_1.type; - case 211: - case 171: - case 172: - case 142: case 141: case 140: - case 143: - case 144: + case 138: + case 211: return node === parent_1.type; + case 213: + case 173: + case 174: + case 144: + case 143: + case 142: case 145: case 146: + return node === parent_1.type; case 147: + case 148: + case 149: return node === parent_1.type; - case 169: + case 171: return node === parent_1.type; - case 166: - case 167: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 168: + case 169: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 170: return false; } } @@ -3838,23 +3854,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 202: + case 204: return visitor(node); - case 218: - case 190: - case 194: - case 195: + case 220: + case 192: case 196: case 197: case 198: case 199: - case 203: - case 204: - case 239: - case 240: + case 200: + case 201: case 205: - case 207: + case 206: + case 241: case 242: + case 207: + case 209: + case 244: return ts.forEachChild(node, traverse); } } @@ -3864,23 +3880,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 182: + case 184: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + case 217: case 215: - case 213: + case 218: case 216: case 214: - case 212: - case 184: + case 186: return; default: if (isFunctionLike(node)) { var name_6 = node.name; - if (name_6 && name_6.kind === 134) { + if (name_6 && name_6.kind === 136) { traverse(name_6.expression); return; } @@ -3895,14 +3911,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 161: - case 245: - case 136: - case 243: - case 139: + case 163: + case 247: case 138: - case 244: - case 209: + case 245: + case 141: + case 140: + case 246: + case 211: return true; } } @@ -3910,29 +3926,29 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 143 || node.kind === 144); + return node && (node.kind === 145 || node.kind === 146); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 212 || node.kind === 184); + return node && (node.kind === 214 || node.kind === 186); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 142: - case 171: - case 211: - case 172: - case 141: - case 140: - case 143: case 144: + case 173: + case 213: + case 174: + case 143: + case 142: case 145: case 146: case 147: - case 150: - case 151: + case 148: + case 149: + case 152: + case 153: return true; } } @@ -3941,24 +3957,24 @@ var ts; ts.isFunctionLike = isFunctionLike; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 171: + case 145: + case 146: + case 213: + case 173: return true; } return false; } ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 190 && isFunctionLike(node.parent); + return node && node.kind === 192 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 141 && node.parent.kind === 163; + return node && node.kind === 143 && node.parent.kind === 165; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3986,36 +4002,39 @@ var ts; return undefined; } switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 172: + case 174: if (!includeArrowFunctions) { continue; } - case 211: - case 171: - case 216: - case 139: - case 138: + case 213: + case 173: + case 218: case 141: case 140: - case 142: case 143: + case 142: case 144: - case 215: - case 246: + case 145: + case 146: + case 147: + case 148: + case 149: + case 217: + case 248: return node; } } @@ -4027,33 +4046,33 @@ var ts; if (!node) return node; switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 211: - case 171: - case 172: + case 213: + case 173: + case 174: if (!includeFunctions) { continue; } - case 139: - case 138: case 141: case 140: - case 142: case 143: + case 142: case 144: + case 145: + case 146: return node; } } @@ -4062,12 +4081,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 149: + case 151: return node.typeName; - case 186: + case 188: return node.expression; - case 67: - case 133: + case 69: + case 135: return node; } } @@ -4075,7 +4094,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 168) { + if (node.kind === 170) { return node.tag; } return node.expression; @@ -4083,40 +4102,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 212: + case 214: return true; - case 139: - return node.parent.kind === 212; - case 136: - return node.parent.body && node.parent.parent.kind === 212; - case 143: - case 144: case 141: - return node.body && node.parent.kind === 212; + return node.parent.kind === 214; + case 138: + return node.parent.body && node.parent.parent.kind === 214; + case 145: + case 146: + case 143: + return node.body && node.parent.kind === 214; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 212: + case 214: if (node.decorators) { return true; } return false; - case 139: - case 136: - if (node.decorators) { - return true; - } - return false; - case 143: - if (node.body && node.decorators) { - return true; - } - return false; case 141: - case 144: + case 138: + if (node.decorators) { + return true; + } + return false; + case 145: + if (node.body && node.decorators) { + return true; + } + return false; + case 143: + case 146: if (node.body && node.decorators) { return true; } @@ -4127,10 +4146,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 212: + case 214: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 141: - case 144: + case 143: + case 146: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4140,95 +4159,105 @@ var ts; return nodeIsDecorated(node) || childIsDecorated(node); } ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 166; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 167; + } + ts.isElementAccessExpression = isElementAccessExpression; function isExpression(node) { switch (node.kind) { case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 10: - case 162: - case 163: case 164: case 165: case 166: case 167: case 168: - case 187: case 169: case 170: + case 189: case 171: - case 184: case 172: - case 175: case 173: + case 186: case 174: case 177: - case 178: + case 175: + case 176: case 179: case 180: - case 183: case 181: - case 11: - case 185: - case 231: - case 232: case 182: + case 185: + case 183: + case 11: + case 187: + case 233: + case 234: + case 184: + case 178: return true; - case 133: - while (node.parent.kind === 133) { + case 135: + while (node.parent.kind === 135) { node = node.parent; } - return node.parent.kind === 152; - case 67: - if (node.parent.kind === 152) { + return node.parent.kind === 154; + case 69: + if (node.parent.kind === 154) { return true; } case 8: case 9: + case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 209: - case 136: - case 139: + case 211: case 138: + case 141: + case 140: + case 247: case 245: - case 243: - case 161: + case 163: return parent_2.initializer === node; - case 193: - case 194: case 195: case 196: - case 202: - case 203: - case 204: - case 239: - case 206: - case 204: - return parent_2.expression === node; case 197: + case 198: + case 204: + case 205: + case 206: + case 241: + case 208: + case 206: + return parent_2.expression === node; + case 199: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 210) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 212) || forStatement.condition === node || forStatement.incrementor === node; - case 198: - case 199: + case 200: + case 201: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212) || forInStatement.expression === node; - case 169: - case 187: + case 171: + case 189: return node === parent_2.expression; - case 188: + case 190: return node === parent_2.expression; - case 134: + case 136: return node === parent_2.expression; - case 137: - case 238: + case 139: + case 240: + case 239: return true; - case 186: + case 188: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4239,6 +4268,10 @@ var ts; return false; } ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 || @@ -4246,7 +4279,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind === 230; + return node.kind === 221 && node.moduleReference.kind === 232; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4255,20 +4288,54 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind !== 230; + return node.kind === 221 && node.moduleReference.kind !== 232; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(expression) { + return expression.kind === 168 && + expression.expression.kind === 69 && + expression.expression.text === "require" && + expression.arguments.length === 1; + } + ts.isRequireCall = isRequireCall; + function isExportsPropertyAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + function isModuleExportsAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { - if (node.kind === 220) { + if (node.kind === 222) { return node.moduleSpecifier; } - if (node.kind === 219) { + if (node.kind === 221) { var reference = node.moduleReference; - if (reference.kind === 230) { + if (reference.kind === 232) { return reference.expression; } } - if (node.kind === 226) { + if (node.kind === 228) { return node.moduleSpecifier; } } @@ -4276,13 +4343,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 136: + case 138: + case 143: + case 142: + case 246: + case 245: case 141: case 140: - case 244: - case 243: - case 139: - case 138: return node.questionToken !== undefined; } } @@ -4290,9 +4357,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 259 && + return node.kind === 261 && node.parameters.length > 0 && - node.parameters[0].type.kind === 261; + node.parameters[0].type.kind === 263; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -4306,24 +4373,24 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 267); + return getJSDocTag(node, 269); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 266); + return getJSDocTag(node, 268); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 268); + return getJSDocTag(node, 270); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 67) { + if (parameter.name && parameter.name.kind === 69) { var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 265) { + if (t.kind === 267) { var parameterTag = t; var name_7 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_7.text === parameterName) { @@ -4342,12 +4409,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 260) { + if (node.type && node.type.kind === 262) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 260; + return paramTag.typeExpression.type.kind === 262; } } return node.dotDotDotToken !== undefined; @@ -4368,7 +4435,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 160 || node.kind === 159); + return !!node && (node.kind === 162 || node.kind === 161); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4383,34 +4450,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 172: - case 161: - case 212: - case 184: - case 142: - case 215: - case 245: - case 228: - case 211: - case 171: - case 143: - case 221: - case 219: - case 224: + case 174: + case 163: + case 214: + case 186: + case 144: + case 217: + case 247: + case 230: case 213: + case 173: + case 145: + case 223: + case 221: + case 226: + case 215: + case 143: + case 142: + case 218: + case 224: + case 138: + case 245: case 141: case 140: + case 146: + case 246: case 216: - case 222: - case 136: - case 243: - case 139: - case 138: - case 144: - case 244: - case 214: - case 135: - case 209: + case 137: + case 211: return true; } return false; @@ -4418,25 +4485,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 201: - case 200: - case 208: - case 195: - case 193: - case 192: - case 198: - case 199: - case 197: - case 194: - case 205: - case 202: - case 204: - case 96: - case 207: - case 191: - case 196: case 203: - case 225: + case 202: + case 210: + case 197: + case 195: + case 194: + case 200: + case 201: + case 199: + case 196: + case 207: + case 204: + case 206: + case 98: + case 209: + case 193: + case 198: + case 205: + case 227: return true; default: return false; @@ -4445,13 +4512,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 142: - case 139: + case 144: case 141: case 143: - case 144: - case 140: - case 147: + case 145: + case 146: + case 142: + case 149: return true; default: return false; @@ -4459,11 +4526,11 @@ var ts; } ts.isClassElement = isClassElement; function isDeclarationName(name) { - if (name.kind !== 67 && name.kind !== 9 && name.kind !== 8) { + if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) { return false; } var parent = name.parent; - if (parent.kind === 224 || parent.kind === 228) { + if (parent.kind === 226 || parent.kind === 230) { if (parent.propertyName) { return true; } @@ -4477,54 +4544,54 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 139: - case 138: case 141: case 140: case 143: - case 144: + case 142: + case 145: + case 146: + case 247: case 245: - case 243: - case 164: + case 166: return parent.name === node; - case 133: + case 135: if (parent.right === node) { - while (parent.kind === 133) { + while (parent.kind === 135) { parent = parent.parent; } - return parent.kind === 152; + return parent.kind === 154; } return false; - case 161: - case 224: + case 163: + case 226: return parent.propertyName === node; - case 228: + case 230: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 219 || - node.kind === 221 && !!node.name || - node.kind === 222 || + return node.kind === 221 || + node.kind === 223 && !!node.name || node.kind === 224 || - node.kind === 228 || - node.kind === 225 && node.expression.kind === 67; + node.kind === 226 || + node.kind === 230 || + node.kind === 227 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 104); + var heritageClause = getHeritageClause(node.heritageClauses, 106); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -4593,7 +4660,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 68 <= token && token <= 132; + return 70 <= token && token <= 134; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4606,19 +4673,19 @@ var ts; ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 134 && + declaration.name.kind === 136 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 164 && isESSymbolIdentifier(node.expression); + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 67 || name.kind === 9 || name.kind === 8) { + if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 134) { + if (name.kind === 136) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4633,21 +4700,21 @@ var ts; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 67 && node.text === "Symbol"; + return node.kind === 69 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 113: - case 116: - case 72: - case 120: - case 75: - case 80: + case 115: + case 118: + case 74: + case 122: + case 77: + case 82: + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; } return false; @@ -4655,28 +4722,28 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 136; + return root.kind === 138; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 161) { + while (node.kind === 163) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 216 || n.kind === 246; + return isFunctionLike(n) || n.kind === 218 || n.kind === 248; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneEntityName(node) { - if (node.kind === 67) { - var clone_1 = createSynthesizedNode(67); + if (node.kind === 69) { + var clone_1 = createSynthesizedNode(69); clone_1.text = node.text; return clone_1; } else { - var clone_2 = createSynthesizedNode(133); + var clone_2 = createSynthesizedNode(135); clone_2.left = cloneEntityName(node.left); clone_2.left.parent = clone_2; clone_2.right = cloneEntityName(node.right); @@ -4919,7 +4986,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 142 && nodeIsPresent(member.body)) { + if (member.kind === 144 && nodeIsPresent(member.body)) { return member; } }); @@ -4946,10 +5013,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 143) { + if (accessor.kind === 145) { getAccessor = accessor; } - else if (accessor.kind === 144) { + else if (accessor.kind === 146) { setAccessor = accessor; } else { @@ -4958,7 +5025,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 143 || member.kind === 144) + if ((member.kind === 145 || member.kind === 146) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -4969,10 +5036,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 143 && !getAccessor) { + if (member.kind === 145 && !getAccessor) { getAccessor = member; } - if (member.kind === 144 && !setAccessor) { + if (member.kind === 146 && !setAccessor) { setAccessor = member; } } @@ -5078,16 +5145,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 111: return 128; - case 110: return 16; - case 109: return 64; - case 108: return 32; - case 113: return 256; - case 80: return 1; - case 120: return 2; - case 72: return 32768; - case 75: return 1024; - case 116: return 512; + case 113: return 128; + case 112: return 16; + case 111: return 64; + case 110: return 32; + case 115: return 256; + case 82: return 1; + case 122: return 2; + case 74: return 32768; + case 77: return 1024; + case 118: return 512; } return 0; } @@ -5095,29 +5162,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 164: - case 165: - case 167: case 166: - case 231: - case 232: + case 167: + case 169: case 168: - case 162: + case 233: + case 234: case 170: - case 163: - case 184: - case 171: - case 67: + case 164: + case 172: + case 165: + case 186: + case 173: + case 69: case 10: case 8: case 9: case 11: - case 181: - case 82: - case 91: - case 95: - case 97: + case 183: + case 84: case 93: + case 97: + case 99: + case 95: return true; } } @@ -5125,12 +5192,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 55 && token <= 66; + return token >= 56 && token <= 68; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 186 && - node.parent.token === 81 && + return node.kind === 188 && + node.parent.token === 83 && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -5139,10 +5206,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 67) { + if (node.kind === 69) { return true; } - else if (node.kind === 164) { + else if (isPropertyAccessExpression(node)) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -5150,16 +5217,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 133 && node.parent.right === node) || - (node.parent.kind === 164 && node.parent.name === node); + return (node.parent.kind === 135 && node.parent.right === node) || + (node.parent.kind === 166 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 163) { + if (kind === 165) { return expression.properties.length === 0; } - if (kind === 162) { + if (kind === 164) { return expression.elements.length === 0; } return false; @@ -5169,12 +5236,12 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } ts.isTsx = isTsx; function getExpandedCharCodes(input) { @@ -5368,9 +5435,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 135) { + if (d && d.kind === 137) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215) { return current; } } @@ -5380,7 +5447,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(270); + var nodeConstructors = new Array(272); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5418,20 +5485,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 133: + case 135: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 135: + case 137: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 136: - case 139: + case 246: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); case 138: - case 243: - case 244: - case 209: - case 161: + case 141: + case 140: + case 245: + case 211: + case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5440,24 +5513,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 150: - case 151: - case 145: - case 146: + case 152: + case 153: case 147: + case 148: + case 149: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 171: - case 211: - case 172: + case 145: + case 146: + case 173: + case 213: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5468,290 +5541,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 149: + case 151: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 148: + case 150: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 152: - return visitNode(cbNode, node.exprName); - case 153: - return visitNodes(cbNodes, node.members); case 154: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 155: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 156: + return visitNode(cbNode, node.elementType); case 157: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.elementTypes); case 158: - return visitNode(cbNode, node.type); case 159: + return visitNodes(cbNodes, node.types); case 160: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 161: case 162: return visitNodes(cbNodes, node.elements); - case 163: - return visitNodes(cbNodes, node.properties); case 164: + return visitNodes(cbNodes, node.elements); + case 165: + return visitNodes(cbNodes, node.properties); + case 166: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 165: + case 167: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 166: - case 167: + case 168: + case 169: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 168: + case 170: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 169: + case 171: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 170: - return visitNode(cbNode, node.expression); - case 173: - return visitNode(cbNode, node.expression); - case 174: + case 172: return visitNode(cbNode, node.expression); case 175: return visitNode(cbNode, node.expression); - case 177: - return visitNode(cbNode, node.operand); - case 182: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 176: return visitNode(cbNode, node.expression); - case 178: - return visitNode(cbNode, node.operand); + case 177: + return visitNode(cbNode, node.expression); case 179: + return visitNode(cbNode, node.operand); + case 184: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression); + case 180: + return visitNode(cbNode, node.operand); + case 181: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 187: + case 189: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 180: + case 182: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 183: + case 185: return visitNode(cbNode, node.expression); - case 190: - case 217: + case 192: + case 219: return visitNodes(cbNodes, node.statements); - case 246: + case 248: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 191: + case 193: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 210: + case 212: return visitNodes(cbNodes, node.declarations); - case 193: + case 195: return visitNode(cbNode, node.expression); - case 194: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 195: + case 197: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 196: + case 198: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 197: + case 199: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 198: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 199: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 200: - case 201: - return visitNode(cbNode, node.label); - case 202: - return visitNode(cbNode, node.expression); - case 203: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 201: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 202: + case 203: + return visitNode(cbNode, node.label); case 204: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 218: - return visitNodes(cbNodes, node.clauses); - case 239: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 240: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression); case 205: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 206: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 220: + return visitNodes(cbNodes, node.clauses); + case 241: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 242: + return visitNodes(cbNodes, node.statements); case 207: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 242: + case 244: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 137: + case 139: return visitNode(cbNode, node.expression); - case 212: - case 184: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 213: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 214: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 245: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 216: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 217: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 247: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 218: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 219: + case 221: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 220: + case 222: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 221: + case 223: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 222: + case 224: return visitNode(cbNode, node.name); - case 223: - case 227: + case 225: + case 229: return visitNodes(cbNodes, node.elements); - case 226: + case 228: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 224: - case 228: + case 226: + case 230: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 225: + case 227: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 181: + case 183: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 188: + case 190: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 134: + case 136: return visitNode(cbNode, node.expression); - case 241: + case 243: return visitNodes(cbNodes, node.types); - case 186: + case 188: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 230: + case 232: return visitNode(cbNode, node.expression); - case 229: - return visitNodes(cbNodes, node.decorators); case 231: + return visitNodes(cbNodes, node.decorators); + case 233: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 232: - case 233: + case 234: + case 235: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + case 239: + return visitNode(cbNode, node.expression); + case 240: + return visitNode(cbNode, node.expression); case 237: - return visitNode(cbNode, node.expression); - case 238: - return visitNode(cbNode, node.expression); - case 235: return visitNode(cbNode, node.tagName); - case 247: - return visitNode(cbNode, node.type); - case 251: - return visitNodes(cbNodes, node.types); - case 252: - return visitNodes(cbNodes, node.types); - case 250: - return visitNode(cbNode, node.elementType); - case 254: + case 249: return visitNode(cbNode, node.type); case 253: + return visitNodes(cbNodes, node.types); + case 254: + return visitNodes(cbNodes, node.types); + case 252: + return visitNode(cbNode, node.elementType); + case 256: return visitNode(cbNode, node.type); case 255: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.type); case 257: + return visitNodes(cbNodes, node.members); + case 259: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 258: - return visitNode(cbNode, node.type); - case 259: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 260: return visitNode(cbNode, node.type); case 261: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 262: return visitNode(cbNode, node.type); - case 256: + case 263: + return visitNode(cbNode, node.type); + case 264: + return visitNode(cbNode, node.type); + case 258: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 263: - return visitNodes(cbNodes, node.tags); case 265: + return visitNodes(cbNodes, node.tags); + case 267: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 266: - return visitNode(cbNode, node.typeExpression); - case 267: - return visitNode(cbNode, node.typeExpression); case 268: + return visitNode(cbNode, node.typeExpression); + case 269: + return visitNode(cbNode, node.typeExpression); + case 270: return visitNodes(cbNodes, node.typeParameters); } } @@ -5792,13 +5865,14 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -5806,7 +5880,7 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 : 0; + contextFlags = isJavaScriptFile ? 32 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -5824,6 +5898,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32) { + sourceFile.parserContextFlags = 32; + } token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -5837,7 +5914,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -5847,9 +5924,9 @@ var ts; return; function visit(node) { switch (node.kind) { - case 191: - case 211: - case 136: + case 193: + case 213: + case 138: addJSDocComment(node); } forEachChild(node, visit); @@ -5883,7 +5960,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(246, 0); + var sourceFile = createNode(248, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6042,16 +6119,16 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 67) { + if (token === 69) { return true; } - if (token === 112 && inYieldContext()) { + if (token === 114 && inYieldContext()) { return false; } - if (token === 117 && inAwaitContext()) { + if (token === 119 && inAwaitContext()) { return false; } - return token > 103; + return token > 105; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -6147,15 +6224,15 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(67); - if (token !== 67) { + var node = createNode(69); + if (token !== 69) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(67, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -6187,7 +6264,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(134); + var node = createNode(136); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6197,20 +6274,27 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 72) { - return nextToken() === 79; + if (token === 74) { + return nextToken() === 81; } - if (token === 80) { + if (token === 82) { nextToken(); - if (token === 75) { + if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 && token !== 15 && canFollowModifier(); } - if (token === 75) { + if (token === 77) { return nextTokenIsClassOrFunction(); } + if (token === 113) { + nextToken(); + return canFollowModifier(); + } nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } return canFollowModifier(); } function parseAnyContextualModifier() { @@ -6224,7 +6308,7 @@ var ts; } function nextTokenIsClassOrFunction() { nextToken(); - return token === 71 || token === 85; + return token === 73 || token === 87; } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6237,7 +6321,7 @@ var ts; case 3: return !(token === 23 && inErrorRecovery) && isStartOfStatement(); case 2: - return token === 69 || token === 75; + return token === 71 || token === 77; case 4: return isStartOfTypeMember(); case 5: @@ -6293,7 +6377,7 @@ var ts; ts.Debug.assert(token === 15); if (nextToken() === 16) { var next = nextToken(); - return next === 24 || next === 15 || next === 81 || next === 104; + return next === 24 || next === 15 || next === 83 || next === 106; } return true; } @@ -6306,8 +6390,8 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 104 || - token === 81) { + if (token === 106 || + token === 83) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -6331,13 +6415,13 @@ var ts; case 21: return token === 16; case 3: - return token === 16 || token === 69 || token === 75; + return token === 16 || token === 71 || token === 77; case 7: - return token === 15 || token === 81 || token === 104; + return token === 15 || token === 83 || token === 106; case 8: return isVariableDeclaratorListTerminator(); case 17: - return token === 27 || token === 17 || token === 15 || token === 81 || token === 104; + return token === 27 || token === 17 || token === 15 || token === 83 || token === 106; case 11: return token === 18 || token === 23; case 15: @@ -6351,11 +6435,11 @@ var ts; case 20: return token === 15 || token === 16; case 13: - return token === 27 || token === 38; + return token === 27 || token === 39; case 14: return token === 25 && lookAhead(nextTokenIsSlash); case 22: - return token === 18 || token === 53 || token === 16; + return token === 18 || token === 54 || token === 16; case 23: return token === 27 || token === 16; case 25: @@ -6476,17 +6560,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 142: - case 147: - case 143: case 144: - case 139: - case 189: - return true; + case 149: + case 145: + case 146: case 141: + case 191: + return true; + case 143: var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 67 && - methodDeclaration.name.originalKeywordKind === 119; + var nameIsConstructor = methodDeclaration.name.kind === 69 && + methodDeclaration.name.originalKeywordKind === 121; return !nameIsConstructor; } } @@ -6495,8 +6579,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 239: - case 240: + case 241: + case 242: return true; } } @@ -6505,65 +6589,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 211: - case 191: - case 190: - case 194: + case 213: case 193: - case 206: - case 202: - case 204: - case 201: - case 200: - case 198: - case 199: - case 197: - case 196: - case 203: case 192: - case 207: - case 205: + case 196: case 195: case 208: - case 220: - case 219: - case 226: - case 225: - case 216: - case 212: - case 213: - case 215: + case 204: + case 206: + case 203: + case 202: + case 200: + case 201: + case 199: + case 198: + case 205: + case 194: + case 209: + case 207: + case 197: + case 210: + case 222: + case 221: + case 228: + case 227: + case 218: case 214: + case 215: + case 217: + case 216: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 245; + return node.kind === 247; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 146: + case 148: + case 142: + case 149: case 140: case 147: - case 138: - case 145: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 209) { + if (node.kind !== 211) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 136) { + if (node.kind !== 138) { return false; } var parameter = node; @@ -6663,7 +6747,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(133, entity.pos); + var node = createNode(135, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6674,13 +6758,13 @@ var ts; if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(181); + var template = createNode(183); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; @@ -6693,7 +6777,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(188); + var span = createNode(190); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { @@ -6728,14 +6812,14 @@ var ts; } function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 67 && token === 122 && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 69 && token === 124 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(148, typeName.pos); + var node_1 = createNode(150, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(149, typeName.pos); + var node = createNode(151, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -6743,15 +6827,15 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(152); - parseExpected(99); + var node = createNode(154); + parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(135); + var node = createNode(137); node.name = parseIdentifier(); - if (parseOptional(81)) { + if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -6767,7 +6851,7 @@ var ts; } } function parseParameterType() { - if (parseOptional(53)) { + if (parseOptional(54)) { return token === 9 ? parseLiteralNode(true) : parseType(); @@ -6775,7 +6859,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 54; + return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 55; } function setModifiers(node, modifiers) { if (modifiers) { @@ -6784,7 +6868,7 @@ var ts; } } function parseParameter() { - var node = createNode(136); + var node = createNode(138); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); @@ -6792,7 +6876,7 @@ var ts; if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(52); + node.questionToken = parseOptionalToken(53); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); return finishNode(node); @@ -6839,10 +6923,10 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 146) { - parseExpected(90); + if (kind === 148) { + parseExpected(92); } - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } @@ -6869,17 +6953,17 @@ var ts; else { nextToken(); } - if (token === 53 || token === 24) { + if (token === 54 || token === 24) { return true; } - if (token !== 52) { + if (token !== 53) { return false; } nextToken(); - return token === 53 || token === 24 || token === 20; + return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(147, fullStart); + var node = createNode(149, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -6890,17 +6974,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(140, fullStart); + var method = createNode(142, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(53, false, false, false, method); + fillSignature(54, false, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(138, fullStart); + var property = createNode(140, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -6934,22 +7018,22 @@ var ts; nextToken(); return token === 17 || token === 25 || - token === 52 || token === 53 || + token === 54 || canParseSemicolon(); } function parseTypeMember() { switch (token) { case 17: case 25: - return parseSignatureMember(145); + return parseSignatureMember(147); case 19: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); - case 90: + case 92: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(146); + return parseSignatureMember(148); } case 9: case 8: @@ -6979,7 +7063,7 @@ var ts; return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(153); + var node = createNode(155); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -6995,12 +7079,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(155); + var node = createNode(157); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(158); + var node = createNode(160); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -7008,8 +7092,8 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 151) { - parseExpected(90); + if (kind === 153) { + parseExpected(92); } fillSignature(34, false, false, false, node); return finishNode(node); @@ -7020,16 +7104,17 @@ var ts; } function parseNonArrayType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 101: + case 103: + case 97: return parseTokenNode(); - case 99: + case 101: return parseTypeQuery(); case 15: return parseTypeLiteral(); @@ -7043,17 +7128,18 @@ var ts; } function isStartOfType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: + case 103: + case 97: case 101: - case 99: case 15: case 19: case 25: - case 90: + case 92: return true; case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -7069,7 +7155,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(154, type.pos); + var node = createNode(156, type.pos); node.elementType = type; type = finishNode(node); } @@ -7091,10 +7177,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(157, parseArrayTypeOrHigher, 45); + return parseUnionOrIntersectionType(159, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(156, parseIntersectionTypeOrHigher, 46); + return parseUnionOrIntersectionType(158, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -7109,8 +7195,8 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 53 || token === 24 || - token === 52 || token === 55 || + if (token === 54 || token === 24 || + token === 53 || token === 56 || isIdentifier() || ts.isModifier(token)) { return true; } @@ -7128,23 +7214,23 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(150); + return parseFunctionOrConstructorType(152); } - if (token === 90) { - return parseFunctionOrConstructorType(151); + if (token === 92) { + return parseFunctionOrConstructorType(153); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(53) ? parseType() : undefined; + return parseOptional(54) ? parseType() : undefined; } function isStartOfLeftHandSideExpression() { switch (token) { + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 8: case 9: case 11: @@ -7152,12 +7238,12 @@ var ts; case 17: case 19: case 15: - case 85: - case 71: - case 90: - case 38: - case 59: - case 67: + case 87: + case 73: + case 92: + case 39: + case 61: + case 69: return true; default: return isIdentifier(); @@ -7170,16 +7256,16 @@ var ts; switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 76: - case 99: + case 78: case 101: - case 40: + case 103: case 41: + case 42: case 25: - case 117: - case 112: + case 119: + case 114: return true; default: if (isBinaryOperator()) { @@ -7190,9 +7276,9 @@ var ts; } function isStartOfExpressionStatement() { return token !== 15 && - token !== 85 && - token !== 71 && - token !== 54 && + token !== 87 && + token !== 73 && + token !== 55 && isStartOfExpression(); } function allowInAndParseExpression() { @@ -7214,12 +7300,12 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 55) { + if (token !== 56) { if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { return undefined; } } - parseExpected(55); + parseExpected(56); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -7231,7 +7317,7 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 67 && token === 34) { + if (expr.kind === 69 && token === 34) { return parseSimpleArrowFunctionExpression(expr); } if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { @@ -7240,7 +7326,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 112) { + if (token === 114) { if (inYieldContext()) { return true; } @@ -7253,7 +7339,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(182); + var node = createNode(184); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7267,8 +7353,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(172, identifier.pos); - var parameter = createNode(136, identifier.pos); + var node = createNode(174, identifier.pos); + var parameter = createNode(138, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -7298,7 +7384,7 @@ var ts; return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 17 || token === 25 || token === 116) { + if (token === 17 || token === 25 || token === 118) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token === 34) { @@ -7307,7 +7393,7 @@ var ts; return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 116) { + if (token === 118) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; @@ -7323,7 +7409,7 @@ var ts; var third = nextToken(); switch (third) { case 34: - case 53: + case 54: case 15: return 1; default: @@ -7339,7 +7425,7 @@ var ts; if (!isIdentifier()) { return 0; } - if (nextToken() === 53) { + if (nextToken() === 54) { return 1; } return 2; @@ -7352,10 +7438,10 @@ var ts; if (sourceFile.languageVariant === 1) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 81) { + if (third === 83) { var fourth = nextToken(); switch (fourth) { - case 55: + case 56: case 27: return false; default: @@ -7379,10 +7465,10 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(172); + var node = createNode(174); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512); - fillSignature(53, false, isAsync, !allowAmbiguity, node); + fillSignature(54, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; } @@ -7396,8 +7482,8 @@ var ts; return parseFunctionBlock(false, isAsync, false); } if (token !== 23 && - token !== 85 && - token !== 71 && + token !== 87 && + token !== 73 && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(false, isAsync, true); @@ -7407,15 +7493,15 @@ var ts; : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); } function parseConditionalExpressionRest(leftOperand) { - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (!questionToken) { return leftOperand; } - var node = createNode(180, leftOperand.pos); + var node = createNode(182, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(53, false, ts.Diagnostics._0_expected, ts.tokenToString(53)); + node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7424,19 +7510,22 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 88 || t === 132; + return t === 90 || t === 134; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); var newPrecedence = getBinaryOperatorPrecedence(); - if (newPrecedence <= precedence) { + var consumeCurrentOperator = token === 38 ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { break; } - if (token === 88 && inDisallowInContext()) { + if (token === 90 && inDisallowInContext()) { break; } - if (token === 114) { + if (token === 116) { if (scanner.hasPrecedingLineBreak()) { break; } @@ -7452,22 +7541,22 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 88) { + if (inDisallowInContext() && token === 90) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 51: + case 52: return 1; - case 50: + case 51: return 2; - case 46: - return 3; case 47: + return 3; + case 48: return 4; - case 45: + case 46: return 5; case 30: case 31: @@ -7478,64 +7567,66 @@ var ts; case 27: case 28: case 29: - case 89: - case 88: - case 114: + case 91: + case 90: + case 116: return 7; - case 42: case 43: case 44: + case 45: return 8; case 35: case 36: return 9; case 37: - case 38: case 39: + case 40: return 10; + case 38: + return 11; } return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(179, left.pos); + var node = createNode(181, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(187, left.pos); + var node = createNode(189, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(177); + var node = createNode(179); node.operator = token; nextToken(); - node.operand = parseUnaryExpressionOrHigher(); + node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(173); + var node = createNode(175); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(174); + var node = createNode(176); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(175); + var node = createNode(177); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token === 117) { + if (token === 119) { if (inAwaitContext()) { return true; } @@ -7544,45 +7635,87 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(176); + var node = createNode(178); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseUnaryExpressionOrHigher() { if (isAwaitExpression()) { return parseAwaitExpression(); } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38) { + var diagnostic; + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 171) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } + else { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + function parseSimpleUnaryExpression() { switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 40: - case 41: return parsePrefixUnaryExpression(); - case 76: + case 78: return parseDeleteExpression(); - case 99: - return parseTypeOfExpression(); case 101: + return parseTypeOfExpression(); + case 103: return parseVoidExpression(); case 25: - if (sourceFile.languageVariant !== 1) { - return parseTypeAssertion(); - } - if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); - } + return parseTypeAssertion(); default: - return parsePostfixExpressionOrHigher(); + return parseIncrementExpression(); } } - function parsePostfixExpressionOrHigher() { + function isIncrementExpression() { + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 78: + case 101: + case 103: + return false; + case 25: + if (sourceFile.languageVariant !== 1) { + return false; + } + default: + return true; + } + } + function parseIncrementExpression() { + if (token === 41 || token === 42) { + var node = createNode(179); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 && token === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) { + return parseJsxElementOrSelfClosingElement(true); + } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 40 || token === 41) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(178, expression.pos); + if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(180, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7591,7 +7724,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 93 + var expression = token === 95 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); @@ -7605,7 +7738,7 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(164, expression.pos); + var node = createNode(166, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -7613,26 +7746,26 @@ var ts; } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); - if (opening.kind === 233) { - var node = createNode(231, opening.pos); + if (opening.kind === 235) { + var node = createNode(233, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 232); + ts.Debug.assert(opening.kind === 234); return opening; } } function parseJsxText() { - var node = createNode(234, scanner.getStartPos()); + var node = createNode(236, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 234: + case 236: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -7668,11 +7801,11 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(233, fullStart); + node = createNode(235, fullStart); scanJsxText(); } else { - parseExpected(38); + parseExpected(39); if (inExpressionContext) { parseExpected(27); } @@ -7680,7 +7813,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(232, fullStart); + node = createNode(234, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7691,7 +7824,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(133, elementName.pos); + var node = createNode(135, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -7699,7 +7832,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(238); + var node = createNode(240); parseExpected(15); if (token !== 16) { node.expression = parseExpression(); @@ -7718,9 +7851,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(236); + var node = createNode(238); node.name = parseIdentifierName(); - if (parseOptional(55)) { + if (parseOptional(56)) { switch (token) { case 9: node.initializer = parseLiteralNode(); @@ -7733,7 +7866,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(237); + var node = createNode(239); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -7741,7 +7874,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(235); + var node = createNode(237); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -7754,18 +7887,18 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(169); + var node = createNode(171); parseExpected(25); node.type = parseType(); parseExpected(27); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(164, expression.pos); + var propertyAccess = createNode(166, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -7773,7 +7906,7 @@ var ts; continue; } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(165, expression.pos); + var indexedAccess = createNode(167, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -7787,7 +7920,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(168, expression.pos); + var tagExpression = createNode(170, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -7806,7 +7939,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -7814,7 +7947,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -7847,18 +7980,18 @@ var ts; case 21: case 18: case 20: - case 53: + case 54: case 23: - case 52: + case 53: case 30: case 32: case 31: case 33: - case 50: case 51: - case 47: - case 45: + case 52: + case 48: case 46: + case 47: case 16: case 1: return true; @@ -7874,11 +8007,11 @@ var ts; case 9: case 11: return parseLiteralNode(); + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: return parseTokenNode(); case 17: return parseParenthesizedExpression(); @@ -7886,19 +8019,19 @@ var ts; return parseArrayLiteralExpression(); case 15: return parseObjectLiteralExpression(); - case 116: + case 118: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 71: + case 73: return parseClassExpression(); - case 85: + case 87: return parseFunctionExpression(); - case 90: + case 92: return parseNewExpression(); - case 38: - case 59: + case 39: + case 61: if (reScanSlashToken() === 10) { return parseLiteralNode(); } @@ -7909,28 +8042,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(170); + var node = createNode(172); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(183); + var node = createNode(185); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(185) : + token === 24 ? createNode(187) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(162); + var node = createNode(164); parseExpected(19); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048; @@ -7939,11 +8072,11 @@ var ts; return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(121)) { - return parseAccessorDeclaration(143, fullStart, decorators, modifiers); + if (parseContextualModifier(123)) { + return parseAccessorDeclaration(145, fullStart, decorators, modifiers); } - else if (parseContextualModifier(127)) { - return parseAccessorDeclaration(144, fullStart, decorators, modifiers); + else if (parseContextualModifier(129)) { + return parseAccessorDeclaration(146, fullStart, decorators, modifiers); } return undefined; } @@ -7959,27 +8092,33 @@ var ts; var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 24 || token === 16) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(244, fullStart); + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(246, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(243, fullStart); + var propertyAssignment = createNode(245, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(53); + parseExpected(54); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(163); + var node = createNode(165); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048; @@ -7993,9 +8132,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(171); + var node = createNode(173); setModifiers(node, parseModifiers()); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); @@ -8004,7 +8143,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlock(isGenerator, isAsync, false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -8015,8 +8154,8 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(167); - parseExpected(90); + var node = createNode(169); + parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token === 17) { @@ -8025,7 +8164,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(190); + var node = createNode(192); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8053,25 +8192,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(192); + var node = createNode(194); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(194); - parseExpected(86); + var node = createNode(196); + parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(78) ? parseStatement() : undefined; + node.elseStatement = parseOptional(80) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(195); - parseExpected(77); + var node = createNode(197); + parseExpected(79); node.statement = parseStatement(); - parseExpected(102); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8079,8 +8218,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(196); - parseExpected(102); + var node = createNode(198); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8089,11 +8228,11 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(84); + parseExpected(86); parseExpected(17); var initializer = undefined; if (token !== 23) { - if (token === 100 || token === 106 || token === 72) { + if (token === 102 || token === 108 || token === 74) { initializer = parseVariableDeclarationList(true); } else { @@ -8101,22 +8240,22 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(88)) { - var forInStatement = createNode(198, pos); + if (parseOptional(90)) { + var forInStatement = createNode(200, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(132)) { - var forOfStatement = createNode(199, pos); + else if (parseOptional(134)) { + var forOfStatement = createNode(201, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(197, pos); + var forStatement = createNode(199, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8134,7 +8273,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 201 ? 68 : 73); + parseExpected(kind === 203 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8142,8 +8281,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(202); - parseExpected(92); + var node = createNode(204); + parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -8151,8 +8290,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(203); - parseExpected(103); + var node = createNode(205); + parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8160,30 +8299,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(239); - parseExpected(69); + var node = createNode(241); + parseExpected(71); node.expression = allowInAnd(parseExpression); - parseExpected(53); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(240); - parseExpected(75); - parseExpected(53); + var node = createNode(242); + parseExpected(77); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 69 ? parseCaseClause() : parseDefaultClause(); + return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(204); - parseExpected(94); + var node = createNode(206); + parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(218, scanner.getStartPos()); + var caseBlock = createNode(220, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8191,26 +8330,26 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(206); - parseExpected(96); + var node = createNode(208); + parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(207); - parseExpected(98); + var node = createNode(209); + parseExpected(100); node.tryBlock = parseBlock(false); - node.catchClause = token === 70 ? parseCatchClause() : undefined; - if (!node.catchClause || token === 83) { - parseExpected(83); + node.catchClause = token === 72 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 85) { + parseExpected(85); node.finallyBlock = parseBlock(false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(242); - parseExpected(70); + var result = createNode(244); + parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); } @@ -8219,22 +8358,22 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(208); - parseExpected(74); + var node = createNode(210); + parseExpected(76); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 67 && parseOptional(53)) { - var labeledStatement = createNode(205, fullStart); + if (expression.kind === 69 && parseOptional(54)) { + var labeledStatement = createNode(207, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(193, fullStart); + var expressionStatement = createNode(195, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -8246,7 +8385,7 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 85 && !scanner.hasPrecedingLineBreak(); + return token === 87 && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); @@ -8255,41 +8394,41 @@ var ts; function isDeclaration() { while (true) { switch (token) { - case 100: - case 106: - case 72: - case 85: - case 71: - case 79: + case 102: + case 108: + case 74: + case 87: + case 73: + case 81: return true; - case 105: - case 130: + case 107: + case 132: return nextTokenIsIdentifierOnSameLine(); - case 123: - case 124: + case 125: + case 126: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 116: - case 120: + case 115: + case 118: + case 122: + case 110: + case 111: + case 112: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 87: + case 89: nextToken(); return token === 9 || token === 37 || token === 15 || ts.tokenIsIdentifierOrKeyword(token); - case 80: + case 82: nextToken(); - if (token === 55 || token === 37 || - token === 15 || token === 75) { + if (token === 56 || token === 37 || + token === 15 || token === 77) { return true; } continue; - case 110: - case 108: - case 109: - case 111: case 113: nextToken(); continue; @@ -8303,44 +8442,44 @@ var ts; } function isStartOfStatement() { switch (token) { - case 54: + case 55: case 23: case 15: - case 100: - case 106: - case 85: - case 71: - case 79: - case 86: - case 77: case 102: - case 84: + case 108: + case 87: case 73: - case 68: - case 92: - case 103: + case 81: + case 88: + case 79: + case 104: + case 86: + case 75: + case 70: case 94: + case 105: case 96: case 98: - case 74: - case 70: - case 83: - return true; + case 100: + case 76: case 72: - case 80: - case 87: - return isStartOfDeclaration(); - case 116: - case 120: - case 105: - case 123: - case 124: - case 130: + case 85: return true; + case 74: + case 82: + case 89: + return isStartOfDeclaration(); + case 118: + case 122: + case 107: + case 125: + case 126: + case 132: + return true; + case 112: case 110: - case 108: - case 109: case 111: + case 113: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8359,60 +8498,60 @@ var ts; return parseEmptyStatement(); case 15: return parseBlock(false); - case 100: + case 102: return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 106: + case 108: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined, undefined); } break; - case 85: - return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 71: - return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 86: - return parseIfStatement(); - case 77: - return parseDoStatement(); - case 102: - return parseWhileStatement(); - case 84: - return parseForOrForInOrForOfStatement(); - case 73: - return parseBreakOrContinueStatement(200); - case 68: - return parseBreakOrContinueStatement(201); - case 92: - return parseReturnStatement(); - case 103: - return parseWithStatement(); - case 94: - return parseSwitchStatement(); - case 96: - return parseThrowStatement(); - case 98: - case 70: - case 83: - return parseTryStatement(); - case 74: - return parseDebuggerStatement(); - case 54: - return parseDeclaration(); - case 116: - case 105: - case 130: - case 123: - case 124: - case 120: - case 72: - case 79: - case 80: case 87: - case 108: - case 109: + return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 73: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); + case 88: + return parseIfStatement(); + case 79: + return parseDoStatement(); + case 104: + return parseWhileStatement(); + case 86: + return parseForOrForInOrForOfStatement(); + case 75: + return parseBreakOrContinueStatement(202); + case 70: + return parseBreakOrContinueStatement(203); + case 94: + return parseReturnStatement(); + case 105: + return parseWithStatement(); + case 96: + return parseSwitchStatement(); + case 98: + return parseThrowStatement(); + case 100: + case 72: + case 85: + return parseTryStatement(); + case 76: + return parseDebuggerStatement(); + case 55: + return parseDeclaration(); + case 118: + case 107: + case 132: + case 125: + case 126: + case 122: + case 74: + case 81: + case 82: + case 89: case 110: - case 113: case 111: + case 112: + case 115: + case 113: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8425,33 +8564,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 100: - case 106: - case 72: + case 102: + case 108: + case 74: return parseVariableStatement(fullStart, decorators, modifiers); - case 85: - return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 71: - return parseClassDeclaration(fullStart, decorators, modifiers); - case 105: - return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 130: - return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 79: - return parseEnumDeclaration(fullStart, decorators, modifiers); - case 123: - case 124: - return parseModuleDeclaration(fullStart, decorators, modifiers); case 87: + return parseFunctionDeclaration(fullStart, decorators, modifiers); + case 73: + return parseClassDeclaration(fullStart, decorators, modifiers); + case 107: + return parseInterfaceDeclaration(fullStart, decorators, modifiers); + case 132: + return parseTypeAliasDeclaration(fullStart, decorators, modifiers); + case 81: + return parseEnumDeclaration(fullStart, decorators, modifiers); + case 125: + case 126: + return parseModuleDeclaration(fullStart, decorators, modifiers); + case 89: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 80: + case 82: nextToken(); - return token === 75 || token === 55 ? + return token === 77 || token === 56 ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { - var node = createMissingNode(229, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(231, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8472,23 +8611,23 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(185); + return createNode(187); } - var node = createNode(161); + var node = createNode(163); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(161); + var node = createNode(163); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 53) { + if (tokenIsIdentifier && token !== 54) { node.name = propertyName; } else { - parseExpected(53); + parseExpected(54); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -8496,14 +8635,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(159); + var node = createNode(161); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(160); + var node = createNode(162); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -8522,7 +8661,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(209); + var node = createNode(211); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8531,21 +8670,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(210); + var node = createNode(212); switch (token) { - case 100: + case 102: break; - case 106: + case 108: node.flags |= 16384; break; - case 72: + case 74: node.flags |= 32768; break; default: ts.Debug.fail(); } nextToken(); - if (token === 132 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 134 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8560,7 +8699,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(193, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8568,29 +8707,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(213, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(142, pos); + var node = createNode(144, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(119); - fillSignature(53, false, false, false, node); + parseExpected(121); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(141, fullStart); + var method = createNode(143, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8598,12 +8737,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512); - fillSignature(53, isGenerator, isAsync, false, method); + fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(139, fullStart); + var property = createNode(141, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -8618,7 +8757,7 @@ var ts; function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { var asteriskToken = parseOptionalToken(37); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } @@ -8634,16 +8773,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; default: return false; @@ -8651,7 +8790,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 54) { + if (token === 55) { return true; } while (ts.isModifier(token)) { @@ -8672,15 +8811,15 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 127 || idToken === 121) { + if (!ts.isKeyword(idToken) || idToken === 129 || idToken === 123) { return true; } switch (token) { case 17: case 25: + case 54: + case 56: case 53: - case 55: - case 52: return true; default: return canParseSemicolon(); @@ -8692,14 +8831,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(54)) { + if (!parseOptional(55)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(137, decoratorStart); + var decorator = createNode(139, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8733,7 +8872,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 116) { + if (token === 118) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -8748,7 +8887,7 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(189); + var result = createNode(191); nextToken(); return finishNode(result); } @@ -8759,7 +8898,7 @@ var ts; if (accessor) { return accessor; } - if (token === 119) { + if (token === 121) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -8773,23 +8912,23 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_8 = createMissingNode(67, true, ts.Diagnostics.Declaration_expected); + var name_8 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_8, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 184); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 186); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(71); - node.name = parseOptionalIdentifier(); + parseExpected(73); + node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(15)) { @@ -8801,6 +8940,14 @@ var ts; } return finishNode(node); } + function parseNameOfClassDeclarationOrExpression() { + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 && lookAhead(nextTokenIsIdentifierOrKeyword); + } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { return parseList(20, parseHeritageClause); @@ -8811,8 +8958,8 @@ var ts; return parseList(20, parseHeritageClause); } function parseHeritageClause() { - if (token === 81 || token === 104) { - var node = createNode(241); + if (token === 83 || token === 106) { + var node = createNode(243); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -8821,7 +8968,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(186); + var node = createNode(188); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -8829,16 +8976,16 @@ var ts; return finishNode(node); } function isHeritageClause() { - return token === 81 || token === 104; + return token === 83 || token === 106; } function parseClassMembers() { return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(105); + parseExpected(107); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -8846,28 +8993,28 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(130); + parseExpected(132); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(55); + parseExpected(56); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(245, scanner.getStartPos()); + var node = createNode(247, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(217, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(79); + parseExpected(81); node.name = parseIdentifier(); if (parseExpected(15)) { node.members = parseDelimitedList(6, parseEnumMember); @@ -8879,7 +9026,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(217, scanner.getStartPos()); + var node = createNode(219, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8890,7 +9037,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); var namespaceFlag = flags & 131072; node.decorators = decorators; setModifiers(node, modifiers); @@ -8902,7 +9049,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8911,11 +9058,11 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(124)) { + if (parseOptional(126)) { flags |= 131072; } else { - parseExpected(123); + parseExpected(125); if (token === 9) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -8923,58 +9070,58 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 125 && + return token === 127 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 17; } function nextTokenIsSlash() { - return nextToken() === 38; + return nextToken() === 39; } function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 24 || - token === 131; + token === 133; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(87); + parseExpected(89); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 131) { - var importEqualsDeclaration = createNode(219, fullStart); + if (token !== 24 && token !== 133) { + var importEqualsDeclaration = createNode(221, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(55); + parseExpected(56); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(220, fullStart); + var importDeclaration = createNode(222, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(131); + parseExpected(133); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(221, fullStart); + var importClause = createNode(223, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(223); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(225); } return finishNode(importClause); } @@ -8984,8 +9131,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(230); - parseExpected(125); + var node = createNode(232); + parseExpected(127); parseExpected(17); node.expression = parseModuleSpecifier(); parseExpected(18); @@ -8999,22 +9146,22 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(222); + var namespaceImport = createNode(224); parseExpected(37); - parseExpected(114); + parseExpected(116); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 223 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 225 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(228); + return parseImportOrExportSpecifier(230); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(224); + return parseImportOrExportSpecifier(226); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9022,9 +9169,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 114) { + if (token === 116) { node.propertyName = identifierName; - parseExpected(114); + parseExpected(116); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -9033,23 +9180,23 @@ var ts; else { node.name = identifierName; } - if (kind === 224 && checkIdentifierIsKeyword) { + if (kind === 226 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(131); + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(227); - if (token === 131 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(131); + node.exportClause = parseNamedImportsOrExports(229); + if (token === 133 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9057,14 +9204,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(55)) { + if (parseOptional(56)) { node.isExportEquals = true; } else { - parseExpected(75); + parseExpected(77); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -9127,10 +9274,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 219 && node.moduleReference.kind === 230 - || node.kind === 220 - || node.kind === 225 - || node.kind === 226 + || node.kind === 221 && node.moduleReference.kind === 232 + || node.kind === 222 + || node.kind === 227 + || node.kind === 228 ? node : undefined; }); @@ -9140,22 +9287,22 @@ var ts; function isJSDocType() { switch (token) { case 37: - case 52: + case 53: case 17: case 19: - case 48: + case 49: case 15: - case 85: + case 87: case 22: - case 90: - case 95: + case 92: + case 97: return true; } return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -9165,7 +9312,7 @@ var ts; function parseJSDocTypeExpression(start, length) { scanner.setText(sourceText, start, length); token = nextToken(); - var result = createNode(247); + var result = createNode(249); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9175,13 +9322,13 @@ var ts; JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 46) { - var unionType = createNode(251, type.pos); + if (token === 47) { + var unionType = createNode(253, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 55) { - var optionalType = createNode(258, type.pos); + if (token === 56) { + var optionalType = createNode(260, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9192,20 +9339,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(250, type.pos); + var arrayType = createNode(252, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } - else if (token === 52) { - var nullableType = createNode(253, type.pos); + else if (token === 53) { + var nullableType = createNode(255, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 48) { - var nonNullableType = createNode(254, type.pos); + else if (token === 49) { + var nonNullableType = createNode(256, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9220,80 +9367,80 @@ var ts; switch (token) { case 37: return parseJSDocAllType(); - case 52: + case 53: return parseJSDocUnknownOrNullableType(); case 17: return parseJSDocUnionType(); case 19: return parseJSDocTupleType(); - case 48: + case 49: return parseJSDocNonNullableType(); case 15: return parseJSDocRecordType(); - case 85: + case 87: return parseJSDocFunctionType(); case 22: return parseJSDocVariadicType(); - case 90: + case 92: return parseJSDocConstructorType(); - case 95: + case 97: return parseJSDocThisType(); - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(262); + var result = createNode(264); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(261); + var result = createNode(263); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(260); + var result = createNode(262); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(259); + var result = createNode(261); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); checkForTrailingComma(result.parameters); parseExpected(18); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(136); + var parameter = createNode(138); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(258, type.pos); + var result = createNode(260, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(257); + var result = createNode(259); result.name = parseSimplePropertyName(); while (parseOptional(21)) { if (token === 25) { @@ -9322,13 +9469,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(133, left.pos); + var result = createNode(135, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(255); + var result = createNode(257); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9336,22 +9483,22 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(256); + var result = createNode(258); result.name = parseSimplePropertyName(); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(254); + var result = createNode(256); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(252); + var result = createNode(254); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9365,7 +9512,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(251); + var result = createNode(253); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9376,14 +9523,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(46)) { + while (parseOptional(47)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(248); + var result = createNode(250); nextToken(); return finishNode(result); } @@ -9394,19 +9541,19 @@ var ts; token === 16 || token === 18 || token === 27 || - token === 55 || - token === 46) { - var result = createNode(249, pos); + token === 56 || + token === 47) { + var result = createNode(251, pos); return finishNode(result); } else { - var result = createNode(253, pos); + var result = createNode(255, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocComment = parseJSDocComment(undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -9471,7 +9618,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(263, start); + var result = createNode(265, start); result.tags = tags; return finishNode(result, end); } @@ -9482,7 +9629,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(54, pos - 1); + var atToken = createNode(55, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -9508,7 +9655,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(264, atToken.pos); + var result = createNode(266, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -9559,7 +9706,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(265, atToken.pos); + var result = createNode(267, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -9569,27 +9716,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266, atToken.pos); + var result = createNode(268, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267; })) { + if (ts.forEach(tags, function (t) { return t.kind === 269; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(267, atToken.pos); + var result = createNode(269, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268; })) { + if (ts.forEach(tags, function (t) { return t.kind === 270; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -9602,7 +9749,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(135, name_9.pos); + var typeParameter = createNode(137, name_9.pos); typeParameter.name = name_9; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -9613,7 +9760,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(268, atToken.pos); + var result = createNode(270, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -9634,7 +9781,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(67, startPos); + var result = createNode(69, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -9710,7 +9857,7 @@ var ts; switch (node.kind) { case 9: case 8: - case 67: + case 69: return true; } return false; @@ -9928,16 +10075,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 213 || node.kind === 214) { + if (node.kind === 215 || node.kind === 216) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 220 || node.kind === 219) && !(node.flags & 1)) { + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 1)) { return 0; } - else if (node.kind === 217) { + else if (node.kind === 219) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -9953,7 +10100,7 @@ var ts; }); return state; } - else if (node.kind === 216) { + else if (node.kind === 218) { return getModuleInstanceState(node.body); } else { @@ -9972,6 +10119,8 @@ var ts; var container; var blockScopeContainer; var lastContainer; + var seenThisKeyword; + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var inStrictMode = !!file.externalModuleIndicator; var symbolCount = 0; var Symbol = ts.objectAllocator.getSymbolConstructor(); @@ -10005,10 +10154,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 216 && node.name.kind === 9) { + if (node.kind === 218 && node.name.kind === 9) { return "\"" + node.name.text + "\""; } - if (node.name.kind === 134) { + if (node.name.kind === 136) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -10016,22 +10165,24 @@ var ts; return node.name.text; } switch (node.kind) { - case 142: + case 144: return "__constructor"; - case 150: - case 145: - return "__call"; - case 151: - case 146: - return "__new"; + case 152: case 147: + return "__call"; + case 153: + case 148: + return "__new"; + case 149: return "__index"; - case 226: + case 228: return "__export"; - case 225: + case 227: return node.isExportEquals ? "export=" : "default"; - case 211: - case 212: + case 181: + return "export="; + case 213: + case 214: return node.flags & 1024 ? "default" : undefined; } } @@ -10040,7 +10191,8 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 1024 && parent ? "default" : getDeclarationName(node); + var isDefaultExport = node.flags & 1024; + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { symbol = ts.hasProperty(symbolTable, name) @@ -10056,6 +10208,11 @@ var ts; var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 1024) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -10073,7 +10230,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 228 || (node.kind === 219 && hasExportModifier)) { + if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -10112,44 +10269,51 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - ts.forEachChild(node, bind); + if (node.kind === 215) { + seenThisKeyword = false; + ts.forEachChild(node, bind); + node.flags = seenThisKeyword ? node.flags | 524288 : node.flags & ~524288; + } + else { + ts.forEachChild(node, bind); + } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function getContainerFlags(node) { switch (node.kind) { - case 184: - case 212: - case 213: + case 186: + case 214: case 215: - case 153: - case 163: + case 217: + case 155: + case 165: return 1; + case 147: + case 148: + case 149: + case 143: + case 142: + case 213: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 211: - case 142: - case 143: - case 144: - case 150: - case 151: - case 171: - case 172: - case 216: - case 246: - case 214: - return 5; - case 242: - case 197: - case 198: - case 199: + case 152: + case 153: + case 173: + case 174: case 218: + case 248: + case 216: + return 5; + case 244: + case 199: + case 200: + case 201: + case 220: return 2; - case 190: + case 192: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10165,33 +10329,33 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 216: + case 218: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 246: + case 248: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 184: - case 212: + case 186: + case 214: return declareClassMember(node, symbolFlags, symbolExcludes); - case 215: + case 217: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 153: - case 163: - case 213: + case 155: + case 165: + case 215: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 150: - case 151: + case 152: + case 153: + case 147: + case 148: + case 149: + case 143: + case 142: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 142: - case 143: - case 144: - case 211: - case 171: - case 172: - case 214: + case 213: + case 173: + case 174: + case 216: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -10215,11 +10379,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 246 ? node : node.body; - if (body.kind === 246 || body.kind === 217) { + var body = node.kind === 248 ? node : node.body; + if (body.kind === 248 || body.kind === 219) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 226 || stat.kind === 225) { + if (stat.kind === 228 || stat.kind === 227) { return true; } } @@ -10274,11 +10438,11 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 67) { + if (prop.name.kind !== 69) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 243 || prop.kind === 244 || prop.kind === 141 + var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -10300,10 +10464,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 216: + case 218: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 246: + case 248: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -10321,8 +10485,8 @@ var ts; } function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 104 && - node.originalKeywordKind <= 112 && + node.originalKeywordKind >= 106 && + node.originalKeywordKind <= 114 && !ts.isIdentifierName(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -10349,17 +10513,17 @@ var ts; } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 67) { + if (inStrictMode && node.expression.kind === 69) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 67) { + if (name && name.kind === 69) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); @@ -10393,7 +10557,7 @@ var ts; } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 40 || node.operator === 41) { + if (node.operator === 41 || node.operator === 42) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -10422,17 +10586,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 246: - case 217: + case 248: + case 219: updateStrictModeStatementList(node.statements); return; - case 190: + case 192: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 212: - case 184: + case 214: + case 186: inStrictMode = true; return; } @@ -10455,102 +10619,122 @@ var ts; } function bindWorker(node) { switch (node.kind) { - case 67: + case 69: return checkStrictModeIdentifier(node); - case 179: + case 181: + if (isJavaScriptFile) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); - case 242: + case 244: return checkStrictModeCatchClause(node); - case 173: + case 175: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 178: + case 180: return checkStrictModePostfixUnaryExpression(node); - case 177: + case 179: return checkStrictModePrefixUnaryExpression(node); - case 203: + case 205: return checkStrictModeWithStatement(node); - case 135: + case 97: + seenThisKeyword = true; + return; + case 137: return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 136: - return bindParameter(node); - case 209: - case 161: - return bindVariableDeclarationOrBindingElement(node); - case 139: case 138: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 243: - case 244: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 245: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 145: - case 146: - case 147: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); + return bindParameter(node); + case 211: + case 163: + return bindVariableDeclarationOrBindingElement(node); case 141: case 140: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 245: + case 246: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 247: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 147: + case 148: + case 149: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 143: + case 142: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 211: + case 213: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 142: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 143: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); case 144: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 146: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 150: - case 151: - return bindFunctionOrConstructorType(node); + case 152: case 153: + return bindFunctionOrConstructorType(node); + case 155: return bindAnonymousDeclaration(node, 2048, "__type"); - case 163: + case 165: return bindObjectLiteralExpression(node); - case 171: - case 172: + case 173: + case 174: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); - case 184: - case 212: - return bindClassLikeDeclaration(node); - case 213: - return bindBlockScopedDeclaration(node, 64, 792960); + case 168: + if (isJavaScriptFile) { + bindCallExpression(node); + } + break; + case 186: case 214: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindClassLikeDeclaration(node); case 215: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 64, 792960); case 216: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 217: + return bindEnumDeclaration(node); + case 218: return bindModuleDeclaration(node); - case 219: - case 222: - case 224: - case 228: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 221: - return bindImportClause(node); + case 224: case 226: + case 230: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 223: + return bindImportClause(node); + case 228: return bindExportDeclaration(node); - case 225: + case 227: return bindExportAssignment(node); - case 246: + case 248: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } function bindExportAssignment(node) { + var boundExpression = node.kind === 227 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 67) { + else if (boundExpression.kind === 69) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -10570,8 +10754,27 @@ var ts; declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); } } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + } + function bindModuleExportsAssignment(node) { + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } function bindClassLikeDeclaration(node) { - if (node.kind === 212) { + if (node.kind === 214) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -10624,7 +10827,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (node.flags & 112 && - node.parent.kind === 142 && + node.parent.kind === 144 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); @@ -10662,17 +10865,19 @@ var ts; var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; + var symbolCount = 0; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, @@ -10758,6 +10963,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var cjsRequireType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -10818,6 +11024,7 @@ var ts; diagnostics.add(diagnostic); } function createSymbol(flags, name) { + symbolCount++; return new Symbol(flags, name); } function getExcludedSymbolFlags(flags) { @@ -10946,10 +11153,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 246); + return ts.getAncestor(node, 248); } function isGlobalSourceFile(node) { - return node.kind === 246 && !ts.isExternalModule(node); + return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10966,17 +11173,54 @@ var ts; } } } - function isDefinedBefore(node1, node2) { - var file1 = ts.getSourceFileOfNode(node1); - var file2 = ts.getSourceFileOfNode(node2); - if (file1 === file2) { - return node1.pos <= node2.pos; + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } - if (!compilerOptions.outFile && !compilerOptions.out) { - return true; + if (declaration.pos <= usage.pos) { + return declaration.kind !== 211 || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + if (declaration.parent.parent.kind === 193 || + declaration.parent.parent.kind === 199) { + return isSameScopeDescendentOf(usage, declaration, container); + } + else if (declaration.parent.parent.kind === 201 || + declaration.parent.parent.kind === 200) { + var expression = declaration.parent.parent.expression; + return isSameScopeDescendentOf(usage, expression, container); + } + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 141 && + (current.parent.flags & 128) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; } - var sourceFiles = host.getSourceFiles(); - return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -10997,16 +11241,16 @@ var ts; } } switch (location.kind) { - case 246: - if (!ts.isExternalModule(location)) + case 248: + if (!ts.isExternalOrCommonJsModule(location)) break; - case 216: + case 218: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 246 || - (location.kind === 216 && location.name.kind === 9)) { + if (location.kind === 248 || + (location.kind === 218 && location.name.kind === 9)) { if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 228)) { + ts.getDeclarationOfKind(moduleExports[name], 230)) { break; } result = moduleExports["default"]; @@ -11020,13 +11264,13 @@ var ts; break loop; } break; - case 215: + case 217: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 139: - case 138: + case 141: + case 140: if (ts.isClassLike(location.parent) && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -11036,9 +11280,9 @@ var ts; } } break; - case 212: - case 184: - case 213: + case 214: + case 186: + case 215: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -11046,7 +11290,7 @@ var ts; } break loop; } - if (location.kind === 184 && meaning & 32) { + if (location.kind === 186 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -11054,28 +11298,28 @@ var ts; } } break; - case 134: + case 136: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 213) { + if (ts.isClassLike(grandparent) || grandparent.kind === 215) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 172: + case 145: + case 146: + case 213: + case 174: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 171: + case 173: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -11088,8 +11332,8 @@ var ts; } } break; - case 137: - if (location.parent && location.parent.kind === 136) { + case 139: + if (location.parent && location.parent.kind === 138) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -11115,8 +11359,11 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2 && result.flags & 2) { - checkResolvedBlockScopedVariable(result, errorLocation); + if (meaning & 2) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } } } return result; @@ -11125,21 +11372,7 @@ var ts; ts.Debug.assert((result.flags & 2) !== 0); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 209); - var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 191 || - variableDeclaration.parent.parent.kind === 197) { - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); - } - else if (variableDeclaration.parent.parent.kind === 199 || - variableDeclaration.parent.parent.kind === 198) { - var expression = variableDeclaration.parent.parent.expression; - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); - } - } - if (isUsedBeforeDeclaration) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -11156,10 +11389,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 219) { + if (node.kind === 221) { return node; } - while (node && node.kind !== 220) { + while (node && node.kind !== 222) { node = node.parent; } return node; @@ -11169,7 +11402,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 230) { + if (node.moduleReference.kind === 232) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11258,17 +11491,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 219: - return getTargetOfImportEqualsDeclaration(node); case 221: + return getTargetOfImportEqualsDeclaration(node); + case 223: return getTargetOfImportClause(node); - case 222: - return getTargetOfNamespaceImport(node); case 224: + return getTargetOfNamespaceImport(node); + case 226: return getTargetOfImportSpecifier(node); - case 228: + case 230: return getTargetOfExportSpecifier(node); - case 225: + case 227: return getTargetOfExportAssignment(node); } } @@ -11310,10 +11543,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 225) { + if (node.kind === 227) { checkExpressionCached(node.expression); } - else if (node.kind === 228) { + else if (node.kind === 230) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -11323,17 +11556,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 219); + importDeclaration = ts.getAncestor(entityName, 221); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 67 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 67 || entityName.parent.kind === 133) { + if (entityName.kind === 69 || entityName.parent.kind === 135) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 219); + ts.Debug.assert(entityName.parent.kind === 221); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -11345,16 +11578,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 67) { + if (name.kind === 69) { var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 133 || name.kind === 164) { - var left = name.kind === 133 ? name.left : name.expression; - var right = name.kind === 133 ? name.right : name.name; + else if (name.kind === 135 || name.kind === 166) { + var left = name.kind === 135 ? name.left : name.expression; + var right = name.kind === 135 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11373,9 +11606,6 @@ var ts; ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } - function isExternalModuleNameRelative(moduleName) { - return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; - } function resolveExternalModuleName(location, moduleReferenceExpression) { if (moduleReferenceExpression.kind !== 9) { return; @@ -11386,7 +11616,10 @@ var ts; if (moduleName === undefined) { return; } - var isRelative = isExternalModuleNameRelative(moduleName); + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } + var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); if (symbol) { @@ -11490,7 +11723,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 142 && ts.nodeIsPresent(member.body)) { + if (member.kind === 144 && ts.nodeIsPresent(member.body)) { return member; } } @@ -11555,17 +11788,17 @@ var ts; } } switch (location_1.kind) { - case 246: - if (!ts.isExternalModule(location_1)) { + case 248: + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 216: + case 218: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 212: - case 213: + case 214: + case 215: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11598,7 +11831,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11627,7 +11860,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11682,8 +11915,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 216 && declaration.name.kind === 9) || - (declaration.kind === 246 && ts.isExternalModule(declaration)); + return (declaration.kind === 218 && declaration.name.kind === 9) || + (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11715,11 +11948,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 152) { + if (entityName.parent.kind === 154) { meaning = 107455 | 1048576; } - else if (entityName.kind === 133 || entityName.kind === 164 || - entityName.parent.kind === 219) { + else if (entityName.kind === 135 || entityName.kind === 166 || + entityName.parent.kind === 221) { meaning = 1536; } else { @@ -11770,10 +12003,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 158) { + while (node.kind === 160) { node = node.parent; } - if (node.kind === 214) { + if (node.kind === 216) { return getSymbolOfNode(node); } } @@ -11787,10 +12020,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 184: + case 186: return "(Anonymous class)"; - case 171: - case 172: + case 173: + case 174: return "(Anonymous function)"; } } @@ -11851,6 +12084,7 @@ var ts; } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16; + var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 16777343) { @@ -11858,6 +12092,12 @@ var ts; ? "any" : type.intrinsicName); } + else if (type.flags & 33554432) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } else if (type.flags & 4096) { writeTypeReference(type, flags); } @@ -11896,9 +12136,9 @@ var ts; writeType(types[i], delimiter === 24 ? 0 : 64); } } - function writeSymbolTypeReference(symbol, typeArguments, pos, end) { - if (!isReservedMemberName(symbol.name)) { - buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056); + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056, 0, flags); } if (pos < end) { writePunctuation(writer, 25); @@ -11912,7 +12152,7 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments; + var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1)) { writeType(typeArguments[0], 64); writePunctuation(writer, 19); @@ -11930,12 +12170,13 @@ var ts; i++; } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i); + writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); writePunctuation(writer, 21); } } } - writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length); + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } function writeTupleType(type) { @@ -11947,7 +12188,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeTypeList(type.types, type.flags & 16384 ? 46 : 45); + writeTypeList(type.types, type.flags & 16384 ? 47 : 46); if (flags & 64) { writePunctuation(writer, 18); } @@ -11967,7 +12208,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 115); + writeKeyword(writer, 117); } } else { @@ -11988,7 +12229,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 246 || declaration.parent.kind === 217; + return declaration.parent.kind === 248 || declaration.parent.kind === 219; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -11997,7 +12238,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 99); + writeKeyword(writer, 101); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } @@ -12031,7 +12272,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { @@ -12040,6 +12281,8 @@ var ts; return; } } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; writePunctuation(writer, 15); writer.writeLine(); writer.increaseIndent(); @@ -12051,7 +12294,7 @@ var ts; } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -12060,11 +12303,11 @@ var ts; if (resolved.stringIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 128); + writeKeyword(writer, 130); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.stringIndexType, 0); writePunctuation(writer, 23); @@ -12073,11 +12316,11 @@ var ts; if (resolved.numberIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 126); + writeKeyword(writer, 128); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.numberIndexType, 0); writePunctuation(writer, 23); @@ -12092,7 +12335,7 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -12102,9 +12345,9 @@ var ts; else { buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(t, 0); writePunctuation(writer, 23); @@ -12113,6 +12356,7 @@ var ts; } writer.decreaseIndent(); writePunctuation(writer, 16); + inObjectTypeLiteral = saveInObjectTypeLiteral; } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -12126,7 +12370,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 81); + writeKeyword(writer, 83); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -12138,9 +12382,9 @@ var ts; } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } @@ -12187,14 +12431,14 @@ var ts; writePunctuation(writer, 34); } else { - writePunctuation(writer, 53); + writePunctuation(writer, 54); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 122); + writeKeyword(writer, 124); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -12228,13 +12472,13 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 216) { + if (node.kind === 218) { if (node.name.kind === 9) { return node; } } - else if (node.kind === 246) { - return ts.isExternalModule(node) ? node : undefined; + else if (node.kind === 248) { + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -12276,59 +12520,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 161: + case 163: return isDeclarationVisible(node.parent.parent); - case 209: + case 211: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 216: - case 212: - case 213: + case 218: case 214: - case 211: case 215: - case 219: + case 216: + case 213: + case 217: + case 221: var parent_4 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 219 && parent_4.kind !== 246 && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } return isDeclarationVisible(parent_4); - case 139: - case 138: - case 143: - case 144: case 141: case 140: + case 145: + case 146: + case 143: + case 142: if (node.flags & (32 | 64)) { return false; } - case 142: - case 146: - case 145: + case 144: + case 148: case 147: - case 136: - case 217: - case 150: - case 151: - case 153: case 149: - case 154: + case 138: + case 219: + case 152: + case 153: case 155: + case 151: case 156: case 157: case 158: + case 159: + case 160: return isDeclarationVisible(node.parent); - case 221: - case 222: + case 223: case 224: + case 226: return false; - case 135: - case 246: + case 137: + case 248: return true; - case 225: + case 227: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -12344,10 +12588,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 225) { + if (node.parent && node.parent.kind === 227) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 230) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -12422,7 +12666,7 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 209 ? node.parent.parent.parent : node.parent; + return node.kind === 211 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -12435,9 +12679,13 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + var parentType = getTypeForBindingElementParent(pattern.parent); if (parentType === unknownType) { return unknownType; } @@ -12448,7 +12696,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 159) { + if (pattern.kind === 161) { var name_11 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_11.text) || isNumericLiteralName(name_11.text) && getIndexTypeOfType(parentType, 1) || @@ -12482,10 +12730,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 198) { + if (declaration.parent.parent.kind === 200) { return anyType; } - if (declaration.parent.parent.kind === 199) { + if (declaration.parent.parent.kind === 201) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -12494,10 +12742,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var func = declaration.parent; - if (func.kind === 144 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143); + if (func.kind === 146 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12510,7 +12758,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 244) { + if (declaration.kind === 246) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -12548,7 +12796,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 185 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 187 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -12557,7 +12805,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 159 + return pattern.kind === 161 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -12567,12 +12815,12 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 243 ? getWidenedType(type) : type; + return declaration.kind !== 245 ? getWidenedType(type) : type; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 136 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 138 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12585,12 +12833,18 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 242) { + if (declaration.parent.kind === 244) { return links.type = anyType; } - if (declaration.kind === 225) { + if (declaration.kind === 227) { return links.type = checkExpression(declaration.expression); } + if (declaration.kind === 181) { + return links.type = checkExpression(declaration.right); + } + if (declaration.kind === 166) { + return checkExpressionCached(declaration.parent.right); + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } @@ -12613,7 +12867,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 143) { + if (accessor.kind === 145) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12629,8 +12883,8 @@ var ts; if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 143); - var setter = ts.getDeclarationOfKind(symbol, 144); + var getter = ts.getDeclarationOfKind(symbol, 145); + var setter = ts.getDeclarationOfKind(symbol, 146); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -12656,7 +12910,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 143); + var getter_1 = ts.getDeclarationOfKind(symbol, 145); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -12745,9 +12999,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 212 || node.kind === 184 || - node.kind === 211 || node.kind === 171 || - node.kind === 141 || node.kind === 172) { + if (node.kind === 214 || node.kind === 186 || + node.kind === 213 || node.kind === 173 || + node.kind === 143 || node.kind === 174) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -12756,15 +13010,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 213 || node.kind === 212 || - node.kind === 184 || node.kind === 214) { + if (node.kind === 215 || node.kind === 214 || + node.kind === 186 || node.kind === 216) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -12869,7 +13123,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 213 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -12890,6 +13144,29 @@ var ts; } } } + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 215) { + if (declaration.flags & 524288) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0; _b < baseTypeNodes.length; _b++) { + var node = baseTypeNodes[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056, true); + if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -12897,7 +13174,7 @@ var ts; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - if (outerTypeParameters || localTypeParameters) { + if (outerTypeParameters || localTypeParameters || kind === 1024 || !isIndependentInterface(symbol)) { type.flags |= 4096; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; @@ -12906,6 +13183,9 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; + type.thisType = createType(512 | 33554432); + type.thisType.symbol = symbol; + type.thisType.constraint = getTypeWithThisArgument(type); } } return links.declaredType; @@ -12916,7 +13196,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 214); + var declaration = ts.getDeclarationOfKind(symbol, 216); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -12947,7 +13227,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 135).constraint) { + if (!ts.getDeclarationOfKind(symbol, 137).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -12980,6 +13260,66 @@ var ts; } return unknownType; } + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + function isIndependentType(node) { + switch (node.kind) { + case 117: + case 130: + case 128: + case 120: + case 131: + case 103: + case 9: + return true; + case 156: + return isIndependentType(node.elementType); + case 151: + return isIndependentTypeReference(node); + } + return false; + } + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 144 && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 141: + case 140: + return isIndependentVariableLikeDeclaration(declaration); + case 143: + case 142: + case 144: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } function createSymbolTable(symbols) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { @@ -12988,11 +13328,11 @@ var ts; } return result; } - function createInstantiatedSymbolTable(symbols, mapper) { + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; - result[symbol.name] = instantiateSymbol(symbol, mapper); + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } @@ -13023,44 +13363,54 @@ var ts; } return type; } - function resolveClassOrInterfaceMembers(type) { - var target = resolveDeclaredMembers(type); - var members = target.symbol.members; - var callSignatures = target.declaredCallSignatures; - var constructSignatures = target.declaredConstructSignatures; - var stringIndexType = target.declaredStringIndexType; - var numberIndexType = target.declaredNumberIndexType; - var baseTypes = getBaseTypes(target); + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexType = source.declaredStringIndexType; + var numberIndexType = source.declaredNumberIndexType; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexType = instantiateType(source.declaredStringIndexType, mapper); + numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + } + var baseTypes = getBaseTypes(source); if (baseTypes.length) { - members = createSymbolTable(target.declaredProperties); + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0; _i < baseTypes.length; _i++) { var baseType = baseTypes[_i]; - addInheritedMembers(members, getPropertiesOfObjectType(baseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1); + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); } } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } function resolveTypeReferenceMembers(type) { - var target = resolveDeclaredMembers(type.target); - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; - ts.forEach(getBaseTypes(target), function (baseType) { - var instantiatedBaseType = instantiateType(baseType, mapper); - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); - }); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); @@ -13109,7 +13459,8 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true))); + var arrayElementType = getUnionType(type.elementTypes, true); + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -13211,7 +13562,14 @@ var ts; var constructSignatures; var stringIndexType; var numberIndexType; - if (symbol.flags & 2048) { + if (type.target) { + members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0), type.mapper); + numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1), type.mapper); + } + else if (symbol.flags & 2048) { members = symbol.members; callSignatures = getSignaturesOfSymbol(members["__call"]); constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -13247,7 +13605,10 @@ var ts; } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 | 2048)) { + if (type.flags & 4096) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 | 2048)) { resolveClassOrInterfaceMembers(type); } else if (type.flags & 65536) { @@ -13262,9 +13623,6 @@ var ts; else if (type.flags & 32768) { resolveIntersectionTypeMembers(type); } - else { - resolveTypeReferenceMembers(type); - } } return type; } @@ -13471,7 +13829,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 142 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 144 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13502,7 +13860,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 148) { + if (declaration.type.kind === 150) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -13512,8 +13870,8 @@ var ts; } } else { - if (declaration.kind === 143 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 144); + if (declaration.kind === 145 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 146); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13531,19 +13889,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 150: - case 151: - case 211: - case 141: - case 140: + case 152: + case 153: + case 213: + case 143: case 142: + case 144: + case 147: + case 148: + case 149: case 145: case 146: - case 147: - case 143: - case 144: - case 171: - case 172: + case 173: + case 174: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -13555,6 +13913,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3)) { @@ -13613,7 +13981,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 142 || signature.declaration.kind === 146; + var isConstructor = signature.declaration.kind === 144 || signature.declaration.kind === 148; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -13627,7 +13995,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 126 : 128; + var syntaxKind = kind === 1 ? 128 : 130; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -13656,30 +14024,33 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137).parent); } function getTypeListId(types) { - switch (types.length) { - case 1: - return "" + types[0].id; - case 2: - return types[0].id + "," + types[1].id; - default: - var result = ""; - for (var i = 0; i < types.length; i++) { - if (i > 0) { - result += ","; + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; } - result += types[i].id; - } - return result; + return result; + } } + return ""; } function getPropagatingFlagsOfTypes(types) { var result = 0; @@ -13693,7 +14064,7 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | getPropagatingFlagsOfTypes(typeArguments); + var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -13709,13 +14080,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 149 && n.typeName.kind === 67) { + if (n.kind === 151 && n.typeName.kind === 69) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -13782,7 +14153,7 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 149 ? node.typeName : + var typeNameOrExpression = node.kind === 151 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -13808,9 +14179,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 212: - case 213: + case 214: case 215: + case 217: return declaration; } } @@ -13847,10 +14218,13 @@ var ts; return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056, undefined), arity); } function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); - var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); + var typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace, name) { + var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 | 107455); + } function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -13860,17 +14234,17 @@ var ts; ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } - function createTypeFromGenericGlobalType(genericGlobalType, elementType) { - return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType; + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, elementType); + return createTypeFromGenericGlobalType(globalIterableType, [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType); + return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); } function createArrayType(elementType) { - return createTypeFromGenericGlobalType(globalArrayType, elementType); + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -14027,46 +14401,66 @@ var ts; } return links.resolvedType; } + function getThisType(node) { + var container = ts.getThisContainer(node, false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { + if (!(container.flags & 128)) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } function getTypeFromTypeNode(node) { switch (node.kind) { - case 115: + case 117: return anyType; - case 128: + case 130: return stringType; - case 126: + case 128: return numberType; - case 118: + case 120: return booleanType; - case 129: + case 131: return esSymbolType; - case 101: + case 103: return voidType; + case 97: + return getTypeFromThisTypeNode(node); case 9: return getTypeFromStringLiteral(node); - case 149: - return getTypeFromTypeReference(node); - case 148: - return booleanType; - case 186: - return getTypeFromTypeReference(node); - case 152: - return getTypeFromTypeQueryNode(node); - case 154: - return getTypeFromArrayTypeNode(node); - case 155: - return getTypeFromTupleTypeNode(node); - case 156: - return getTypeFromUnionTypeNode(node); - case 157: - return getTypeFromIntersectionTypeNode(node); - case 158: - return getTypeFromTypeNode(node.type); - case 150: case 151: + return getTypeFromTypeReference(node); + case 150: + return booleanType; + case 188: + return getTypeFromTypeReference(node); + case 154: + return getTypeFromTypeQueryNode(node); + case 156: + return getTypeFromArrayTypeNode(node); + case 157: + return getTypeFromTupleTypeNode(node); + case 158: + return getTypeFromUnionTypeNode(node); + case 159: + return getTypeFromIntersectionTypeNode(node); + case 160: + return getTypeFromTypeNode(node.type); + case 152: case 153: + case 155: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 67: - case 133: + case 69: + case 135: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -14170,7 +14564,7 @@ var ts; type: instantiateType(signature.typePredicate.type, mapper) }; } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -14202,21 +14596,13 @@ var ts; mapper.instantiations = []; } var result = createObjectType(65536 | 131072, type.symbol); - result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); - result.members = createSymbolTable(result.properties); - result.callSignatures = instantiateList(getSignaturesOfType(type, 0), mapper, instantiateSignature); - result.constructSignatures = instantiateList(getSignaturesOfType(type, 1), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, 0); - var numberIndexType = getIndexTypeOfType(type, 1); - if (stringIndexType) - result.stringIndexType = instantiateType(stringIndexType, mapper); - if (numberIndexType) - result.numberIndexType = instantiateType(numberIndexType, mapper); + result.target = type; + result.mapper = mapper; mapper.instantiations[type.id] = result; return result; } function instantiateType(type, mapper) { - if (mapper !== identityMapper) { + if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } @@ -14240,27 +14626,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 171: - case 172: + case 173: + case 174: return isContextSensitiveFunctionLikeDeclaration(node); - case 163: + case 165: return ts.forEach(node.properties, isContextSensitive); - case 162: + case 164: return ts.forEach(node.elements, isContextSensitive); - case 180: + case 182: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 179: - return node.operatorToken.kind === 51 && + case 181: + return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 243: + case 245: return isContextSensitive(node.initializer); - case 141: - case 140: + case 143: + case 142: return isContextSensitiveFunctionLikeDeclaration(node); - case 170: + case 172: return isContextSensitive(node.expression); } return false; @@ -14413,7 +14799,7 @@ var ts; } else { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; } } @@ -14435,7 +14821,7 @@ var ts; var result; if (source.flags & 80896 && target.flags & 80896) { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, false)) { + if (result = typeArgumentsRelatedTo(source, target, false)) { return result; } } @@ -14545,9 +14931,14 @@ var ts; } return result; } - function typesRelatedTo(sources, targets, reportErrors) { + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0; + } var result = -1; - for (var i = 0, len = sources.length; i < len; i++) { + for (var i = 0; i < targets.length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; @@ -15198,22 +15589,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 139: - case 138: + case 141: + case 140: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 136: + case 138: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 211: - case 141: - case 140: + case 213: case 143: - case 144: - case 171: - case 172: + case 142: + case 145: + case 146: + case 173: + case 174: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -15309,9 +15700,10 @@ var ts; } } else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - var sourceTypes = source.typeArguments; - var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } @@ -15465,10 +15857,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 152: + case 154: return true; - case 67: - case 133: + case 69: + case 135: node = node.parent; continue; default: @@ -15508,12 +15900,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 55 && node.operatorToken.kind <= 66) { + if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { var n = node.left; - while (n.kind === 170) { + while (n.kind === 172) { n = n.expression; } - if (n.kind === 67 && getResolvedSymbol(n) === symbol) { + if (n.kind === 69 && getResolvedSymbol(n) === symbol) { return true; } } @@ -15527,55 +15919,55 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 179: + case 181: return isAssignedInBinaryExpression(node); - case 209: - case 161: - return isAssignedInVariableDeclaration(node); - case 159: - case 160: - case 162: + case 211: case 163: + return isAssignedInVariableDeclaration(node); + case 161: + case 162: case 164: case 165: case 166: case 167: + case 168: case 169: - case 187: - case 170: - case 177: - case 173: - case 176: - case 174: + case 171: + case 189: + case 172: + case 179: case 175: case 178: - case 182: + case 176: + case 177: case 180: - case 183: - case 190: - case 191: + case 184: + case 182: + case 185: + case 192: case 193: - case 194: case 195: case 196: case 197: case 198: case 199: - case 202: - case 203: + case 200: + case 201: case 204: - case 239: - case 240: case 205: case 206: - case 207: + case 241: case 242: - case 231: - case 232: - case 236: - case 237: + case 207: + case 208: + case 209: + case 244: case 233: + case 234: case 238: + case 239: + case 235: + case 240: return ts.forEachChild(node, isAssignedIn); } return false; @@ -15590,34 +15982,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 194: + case 196: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 180: + case 182: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 179: + case 181: if (child === node.right) { - if (node.operatorToken.kind === 50) { + if (node.operatorToken.kind === 51) { narrowedType = narrowType(type, node.left, true); } - else if (node.operatorToken.kind === 51) { + else if (node.operatorToken.kind === 52) { narrowedType = narrowType(type, node.left, false); } } break; - case 246: - case 216: - case 211: - case 141: - case 140: + case 248: + case 218: + case 213: case 143: - case 144: case 142: + case 145: + case 146: + case 144: break loop; } if (narrowedType !== type) { @@ -15631,12 +16023,12 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 174 || expr.right.kind !== 9) { + if (expr.left.kind !== 176 || expr.right.kind !== 9) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 67 || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; @@ -15682,7 +16074,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -15746,27 +16138,27 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 166: + case 168: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 170: + case 172: return narrowType(type, expr.expression, assumeTrue); - case 179: + case 181: var operator = expr.operatorToken.kind; if (operator === 32 || operator === 33) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 50) { + else if (operator === 51) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 51) { + else if (operator === 52) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 89) { + else if (operator === 91) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 177: - if (expr.operator === 48) { + case 179: + if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -15778,7 +16170,7 @@ var ts; var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 172) { + if (container.kind === 174) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -15809,15 +16201,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 242) { + symbol.valueDeclaration.parent.kind === 244) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 210) { + while (container.kind !== 212) { container = container.parent; } container = container.parent; - if (container.kind === 191) { + if (container.kind === 193) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -15835,7 +16227,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 139 || container.kind === 142) { + if (container.kind === 141 || container.kind === 144) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -15846,29 +16238,29 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 172) { + if (container.kind === 174) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 216: + case 218: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 215: + case 217: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 142: + case 144: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 139: - case 138: + case 141: + case 140: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 134: + case 136: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -15877,27 +16269,27 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 136) { + if (n.kind === 138) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 166 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 168 && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 172) { + while (container && container.kind === 174) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -15923,7 +16315,7 @@ var ts; return unknownType; } if (!canUseSuperExpression) { - if (container && container.kind === 134) { + if (container && container.kind === 136) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -15934,7 +16326,7 @@ var ts; } return unknownType; } - if (container.kind === 142 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 144 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -15946,24 +16338,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 142; + return container.kind === 144; } else { if (container && ts.isClassLike(container.parent)) { if (container.flags & 128) { - return container.kind === 141 || - container.kind === 140 || - container.kind === 143 || - container.kind === 144; + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146; } else { - return container.kind === 141 || + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146 || + container.kind === 141 || container.kind === 140 || - container.kind === 143 || - container.kind === 144 || - container.kind === 139 || - container.kind === 138 || - container.kind === 142; + container.kind === 144; } } } @@ -15997,7 +16389,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -16030,7 +16422,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 136 && node.parent.initializer === node) { + if (node.parent.kind === 138 && node.parent.initializer === node) { return true; } node = node.parent; @@ -16039,8 +16431,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 142 || - functionDecl.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144))) { + functionDecl.kind === 144 || + functionDecl.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -16059,7 +16451,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 168) { + if (template.parent.kind === 170) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -16067,12 +16459,12 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 55 && operator <= 66) { + if (operator >= 56 && operator <= 68) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 51) { + else if (operator === 52) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -16159,7 +16551,7 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 236) { + if (expr.parent.kind === 238) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -16169,7 +16561,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 237) { + if (expr.kind === 239) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -16187,38 +16579,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 209: - case 136: - case 139: + case 211: case 138: - case 161: + case 141: + case 140: + case 163: return getContextualTypeForInitializerExpression(node); - case 172: - case 202: + case 174: + case 204: return getContextualTypeForReturnExpression(node); - case 182: + case 184: return getContextualTypeForYieldOperand(parent); - case 166: - case 167: - return getContextualTypeForArgument(parent, node); + case 168: case 169: - case 187: + return getContextualTypeForArgument(parent, node); + case 171: + case 189: return getTypeFromTypeNode(parent.type); - case 179: + case 181: return getContextualTypeForBinaryOperand(node); - case 243: + case 245: return getContextualTypeForObjectLiteralElement(parent); - case 162: + case 164: return getContextualTypeForElementExpression(node); - case 180: + case 182: return getContextualTypeForConditionalOperand(node); - case 188: - ts.Debug.assert(parent.parent.kind === 181); + case 190: + ts.Debug.assert(parent.parent.kind === 183); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 170: + case 172: return getContextualType(parent); - case 238: - case 237: + case 240: + case 239: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -16233,7 +16625,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 171 || node.kind === 172; + return node.kind === 173 || node.kind === 174; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -16241,7 +16633,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -16281,13 +16673,13 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 179 && parent.operatorToken.kind === 55 && parent.left === node) { + if (parent.kind === 181 && parent.operatorToken.kind === 56 && parent.left === node) { return true; } - if (parent.kind === 243) { + if (parent.kind === 245) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 162) { + if (parent.kind === 164) { return isAssignmentTarget(parent); } return false; @@ -16297,8 +16689,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 161 && !!node.initializer) || - (node.kind === 179 && node.operatorToken.kind === 55); + return (node.kind === 163 && !!node.initializer) || + (node.kind === 181 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -16307,7 +16699,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 183) { + if (inDestructuringPattern && e.kind === 185) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -16319,7 +16711,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 183; + hasSpreadElement = hasSpreadElement || e.kind === 185; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -16330,7 +16722,7 @@ var ts; var contextualType = getContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 160 || pattern.kind === 162)) { + if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -16338,7 +16730,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 185) { + if (patternElement.kind !== 187) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -16353,7 +16745,7 @@ var ts; return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { - return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 136 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -16378,35 +16770,37 @@ var ts; return links.resolvedType; } function checkObjectLiteral(node, contextualMapper) { - checkGrammarObjectLiteralExpression(node); + var inDestructuringPattern = isAssignmentTarget(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 159 || contextualType.pattern.kind === 163); - var inDestructuringPattern = isAssignmentTarget(node); + (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 243 || - memberDecl.kind === 244 || + if (memberDecl.kind === 245 || + memberDecl.kind === 246 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 243) { + if (memberDecl.kind === 245) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 141) { + else if (memberDecl.kind === 143) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 244); + ts.Debug.assert(memberDecl.kind === 246); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - if (memberDecl.kind === 243 && hasDefaultValue(memberDecl.initializer)) { + var isOptional = (memberDecl.kind === 245 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 246 && memberDecl.objectAssignmentInitializer); + if (isOptional) { prop.flags |= 536870912; } } @@ -16429,7 +16823,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 143 || memberDecl.kind === 144); + ts.Debug.assert(memberDecl.kind === 145 || memberDecl.kind === 146); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16485,7 +16879,7 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 67) { + if (lhs.kind === 69) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && @@ -16502,17 +16896,17 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 238: + case 240: checkJsxExpression(child); break; - case 231: + case 233: checkJsxElement(child); break; - case 232: + case 234: checkJsxSelfClosingElement(child); break; default: - ts.Debug.assert(child.kind === 234); + ts.Debug.assert(child.kind === 236); } } return jsxElementType || anyType; @@ -16521,7 +16915,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 133) { + if (tagName.kind === 135) { return false; } else { @@ -16622,12 +17016,14 @@ var ts; var valueSymbol = resolveJsxTagName(node); if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4; - getSymbolLinks(valueSymbol).referenced = true; + if (valueSymbol.flags & 8388608) { + markAliasSymbolAsReferenced(valueSymbol); + } } return valueSymbol || unknownSymbol; } function resolveJsxTagName(node) { - if (node.tagName.kind === 67) { + if (node.tagName.kind === 69) { var tag = node.tagName; var sym = getResolvedSymbol(tag); return sym.exportSymbol || sym; @@ -16767,11 +17163,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 236) { + if (node.attributes[i].kind === 238) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 237); + ts.Debug.assert(node.attributes[i].kind === 239); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -16797,7 +17193,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 139; + return s.valueDeclaration ? s.valueDeclaration.kind : 141; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -16805,11 +17201,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 93) { - var errorNode = node.kind === 164 ? + if (left.kind === 95) { + var errorNode = node.kind === 166 ? node.name : node.right; - if (getDeclarationKindFromSymbol(prop) !== 141) { + if (getDeclarationKindFromSymbol(prop) !== 143) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -16830,7 +17226,7 @@ var ts; } return true; } - if (left.kind === 93) { + if (left.kind === 95) { return true; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -16840,6 +17236,9 @@ var ts; if (flags & 128) { return true; } + if (type.flags & 33554432) { + type = getConstraintOfTypeParameter(type); + } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; @@ -16864,18 +17263,18 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 ? apparentType : type)); } return unknownType; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, type, prop); + checkClassPropertyAccess(node, left, apparentType, prop); } return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 164 + var left = node.kind === 166 ? node.expression : node.left; var type = checkExpression(left); @@ -16890,7 +17289,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 167 && node.parent.expression === node) { + if (node.parent.kind === 169 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -16949,6 +17348,12 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } + if (indexArgumentExpression.kind === 167 || indexArgumentExpression.kind === 166) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); @@ -16986,10 +17391,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 168) { + if (node.kind === 170) { checkExpression(node.template); } - else if (node.kind !== 137) { + else if (node.kind !== 139) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -17040,7 +17445,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 183) { + if (arg && arg.kind === 185) { return i; } } @@ -17052,11 +17457,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 168) { + if (node.kind === 170) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 181) { + if (tagExpression.template.kind === 183) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -17068,7 +17473,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 137) { + else if (node.kind === 139) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -17076,7 +17481,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 167); + ts.Debug.assert(callExpression.kind === 169); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -17129,7 +17534,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -17176,7 +17581,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -17195,16 +17600,16 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 168) { + if (node.kind === 170) { var template = node.template; args = [undefined]; - if (template.kind === 181) { + if (template.kind === 183) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 137) { + else if (node.kind === 139) { return undefined; } else { @@ -17213,18 +17618,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 137) { + if (node.kind === 139) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return 1; - case 139: - return 2; case 141: + return 2; case 143: - case 144: + case 145: + case 146: + if (languageVersion === 0) { + return 2; + } return signature.parameters.length >= 3 ? 3 : 2; - case 136: + case 138: return 3; } } @@ -17234,20 +17642,20 @@ var ts; } function getEffectiveDecoratorFirstArgumentType(node) { switch (node.kind) { - case 212: - case 184: + case 214: + case 186: var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 136: + case 138: node = node.parent; - if (node.kind === 142) { + if (node.kind === 144) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } - case 139: case 141: case 143: - case 144: + case 145: + case 146: return getParentTypeOfClassElement(node); default: ts.Debug.fail("Unsupported decorator target."); @@ -17256,25 +17664,25 @@ var ts; } function getEffectiveDecoratorSecondArgumentType(node) { switch (node.kind) { - case 212: + case 214: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 136: + case 138: node = node.parent; - if (node.kind === 142) { + if (node.kind === 144) { return anyType; } - case 139: case 141: case 143: - case 144: + case 145: + case 146: var element = node; switch (element.name.kind) { - case 67: + case 69: case 8: case 9: return getStringLiteralType(element.name); - case 134: + case 136: var nameType = checkComputedPropertyName(element.name); if (allConstituentTypesHaveKind(nameType, 16777216)) { return nameType; @@ -17293,17 +17701,17 @@ var ts; } function getEffectiveDecoratorThirdArgumentType(node) { switch (node.kind) { - case 212: + case 214: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 136: + case 138: return numberType; - case 139: + case 141: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 141: case 143: - case 144: + case 145: + case 146: var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); default: @@ -17325,26 +17733,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return globalTemplateStringsArrayType; } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 137 || - (argIndex === 0 && node.kind === 168)) { + if (node.kind === 139 || + (argIndex === 0 && node.kind === 170)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return node.expression; } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return node.template; } else { @@ -17352,12 +17760,12 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 168; - var isDecorator = node.kind === 137; + var isTaggedTemplate = node.kind === 170; + var isDecorator = node.kind === 139; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; - if (node.expression.kind !== 93) { + if (node.expression.kind !== 95) { ts.forEach(typeArguments, checkSourceElement); } } @@ -17495,7 +17903,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); @@ -17584,16 +17992,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 136: + case 138: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 139: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 141: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 143: - case 144: + case 145: + case 146: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -17621,16 +18029,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 166) { + if (node.kind === 168) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 167) { + else if (node.kind === 169) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 168) { + else if (node.kind === 170) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 137) { + else if (node.kind === 139) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -17642,21 +18050,24 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { return voidType; } - if (node.kind === 167) { + if (node.kind === 169) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 142 && - declaration.kind !== 146 && - declaration.kind !== 151) { + declaration.kind !== 144 && + declaration.kind !== 148 && + declaration.kind !== 153) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -17691,10 +18102,22 @@ var ts; assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } } + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 187) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + assignBindingElementTypes(element); + } + } + } + } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); @@ -17715,7 +18138,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 190) { + if (func.body.kind !== 192) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -17819,7 +18242,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 206); + return (body.statements.length === 1) && (body.statements[0].kind === 208); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -17828,7 +18251,7 @@ var ts; if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 190) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192) { return; } var bodyBlock = func.body; @@ -17841,9 +18264,9 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 171) { + if (!hasGrammarError && node.kind === 173) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -17879,14 +18302,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 141 && node.kind !== 140) { + if (produceDiagnostics && node.kind !== 143 && node.kind !== 142) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -17903,7 +18326,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 190) { + if (node.body.kind === 192) { checkSourceElement(node.body); } else { @@ -17935,17 +18358,17 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 67: { + case 69: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 164: { + case 166: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 165: + case 167: return true; - case 170: + case 172: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17953,12 +18376,12 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 67: - case 164: { + case 69: + case 166: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; } - case 165: { + case 167: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 9) { @@ -17968,7 +18391,7 @@ var ts; } return false; } - case 170: + case 172: return isConstVariableReference(n.expression); default: return false; @@ -18013,15 +18436,15 @@ var ts; switch (node.operator) { case 35: case 36: - case 49: + case 50: if (someConstituentTypeHasKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 48: + case 49: return booleanType; - case 40: case 41: + case 42: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); @@ -18076,21 +18499,21 @@ var ts; function isConstEnumSymbol(symbol) { return (symbol.flags & 128) !== 0; } - function checkInstanceOfExpression(node, leftType, rightType) { + function checkInstanceOfExpression(left, right, leftType, rightType) { if (allConstituentTypesHaveKind(leftType, 16777726)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } - function checkInExpression(node, leftType, rightType) { + function checkInExpression(left, right, leftType, rightType) { if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } @@ -18098,7 +18521,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 243 || p.kind === 244) { + if (p.kind === 245 || p.kind === 246) { var name_14 = p.name; var type = isTypeAny(sourceType) ? sourceType @@ -18106,7 +18529,12 @@ var ts; isNumericLiteralName(name_14.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name_14, type); + if (p.kind === 246) { + checkDestructuringAssignment(p, type); + } + else { + checkDestructuringAssignment(p.initializer || name_14, type); + } } else { error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_14)); @@ -18123,8 +18551,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { + if (e.kind !== 187) { + if (e.kind !== 185) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -18149,7 +18577,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 179 && restExpression.operatorToken.kind === 55) { + if (restExpression.kind === 181 && restExpression.operatorToken.kind === 56) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -18161,15 +18589,26 @@ var ts; } return sourceType; } - function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 179 && target.operatorToken.kind === 55) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 246) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 181 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 163) { + if (target.kind === 165) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 162) { + if (target.kind === 164) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -18182,33 +18621,38 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - var operator = node.operatorToken.kind; - if (operator === 55 && (node.left.kind === 163 || node.left.kind === 162)) { - return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 && (left.kind === 165 || left.kind === 164)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); switch (operator) { case 37: - case 58: case 38: case 59: - case 39: case 60: - case 36: - case 57: - case 42: + case 39: case 61: - case 43: + case 40: case 62: - case 44: + case 36: + case 58: + case 43: case 63: - case 46: + case 44: + case 64: + case 45: case 65: case 47: + case 67: + case 48: + case 68: + case 46: case 66: - case 45: - case 64: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -18216,19 +18660,19 @@ var ts; var suggestedOperator; if ((leftType.flags & 8) && (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { - var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } } return numberType; case 35: - case 56: + case 57: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -18252,7 +18696,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 56) { + if (operator === 57) { checkAssignmentOperator(resultType); } return resultType; @@ -18271,23 +18715,23 @@ var ts; reportOperatorError(); } return booleanType; - case 89: - return checkInstanceOfExpression(node, leftType, rightType); - case 88: - return checkInExpression(node, leftType, rightType); - case 50: - return rightType; + case 91: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90: + return checkInExpression(left, right, leftType, rightType); case 51: + return rightType; + case 52: return getUnionType([leftType, rightType]); - case 55: + case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 24: return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? node.left : - someConstituentTypeHasKind(rightType, 16777216) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? left : + someConstituentTypeHasKind(rightType, 16777216) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -18297,29 +18741,29 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 46: - case 65: - return 51; case 47: - case 66: + case 67: + return 52; + case 48: + case 68: return 33; - case 45: - case 64: - return 50; + case 46: + case 66: + return 51; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 55 && operator <= 66) { - var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (produceDiagnostics && operator >= 56 && operator <= 68) { + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); if (ok) { - checkTypeAssignableTo(valueType, leftType, node.left, undefined); + checkTypeAssignableTo(valueType, leftType, left, undefined); } } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function isYieldExpressionInClass(node) { @@ -18395,14 +18839,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -18425,7 +18869,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 133) { + if (node.kind === 135) { type = checkQualifiedName(node); } else { @@ -18433,9 +18877,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 164 && node.parent.expression === node) || - (node.parent.kind === 165 && node.parent.expression === node) || - ((node.kind === 67 || node.kind === 133) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 166 && node.parent.expression === node) || + (node.parent.kind === 167 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 135) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -18448,78 +18892,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 67: + case 69: return checkIdentifier(node); - case 95: - return checkThisExpression(node); - case 93: - return checkSuperExpression(node); - case 91: - return nullType; case 97: - case 82: + return checkThisExpression(node); + case 95: + return checkSuperExpression(node); + case 93: + return nullType; + case 99: + case 84: return booleanType; case 8: return checkNumericLiteral(node); - case 181: + case 183: return checkTemplateExpression(node); case 9: case 11: return stringType; case 10: return globalRegExpType; - case 162: - return checkArrayLiteral(node, contextualMapper); - case 163: - return checkObjectLiteral(node, contextualMapper); case 164: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 165: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 166: + return checkPropertyAccessExpression(node); case 167: - return checkCallExpression(node); + return checkIndexedAccess(node); case 168: - return checkTaggedTemplateExpression(node); - case 170: - return checkExpression(node.expression, contextualMapper); - case 184: - return checkClassExpression(node); - case 171: - case 172: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 174: - return checkTypeOfExpression(node); case 169: - case 187: - return checkAssertion(node); + return checkCallExpression(node); + case 170: + return checkTaggedTemplateExpression(node); + case 172: + return checkExpression(node.expression, contextualMapper); + case 186: + return checkClassExpression(node); case 173: - return checkDeleteExpression(node); - case 175: - return checkVoidExpression(node); + case 174: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 176: - return checkAwaitExpression(node); + return checkTypeOfExpression(node); + case 171: + case 189: + return checkAssertion(node); + case 175: + return checkDeleteExpression(node); case 177: - return checkPrefixUnaryExpression(node); + return checkVoidExpression(node); case 178: - return checkPostfixUnaryExpression(node); + return checkAwaitExpression(node); case 179: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 180: - return checkConditionalExpression(node, contextualMapper); - case 183: - return checkSpreadElementExpression(node, contextualMapper); - case 185: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 181: + return checkBinaryExpression(node, contextualMapper); case 182: + return checkConditionalExpression(node, contextualMapper); + case 185: + return checkSpreadElementExpression(node, contextualMapper); + case 187: + return undefinedType; + case 184: return checkYieldExpression(node); - case 238: + case 240: return checkJsxExpression(node); - case 231: - return checkJsxElement(node); - case 232: - return checkJsxSelfClosingElement(node); case 233: + return checkJsxElement(node); + case 234: + return checkJsxSelfClosingElement(node); + case 235: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -18540,7 +18984,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 142 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18555,15 +18999,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 141 || - node.kind === 211 || - node.kind === 171; + return node.kind === 143 || + node.kind === 213 || + node.kind === 173; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 67 && + if (param.name.kind === 69 && param.name.text === parameter.text) { return i; } @@ -18573,30 +19017,30 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 172: - case 145: - case 211: - case 171: - case 150: - case 141: - case 140: + case 174: + case 147: + case 213: + case 173: + case 152: + case 143: + case 142: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { - if (node.kind === 147) { + if (node.kind === 149) { checkGrammarIndexSignature(node); } - else if (node.kind === 150 || node.kind === 211 || node.kind === 151 || - node.kind === 145 || node.kind === 142 || - node.kind === 146) { + else if (node.kind === 152 || node.kind === 213 || node.kind === 153 || + node.kind === 147 || node.kind === 144 || + node.kind === 148) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 148) { + if (node.type.kind === 150) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -18615,19 +19059,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 159 || - param.name.kind === 160) { + if (param.name.kind === 161 || + param.name.kind === 162) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 67 && + if (element.name.kind === 69 && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 160 || - element.name.kind === 159) { + else if (element.name.kind === 162 || + element.name.kind === 161) { checkBindingPattern(element.name); } } @@ -18651,10 +19095,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 146: + case 148: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 145: + case 147: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18676,7 +19120,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 213) { + if (node.kind === 215) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -18691,7 +19135,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 128: + case 130: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18699,7 +19143,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 126: + case 128: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18739,7 +19183,7 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 166 && n.expression.kind === 93; + return n.kind === 168 && n.expression.kind === 95; } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); @@ -18757,15 +19201,15 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 95) { + if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 171 && n.kind !== 211) { + else if (n.kind !== 173 && n.kind !== 213) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 139 && + return n.kind === 141 && !(n.flags & 128) && !!n.initializer; } @@ -18785,7 +19229,7 @@ var ts; var superCallStatement; for (var _i = 0; _i < statements.length; _i++) { var statement = statements[_i]; - if (statement.kind === 193 && isSuperCallExpression(statement.expression)) { + if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -18809,13 +19253,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 143) { + if (node.kind === 145) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 143 ? 144 : 143; + var otherKind = node.kind === 145 ? 146 : 145; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -18900,9 +19344,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213) { - ts.Debug.assert(signatureDeclarationNode.kind === 145 || signatureDeclarationNode.kind === 146); - var signatureKind = signatureDeclarationNode.kind === 145 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215) { + ts.Debug.assert(signatureDeclarationNode.kind === 147 || signatureDeclarationNode.kind === 148); + var signatureKind = signatureDeclarationNode.kind === 147 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18920,7 +19364,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 213 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 215 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -18996,7 +19440,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 141 || node.kind === 140); + ts.Debug.assert(node.kind === 143 || node.kind === 142); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -19028,11 +19472,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 213 || node.parent.kind === 153 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 211 || node.kind === 141 || node.kind === 140 || node.kind === 142) { + if (node.kind === 213 || node.kind === 143 || node.kind === 142 || node.kind === 144) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -19145,16 +19589,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 213: + case 215: return 2097152; - case 216: + case 218: return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 212: - case 215: + case 214: + case 217: return 2097152 | 1048576; - case 219: + case 221: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -19165,7 +19609,8 @@ var ts; } } function checkNonThenableType(type, location, message) { - if (!(type.flags & 1) && isTypeAssignableTo(type, getGlobalThenableType())) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -19280,22 +19725,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 212: + case 214: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 136: + case 138: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 139: + case 141: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 141: case 143: - case 144: + case 145: + case 146: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -19304,9 +19749,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 149) { + if (node && node.kind === 151) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 149 ? 793056 : 1536; + var meaning = root.parent.kind === 151 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -19318,19 +19763,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 139: - checkTypeNodeAsExpression(node.type); - break; - case 136: - checkTypeNodeAsExpression(node.type); - break; case 141: checkTypeNodeAsExpression(node.type); break; + case 138: + checkTypeNodeAsExpression(node.type); + break; case 143: checkTypeNodeAsExpression(node.type); break; - case 144: + case 145: + checkTypeNodeAsExpression(node.type); + break; + case 146: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -19353,24 +19798,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 212: + case 214: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 141: - checkParameterTypeAnnotationsAsExpressions(node); - case 144: case 143: - case 139: - case 136: + checkParameterTypeAnnotationsAsExpressions(node); + case 146: + case 145: + case 141: + case 138: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 136) { + if (node.kind === 138) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -19388,12 +19833,9 @@ var ts; checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { - if (!compilerOptions.experimentalAsyncFunctions) { - error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning); - } emitAwaiter = true; } - if (node.name && node.name.kind === 134) { + if (node.name && node.name.kind === 136) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -19428,11 +19870,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 190) { + if (node.kind === 192) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 217) { + if (ts.isFunctionBlock(node) || node.kind === 219) { checkFunctionAndClassExpressionBodies(node); } } @@ -19450,19 +19892,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 139 || - node.kind === 138 || - node.kind === 141 || + if (node.kind === 141 || node.kind === 140 || node.kind === 143 || - node.kind === 144) { + node.kind === 142 || + node.kind === 145 || + node.kind === 146) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 136 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 138 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -19476,7 +19918,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration_1 = node.kind !== 67; + var isDeclaration_1 = node.kind !== 69; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -19497,7 +19939,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 67; + var isDeclaration_2 = node.kind !== 69; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -19510,11 +19952,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 216 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 218 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 246 && ts.isExternalModule(parent)) { + if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19522,7 +19964,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 209 && !node.initializer) { + if (node.kind === 211 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -19532,15 +19974,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210); - var container = varDeclList.parent.kind === 191 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); + var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 190 && ts.isFunctionLike(container.parent) || - container.kind === 217 || - container.kind === 216 || - container.kind === 246); + (container.kind === 192 && ts.isFunctionLike(container.parent) || + container.kind === 219 || + container.kind === 218 || + container.kind === 248); if (!namesShareScope) { var name_15 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); @@ -19550,16 +19992,16 @@ var ts; } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 136) { + if (ts.getRootDeclaration(node).kind !== 138) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 67) { + if (n.kind === 69) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 136) { + if (referencedSymbol.valueDeclaration.kind === 138) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19579,7 +20021,7 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19588,7 +20030,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 136 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 138 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19616,9 +20058,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 139 && node.kind !== 138) { + if (node.kind !== 141 && node.kind !== 140) { checkExportsOnMergedDeclarations(node); - if (node.kind === 209 || node.kind === 161) { + if (node.kind === 211 || node.kind === 163) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19639,7 +20081,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 163) { + if (node.modifiers && node.parent.kind === 165) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -19672,12 +20114,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 210) { + if (node.initializer && node.initializer.kind === 212) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19692,13 +20134,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -19713,7 +20155,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19723,7 +20165,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -19885,7 +20327,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144))); + return !!(node.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -19903,10 +20345,10 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 144) { + if (func.kind === 146) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 142) { + else if (func.kind === 144) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19915,7 +20357,9 @@ var ts; if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + if (promisedType) { + checkTypeAssignableTo(awaitedType, promisedType, node.expression); + } } else { checkTypeAssignableTo(exprType, returnType, node.expression); @@ -19939,7 +20383,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 240 && !hasDuplicateDefaultClause) { + if (clause.kind === 242 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19951,7 +20395,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 239) { + if (produceDiagnostics && clause.kind === 241) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -19968,7 +20412,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 205 && current.label.text === node.label.text) { + if (current.kind === 207 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -19994,7 +20438,7 @@ var ts; var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 67) { + if (catchClause.variableDeclaration.name.kind !== 69) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -20062,7 +20506,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 134 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 136 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -20132,6 +20576,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -20150,7 +20595,7 @@ var ts; } } } - checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); @@ -20163,7 +20608,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - ts.forEach(implementedTypeNodes, function (typeRefNode) { + for (var _b = 0; _b < implementedTypeNodes.length; _b++) { + var typeRefNode = implementedTypeNodes[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -20173,14 +20619,14 @@ var ts; if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { - checkTypeAssignableTo(type, t, node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); } } } - }); + } } if (produceDiagnostics) { checkIndexConstraints(type); @@ -20208,7 +20654,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { - if (derivedClassDecl.kind === 184) { + if (derivedClassDecl.kind === 186) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -20252,7 +20698,7 @@ var ts; } } function isAccessor(kind) { - return kind === 143 || kind === 144; + return kind === 145 || kind === 146; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -20289,7 +20735,7 @@ var ts; var ok = true; for (var _i = 0; _i < baseTypes.length; _i++) { var base = baseTypes[_i]; - var properties = getPropertiesOfObjectType(base); + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0; _a < properties.length; _a++) { var prop = properties[_a]; if (!ts.hasProperty(seen, prop.name)) { @@ -20318,7 +20764,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -20326,17 +20772,19 @@ var ts; } if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); if (checkInheritedPropertiesAreIdentical(type, node.name)) { - ts.forEach(getBaseTypes(type), function (baseType) { - checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); - }); + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } checkIndexConstraints(type); } } if (symbol && symbol.declarations) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 212 && !ts.isInAmbientContext(declaration)) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var declaration = _c[_b]; + if (declaration.kind === 214 && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -20367,10 +20815,15 @@ var ts; var autoValue = 0; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); - ts.forEach(node.members, function (member) { - if (member.name.kind !== 134 && isNumericLiteralName(member.name.text)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name.kind === 136) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } + var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; if (initializer) { autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); @@ -20378,10 +20831,13 @@ var ts; else if (ambient && !enumIsConst) { autoValue = undefined; } + else if (previousEnumMemberIsNonConstant) { + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } if (autoValue !== undefined) { getNodeLinks(member).enumMemberValue = autoValue++; } - }); + } nodeLinks.flags |= 8192; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { @@ -20392,7 +20848,10 @@ var ts; if (enumIsConst) { error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); } - else if (!ambient) { + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); } } @@ -20408,7 +20867,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 177: + case 179: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -20416,10 +20875,10 @@ var ts; switch (e.operator) { case 35: return value_1; case 36: return -value_1; - case 49: return ~value_1; + case 50: return ~value_1; } return undefined; - case 179: + case 181: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -20429,37 +20888,37 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 46: return left | right; - case 45: return left & right; - case 43: return left >> right; - case 44: return left >>> right; - case 42: return left << right; - case 47: return left ^ right; + case 47: return left | right; + case 46: return left & right; + case 44: return left >> right; + case 45: return left >>> right; + case 43: return left << right; + case 48: return left ^ right; case 37: return left * right; - case 38: return left / right; + case 39: return left / right; case 35: return left + right; case 36: return left - right; - case 39: return left % right; + case 40: return left % right; } return undefined; case 8: return +e.text; - case 170: + case 172: return evalConstant(e.expression); - case 67: - case 165: - case 164: + case 69: + case 167: + case 166: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName; - if (e.kind === 67) { + if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 165) { + if (e.kind === 167) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -20473,10 +20932,10 @@ var ts; } var current = expression; while (current) { - if (current.kind === 67) { + if (current.kind === 69) { break; } - else if (current.kind === 164) { + else if (current.kind === 166) { current = current.expression; } else { @@ -20499,7 +20958,7 @@ var ts; if (member === propertyDecl) { return undefined; } - if (!isDefinedBefore(propertyDecl, member)) { + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { reportError = false; error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return undefined; @@ -20513,7 +20972,7 @@ var ts; if (!produceDiagnostics) { return; } - checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -20535,7 +20994,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 215) { + if (declaration.kind !== 217) { return false; } var enumDeclaration = declaration; @@ -20558,8 +21017,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 212 || - (declaration.kind === 211 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 214 || + (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20610,7 +21069,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 212); + var mergedClass = ts.getDeclarationOfKind(symbol, 214); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -20618,9 +21077,9 @@ var ts; } if (isAmbientExternalModule) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } - if (isExternalModuleNameRelative(node.name.text)) { + if (ts.isExternalModuleNameRelative(node.name.text)) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -20629,17 +21088,17 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 133) { + if (node.kind === 135) { node = node.left; } - else if (node.kind === 164) { + else if (node.kind === 166) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 67); + ts.Debug.assert(node.kind === 69); return node; } function checkExternalImportOrExportDeclaration(node) { @@ -20648,14 +21107,14 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { - error(moduleName, node.kind === 226 ? + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { + error(moduleName, node.kind === 228 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } @@ -20669,7 +21128,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 228 ? + var message = node.kind === 230 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20695,7 +21154,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { checkImportBinding(importClause.namedBindings); } else { @@ -20730,8 +21189,8 @@ var ts; } } else { - if (languageVersion >= 2 && !ts.isInAmbientContext(node)) { - grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); + if (modulekind === 5 && !ts.isInAmbientContext(node)) { + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -20746,8 +21205,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -20760,7 +21219,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 246 && node.parent.kind !== 217 && node.parent.kind !== 216) { + if (node.parent.kind !== 248 && node.parent.kind !== 219 && node.parent.kind !== 218) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -20774,15 +21233,15 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 246 ? node.parent : node.parent.parent; - if (container.kind === 216 && container.name.kind === 67) { + var container = node.parent.kind === 248 ? node.parent : node.parent.parent; + if (container.kind === 218 && container.name.kind === 69) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { markExportAsReferenced(node); } else { @@ -20790,19 +21249,19 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (languageVersion >= 2) { - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (modulekind === 5) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (compilerOptions.module === 4) { + else if (modulekind === 4) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } function getModuleStatements(node) { - if (node.kind === 246) { + if (node.kind === 248) { return node.statements; } - if (node.kind === 216 && node.body.kind === 217) { + if (node.kind === 218 && node.body.kind === 219) { return node.body.statements; } return emptyArray; @@ -20839,183 +21298,182 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 216: - case 212: + case 218: + case 214: + case 215: case 213: - case 211: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 135: + case 137: return checkTypeParameter(node); - case 136: - return checkParameter(node); - case 139: case 138: - return checkPropertyDeclaration(node); - case 150: - case 151: - case 145: - case 146: - return checkSignatureDeclaration(node); - case 147: - return checkSignatureDeclaration(node); + return checkParameter(node); case 141: case 140: - return checkMethodDeclaration(node); - case 142: - return checkConstructorDeclaration(node); - case 143: - case 144: - return checkAccessorDeclaration(node); - case 149: - return checkTypeReferenceNode(node); - case 148: - return checkTypePredicate(node); + return checkPropertyDeclaration(node); case 152: - return checkTypeQuery(node); case 153: - return checkTypeLiteral(node); + case 147: + case 148: + return checkSignatureDeclaration(node); + case 149: + return checkSignatureDeclaration(node); + case 143: + case 142: + return checkMethodDeclaration(node); + case 144: + return checkConstructorDeclaration(node); + case 145: + case 146: + return checkAccessorDeclaration(node); + case 151: + return checkTypeReferenceNode(node); + case 150: + return checkTypePredicate(node); case 154: - return checkArrayType(node); + return checkTypeQuery(node); case 155: - return checkTupleType(node); + return checkTypeLiteral(node); case 156: + return checkArrayType(node); case 157: - return checkUnionOrIntersectionType(node); + return checkTupleType(node); case 158: + case 159: + return checkUnionOrIntersectionType(node); + case 160: return checkSourceElement(node.type); - case 211: - return checkFunctionDeclaration(node); - case 190: - case 217: - return checkBlock(node); - case 191: - return checkVariableStatement(node); - case 193: - return checkExpressionStatement(node); - case 194: - return checkIfStatement(node); - case 195: - return checkDoStatement(node); - case 196: - return checkWhileStatement(node); - case 197: - return checkForStatement(node); - case 198: - return checkForInStatement(node); - case 199: - return checkForOfStatement(node); - case 200: - case 201: - return checkBreakOrContinueStatement(node); - case 202: - return checkReturnStatement(node); - case 203: - return checkWithStatement(node); - case 204: - return checkSwitchStatement(node); - case 205: - return checkLabeledStatement(node); - case 206: - return checkThrowStatement(node); - case 207: - return checkTryStatement(node); - case 209: - return checkVariableDeclaration(node); - case 161: - return checkBindingElement(node); - case 212: - return checkClassDeclaration(node); case 213: - return checkInterfaceDeclaration(node); - case 214: - return checkTypeAliasDeclaration(node); - case 215: - return checkEnumDeclaration(node); - case 216: - return checkModuleDeclaration(node); - case 220: - return checkImportDeclaration(node); - case 219: - return checkImportEqualsDeclaration(node); - case 226: - return checkExportDeclaration(node); - case 225: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 192: - checkGrammarStatementInAmbientContext(node); - return; + case 219: + return checkBlock(node); + case 193: + return checkVariableStatement(node); + case 195: + return checkExpressionStatement(node); + case 196: + return checkIfStatement(node); + case 197: + return checkDoStatement(node); + case 198: + return checkWhileStatement(node); + case 199: + return checkForStatement(node); + case 200: + return checkForInStatement(node); + case 201: + return checkForOfStatement(node); + case 202: + case 203: + return checkBreakOrContinueStatement(node); + case 204: + return checkReturnStatement(node); + case 205: + return checkWithStatement(node); + case 206: + return checkSwitchStatement(node); + case 207: + return checkLabeledStatement(node); case 208: + return checkThrowStatement(node); + case 209: + return checkTryStatement(node); + case 211: + return checkVariableDeclaration(node); + case 163: + return checkBindingElement(node); + case 214: + return checkClassDeclaration(node); + case 215: + return checkInterfaceDeclaration(node); + case 216: + return checkTypeAliasDeclaration(node); + case 217: + return checkEnumDeclaration(node); + case 218: + return checkModuleDeclaration(node); + case 222: + return checkImportDeclaration(node); + case 221: + return checkImportEqualsDeclaration(node); + case 228: + return checkExportDeclaration(node); + case 227: + return checkExportAssignment(node); + case 194: checkGrammarStatementInAmbientContext(node); return; - case 229: + case 210: + checkGrammarStatementInAmbientContext(node); + return; + case 231: return checkMissingDeclaration(node); } } function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 171: - case 172: + case 173: + case 174: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 184: + case 186: ts.forEach(node.members, checkSourceElement); + ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; - case 141: - case 140: + case 143: + case 142: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 142: - case 143: case 144: - case 211: + case 145: + case 146: + case 213: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 203: + case 205: checkFunctionAndClassExpressionBodies(node.expression); break; - case 137: - case 136: case 139: case 138: - case 159: - case 160: + case 141: + case 140: case 161: case 162: case 163: - case 243: case 164: case 165: + case 245: case 166: case 167: case 168: - case 181: - case 188: case 169: - case 187: case 170: - case 174: - case 175: + case 183: + case 190: + case 171: + case 189: + case 172: case 176: - case 173: case 177: case 178: + case 175: case 179: case 180: - case 183: + case 181: case 182: - case 190: - case 217: - case 191: + case 185: + case 184: + case 192: + case 219: case 193: - case 194: case 195: case 196: case 197: @@ -21024,29 +21482,31 @@ var ts; case 200: case 201: case 202: + case 203: case 204: - case 218: - case 239: - case 240: - case 205: case 206: - case 207: - case 242: - case 209: - case 210: - case 212: + case 220: case 241: - case 186: - case 215: - case 245: - case 225: - case 246: - case 238: - case 231: - case 232: - case 236: - case 237: + case 242: + case 207: + case 208: + case 209: + case 244: + case 211: + case 212: + case 214: + case 243: + case 188: + case 217: + case 247: + case 227: + case 248: + case 240: case 233: + case 234: + case 238: + case 239: + case 235: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -21069,7 +21529,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -21124,7 +21584,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 203 && node.parent.statement === node) { + if (node.parent.kind === 205 && node.parent.statement === node) { return true; } node = node.parent; @@ -21146,28 +21606,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 246: - if (!ts.isExternalModule(location)) { + case 248: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 216: + case 218: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 215: + case 217: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 184: + case 186: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 212: - case 213: + case 214: + case 215: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 171: + case 173: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -21200,42 +21660,42 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 67 && + return name.kind === 69 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 135: - case 212: - case 213: + case 137: case 214: case 215: + case 216: + case 217: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 133) { + while (node.parent && node.parent.kind === 135) { node = node.parent; } - return node.parent && node.parent.kind === 149; + return node.parent && node.parent.kind === 151; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 164) { + while (node.parent && node.parent.kind === 166) { node = node.parent; } - return node.parent && node.parent.kind === 186; + return node.parent && node.parent.kind === 188; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 133) { + while (nodeOnRightSide.parent.kind === 135) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 219) { + if (nodeOnRightSide.parent.kind === 221) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225) { + if (nodeOnRightSide.parent.kind === 227) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -21247,10 +21707,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 225) { + if (entityName.parent.kind === 227) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 164) { + if (entityName.kind !== 166) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -21259,31 +21719,40 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 186 ? 793056 : 1536; + var meaning = 0; + if (entityName.parent.kind === 188) { + meaning = 793056; + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455; + } + } + else { + meaning = 1536; + } meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 233) || - (entityName.parent.kind === 232) || - (entityName.parent.kind === 235)) { + else if ((entityName.parent.kind === 235) || + (entityName.parent.kind === 234) || + (entityName.parent.kind === 237)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } - if (entityName.kind === 67) { + if (entityName.kind === 69) { var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 164) { + else if (entityName.kind === 166) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 133) { + else if (entityName.kind === 135) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -21292,14 +21761,14 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 149 ? 793056 : 1536; + var meaning = entityName.parent.kind === 151 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 236) { + else if (entityName.parent.kind === 238) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 148) { + if (entityName.parent.kind === 150) { return resolveEntityName(entityName, 1); } return undefined; @@ -21311,14 +21780,14 @@ var ts; if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 67) { + if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 225 + return node.parent.kind === 227 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 161 && - node.parent.parent.kind === 159 && + else if (node.parent.kind === 163 && + node.parent.parent.kind === 161 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -21328,29 +21797,29 @@ var ts; } } switch (node.kind) { - case 67: - case 164: - case 133: + case 69: + case 166: + case 135: return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 97: case 95: - case 93: - var type = checkExpression(node); + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 119: + case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 142) { + if (constructorDeclaration && constructorDeclaration.kind === 144) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 220 || node.parent.kind === 226) && + ((node.parent.kind === 222 || node.parent.kind === 228) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 165 && node.parent.argumentExpression === node) { + if (node.parent.kind === 167 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -21364,7 +21833,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 244) { + if (location && location.kind === 246) { return resolveEntityName(location.name, 107455); } return undefined; @@ -21464,11 +21933,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 246) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 248) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 216 || n.kind === 215) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 218 || n.kind === 217) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -21481,11 +21950,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 190: - case 218: - case 197: - case 198: + case 192: + case 220: case 199: + case 200: + case 201: return true; } return false; @@ -21511,22 +21980,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 219: case 221: - case 222: + case 223: case 224: - case 228: - return isAliasResolvedToValue(getSymbolOfNode(node)); case 226: + case 230: + return isAliasResolvedToValue(getSymbolOfNode(node)); + case 228: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 225: - return node.expression && node.expression.kind === 67 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 227: + return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 246 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 248 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -21574,7 +22043,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 245) { + if (node.kind === 247) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21660,21 +22129,6 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function getBlockScopedVariableId(n) { - ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 161 || (n.parent.kind === 209 && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 242; - if (isLetOrConst) { - getSymbolLinks(symbol); - return symbol.id; - } - return undefined; - } function instantiateSingleCallFunctionType(functionType, typeArguments) { if (functionType === unknownType) { return unknownType; @@ -21706,7 +22160,6 @@ var ts; isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, collectLinkedAliases: collectLinkedAliases, - getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter @@ -21717,7 +22170,7 @@ var ts; ts.bindSourceFile(file); }); ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); @@ -21745,6 +22198,7 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); if (languageVersion >= 2) { globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); @@ -21787,10 +22241,7 @@ var ts; if (!ts.nodeCanBeDecorated(node)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } - else if (languageVersion < 1) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); - } - else if (node.kind === 143 || node.kind === 144) { + else if (node.kind === 145 || node.kind === 146) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21800,38 +22251,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 143: + case 145: + case 146: case 144: - case 142: - case 139: - case 138: case 141: case 140: - case 147: - case 216: - case 220: - case 219: - case 226: - case 225: - case 136: + case 143: + case 142: + case 149: + case 218: + case 222: + case 221: + case 228: + case 227: + case 138: break; - case 211: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116) && - node.parent.kind !== 217 && node.parent.kind !== 246) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); - } - break; - case 212: case 213: - case 191: - case 214: - if (node.modifiers && node.parent.kind !== 217 && node.parent.kind !== 246) { + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; + case 214: case 215: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72) && - node.parent.kind !== 217 && node.parent.kind !== 246) { + case 193: + case 216: + if (node.modifiers && node.parent.kind !== 219 && node.parent.kind !== 248) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 217: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -21846,14 +22297,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { + case 112: + case 111: case 110: - case 109: - case 108: var text = void 0; - if (modifier.kind === 110) { + if (modifier.kind === 112) { text = "public"; } - else if (modifier.kind === 109) { + else if (modifier.kind === 111) { text = "protected"; lastProtected = modifier; } @@ -21870,11 +22321,11 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256) { - if (modifier.kind === 108) { + if (modifier.kind === 110) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -21883,17 +22334,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 111: + case 113: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256) { @@ -21902,7 +22353,7 @@ var ts; flags |= 128; lastStatic = modifier; break; - case 80: + case 82: if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -21915,42 +22366,42 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; - case 120: + case 122: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; lastDeclare = modifier; break; - case 113: + case 115: if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 212) { - if (node.kind !== 141) { + if (node.kind !== 214) { + if (node.kind !== 143) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 212 && node.parent.flags & 256)) { + if (!(node.parent.kind === 214 && node.parent.flags & 256)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128) { @@ -21962,14 +22413,14 @@ var ts; } flags |= 256; break; - case 116: + case 118: if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512; @@ -21977,7 +22428,7 @@ var ts; break; } } - if (node.kind === 142) { + if (node.kind === 144) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21995,10 +22446,10 @@ var ts; } return; } - else if ((node.kind === 220 || node.kind === 219) && flags & 2) { + else if ((node.kind === 222 || node.kind === 221) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 136 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512) { @@ -22010,10 +22461,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 141: - case 211: - case 171: - case 172: + case 143: + case 213: + case 173: + case 174: if (!node.asteriskToken) { return false; } @@ -22078,7 +22529,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 172) { + if (node.kind === 174) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -22113,7 +22564,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 128 && parameter.type.kind !== 126) { + if (parameter.type.kind !== 130 && parameter.type.kind !== 128) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -22145,7 +22596,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 185) { + if (arg.kind === 187) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -22172,7 +22623,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -22185,7 +22636,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -22200,14 +22651,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -22216,19 +22667,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 134) { + if (node.kind !== 136) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 179 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 181 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 211 || - node.kind === 171 || - node.kind === 141); + ts.Debug.assert(node.kind === 213 || + node.kind === 173 || + node.kind === 143); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -22245,7 +22696,7 @@ var ts; return grammarErrorOnNode(questionToken, message); } } - function checkGrammarObjectLiteralExpression(node) { + function checkGrammarObjectLiteralExpression(node, inDestructuring) { var seen = {}; var Property = 1; var GetAccessor = 2; @@ -22254,26 +22705,29 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_17 = prop.name; - if (prop.kind === 185 || - name_17.kind === 134) { + if (prop.kind === 187 || + name_17.kind === 136) { checkGrammarComputedPropertyName(name_17); continue; } + if (prop.kind === 246 && !inDestructuring && prop.objectAssignmentInitializer) { + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + } var currentKind = void 0; - if (prop.kind === 243 || prop.kind === 244) { + if (prop.kind === 245 || prop.kind === 246) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_17.kind === 8) { checkGrammarNumericLiteral(name_17); } currentKind = Property; } - else if (prop.kind === 141) { + else if (prop.kind === 143) { currentKind = Property; } - else if (prop.kind === 143) { + else if (prop.kind === 145) { currentKind = GetAccessor; } - else if (prop.kind === 144) { + else if (prop.kind === 146) { currentKind = SetAccesor; } else { @@ -22305,7 +22759,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 237) { + if (attr.kind === 239) { continue; } var jsxAttr = attr; @@ -22317,7 +22771,7 @@ var ts; return grammarErrorOnNode(name_18, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 238 && !initializer.expression) { + if (initializer && initializer.kind === 240 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -22326,24 +22780,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 210) { + if (forInOrOfStatement.initializer.kind === 212) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -22366,10 +22820,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 143 && accessor.parameters.length) { + else if (kind === 145 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 144) { + else if (kind === 146) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -22394,7 +22848,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 134 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 136 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -22404,7 +22858,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 163) { + if (node.parent.kind === 165) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22423,22 +22877,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 199: + case 200: + case 201: case 197: case 198: - case 199: - case 195: - case 196: return true; - case 205: + case 207: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -22450,9 +22904,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 205: + case 207: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 200 + var isMisplacedContinueLabel = node.kind === 202 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -22460,8 +22914,8 @@ var ts; return false; } break; - case 204: - if (node.kind === 201 && !node.label) { + case 206: + if (node.kind === 203 && !node.label) { return false; } break; @@ -22474,13 +22928,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -22492,7 +22946,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 160 || node.name.kind === 159) { + if (node.name.kind === 162 || node.name.kind === 161) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22501,7 +22955,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 198 && node.parent.parent.kind !== 199) { + if (node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -22521,7 +22975,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 67) { + if (name.kind === 69) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -22530,7 +22984,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22547,15 +23001,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 194: - case 195: case 196: - case 203: case 197: case 198: - case 199: - return false; case 205: + case 199: + case 200: + case 201: + return false; + case 207: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22571,7 +23025,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 177) { + if (expression.kind === 179) { var unaryExpression = expression; if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { expression = unaryExpression.operand; @@ -22582,32 +23036,6 @@ var ts; } return false; } - function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 32768) !== 0; - var hasError = false; - if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { - var node = _a[_i]; - if (node.name.kind === 134) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); - } - else if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer)) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; - } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; - } - } - } - return hasError; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -22633,7 +23061,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -22653,12 +23081,12 @@ var ts; return true; } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22668,11 +23096,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 213 || - node.kind === 220 || - node.kind === 219 || - node.kind === 226 || - node.kind === 225 || + if (node.kind === 215 || + node.kind === 222 || + node.kind === 221 || + node.kind === 228 || + node.kind === 227 || (node.flags & 2) || (node.flags & (1 | 1024))) { return false; @@ -22682,7 +23110,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 191) { + if (ts.isDeclaration(decl) || decl.kind === 193) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22701,7 +23129,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 190 || node.parent.kind === 217 || node.parent.kind === 246) { + if (node.parent.kind === 192 || node.parent.kind === 219 || node.parent.kind === 248) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -22748,6 +23176,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; + var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; @@ -22773,7 +23202,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 220); + ts.Debug.assert(aliasEmitInfo.node.kind === 222); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22824,6 +23253,7 @@ var ts; function createAndSetNewTextWriterWithSymbolWriter() { var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -22846,10 +23276,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 209) { + if (declaration.kind === 211) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 223 || declaration.kind === 224 || declaration.kind === 221) { + else if (declaration.kind === 225 || declaration.kind === 226 || declaration.kind === 223) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22860,7 +23290,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 220) { + if (moduleElementEmitInfo.node.kind === 222) { moduleElementEmitInfo.isVisible = true; } else { @@ -22868,12 +23298,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22905,6 +23335,11 @@ var ts; function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); } + function reportInaccessibleThisError() { + if (errorNameNode) { + diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); @@ -22912,7 +23347,9 @@ var ts; emitType(type); } else { + errorNameNode = declaration.name; resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -22922,7 +23359,9 @@ var ts; emitType(signature.type); } else { + errorNameNode = signature.name; resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function emitLines(nodes) { @@ -22960,62 +23399,63 @@ var ts; } function emitType(type) { switch (type.kind) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: + case 97: case 9: return writeTextOfNode(currentSourceFile, type); - case 186: + case 188: return emitExpressionWithTypeArguments(type); - case 149: - return emitTypeReference(type); - case 152: - return emitTypeQuery(type); - case 154: - return emitArrayType(type); - case 155: - return emitTupleType(type); - case 156: - return emitUnionType(type); - case 157: - return emitIntersectionType(type); - case 158: - return emitParenType(type); - case 150: case 151: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 154: + return emitTypeQuery(type); + case 156: + return emitArrayType(type); + case 157: + return emitTupleType(type); + case 158: + return emitUnionType(type); + case 159: + return emitIntersectionType(type); + case 160: + return emitParenType(type); + case 152: case 153: + return emitSignatureDeclarationWithJsDocComments(type); + case 155: return emitTypeLiteral(type); - case 67: + case 69: return emitEntityName(type); - case 133: + case 135: return emitEntityName(type); - case 148: + case 150: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 67) { + if (entityName.kind === 69) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 133 ? entityName.left : entityName.expression; - var right = entityName.kind === 133 ? entityName.right : entityName.name; + var left = entityName.kind === 135 ? entityName.left : entityName.expression; + var right = entityName.kind === 135 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 219 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 221 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 67 || node.expression.kind === 164); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 166); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -23091,7 +23531,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -23109,7 +23549,7 @@ var ts; } write(";"); writeLine(); - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { var nodes = resolver.collectLinkedAliases(node.expression); writeAsynchronousModuleElements(nodes); } @@ -23127,10 +23567,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 219 || - (node.parent.kind === 246 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 221 || + (node.parent.kind === 248 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -23139,7 +23579,7 @@ var ts; }); } else { - if (node.kind === 220) { + if (node.kind === 222) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -23157,23 +23597,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 211: - return writeFunctionDeclaration(node); - case 191: - return writeVariableStatement(node); case 213: - return writeInterfaceDeclaration(node); - case 212: - return writeClassDeclaration(node); - case 214: - return writeTypeAliasDeclaration(node); + return writeFunctionDeclaration(node); + case 193: + return writeVariableStatement(node); case 215: - return writeEnumDeclaration(node); + return writeInterfaceDeclaration(node); + case 214: + return writeClassDeclaration(node); case 216: + return writeTypeAliasDeclaration(node); + case 217: + return writeEnumDeclaration(node); + case 218: return writeModuleDeclaration(node); - case 219: + case 221: return writeImportEqualsDeclaration(node); - case 220: + case 222: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -23187,7 +23627,7 @@ var ts; if (node.flags & 1024) { write("default "); } - else if (node.kind !== 213) { + else if (node.kind !== 215) { write("declare "); } } @@ -23234,7 +23674,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 222) { + if (namedBindings.kind === 224) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -23260,7 +23700,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 222) { + if (node.importClause.namedBindings.kind === 224) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -23316,7 +23756,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 217) { + while (node.body.kind !== 219) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -23381,7 +23821,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 141 && (node.parent.flags & 32); + return node.parent.kind === 143 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23391,15 +23831,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - (node.parent.parent && node.parent.parent.kind === 153)) { - ts.Debug.assert(node.parent.kind === 141 || - node.parent.kind === 140 || - node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.kind === 145 || - node.parent.kind === 146); + if (node.parent.kind === 152 || + node.parent.kind === 153 || + (node.parent.parent && node.parent.parent.kind === 155)) { + ts.Debug.assert(node.parent.kind === 143 || + node.parent.kind === 142 || + node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.kind === 147 || + node.parent.kind === 148); emitType(node.constraint); } else { @@ -23409,31 +23849,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 212: + case 214: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 213: + case 215: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 146: + case 148: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145: + case 147: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 211: + case 213: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23461,12 +23901,12 @@ var ts; if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - else if (!isImplementsList && node.expression.kind === 91) { + else if (!isImplementsList && node.expression.kind === 93) { write("null"); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -23546,16 +23986,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 209 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 211 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 139 || node.kind === 138) && ts.hasQuestionToken(node)) { + if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 139 || node.kind === 138) && node.parent.kind === 153) { + if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -23564,14 +24004,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 209) { + if (node.kind === 211) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 139 || node.kind === 138) { + else if (node.kind === 141 || node.kind === 140) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23579,7 +24019,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23605,7 +24045,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { elements.push(element); } } @@ -23671,7 +24111,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 143 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 145 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23684,7 +24124,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 143 + return accessor.kind === 145 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -23693,7 +24133,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 144) { + if (accessorWithTypeAnnotation.kind === 146) { if (accessorWithTypeAnnotation.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -23739,17 +24179,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 211) { + if (node.kind === 213) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 141) { + else if (node.kind === 143) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 211) { + if (node.kind === 213) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 142) { + else if (node.kind === 144) { write("constructor"); } else { @@ -23766,11 +24206,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 146 || node.kind === 151) { + if (node.kind === 148 || node.kind === 153) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 147) { + if (node.kind === 149) { write("["); } else { @@ -23779,20 +24219,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 147) { + if (node.kind === 149) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 150 || node.kind === 151; - if (isFunctionTypeOrConstructorType || node.parent.kind === 153) { + var isFunctionTypeOrConstructorType = node.kind === 152 || node.kind === 153; + if (isFunctionTypeOrConstructorType || node.parent.kind === 155) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 142 && !(node.flags & 32)) { + else if (node.kind !== 144 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23803,23 +24243,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 146: + case 148: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 145: + case 147: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147: + case 149: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 141: - case 140: + case 143: + case 142: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23827,7 +24267,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23840,7 +24280,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 211: + case 213: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23872,9 +24312,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.parent.kind === 153) { + if (node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23890,22 +24330,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 142: + case 144: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 146: + case 148: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 145: + case 147: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23913,7 +24353,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23925,7 +24365,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 211: + case 213: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23936,12 +24376,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 159) { + if (bindingPattern.kind === 161) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 160) { + else if (bindingPattern.kind === 162) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23960,10 +24400,10 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 185) { + if (bindingElement.kind === 187) { write(" "); } - else if (bindingElement.kind === 161) { + else if (bindingElement.kind === 163) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); @@ -23973,7 +24413,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 67); + ts.Debug.assert(bindingElement.name.kind === 69); if (bindingElement.dotDotDotToken) { write("..."); } @@ -23985,39 +24425,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 211: - case 216: - case 219: case 213: - case 212: - case 214: + case 218: + case 221: case 215: + case 214: + case 216: + case 217: return emitModuleElement(node, isModuleElementVisible(node)); - case 191: + case 193: return emitModuleElement(node, isVariableStatementVisible(node)); - case 220: + case 222: return emitModuleElement(node, !node.importClause); - case 226: + case 228: return emitExportDeclaration(node); + case 144: + case 143: case 142: + return writeFunctionDeclaration(node); + case 148: + case 147: + case 149: + return emitSignatureDeclarationWithJsDocComments(node); + case 145: + case 146: + return emitAccessorDeclaration(node); case 141: case 140: - return writeFunctionDeclaration(node); - case 146: - case 145: - case 147: - return emitSignatureDeclarationWithJsDocComments(node); - case 143: - case 144: - return emitAccessorDeclaration(node); - case 139: - case 138: return emitPropertyDeclaration(node); - case 245: + case 247: return emitEnumMemberDeclaration(node); - case 225: + case 227: return emitExportAssignment(node); - case 246: + case 248: return emitSourceFile(node); } } @@ -24060,5471 +24500,6 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; - function emitFiles(resolver, host, targetSourceFile) { - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; - var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; - if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - else { - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); - return { - emitSkipped: false, - diagnostics: diagnostics, - sourceMaps: sourceMapDataList - }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { - return false; - } - } - } - return true; - } - function emitJavaScript(jsFilePath, root) { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var currentSourceFile; - var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; - var computedPropertyNamesToGeneratedNames; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStars; - var writeEmittedFiles = writeJavaScriptFile; - var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - var emit = emitNodeWithCommentsAndWithoutSourcemap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; - var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; - var sourceMapData; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); - return; - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - emit(sourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_20 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_20)) { - tempFlags |= flags; - return name_20; - } - } - while (true) { - var count = tempFlags & 268435455; - tempFlags++; - if (count !== 8 && count !== 13) { - var name_21 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_21)) { - return name_21; - } - } - } - } - function makeUniqueName(baseName) { - if (baseName.charCodeAt(baseName.length - 1) !== 95) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 67: - return makeUniqueName(node.text); - case 216: - case 215: - return generateNameForModuleOrEnum(node); - case 220: - case 226: - return generateNameForImportOrExportDeclaration(node); - case 211: - case 212: - case 225: - return generateNameForExportDefault(); - case 184: - return generateNameForClassExpression(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - function initializeEmitterWithSourceMaps() { - var sourceMapDir; - var sourceMapSourceIndex = -1; - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; - } - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } - } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - var name_22 = node.name; - if (!name_22 || name_22.kind !== 134) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - recordScopeNameStart(scopeName); - } - else if (node.kind === 211 || - node.kind === 171 || - node.kind === 141 || - node.kind === 140 || - node.kind === 143 || - node.kind === 144 || - node.kind === 216 || - node.kind === 212 || - node.kind === 215) { - if (node.name) { - var name_23 = node.name; - scopeName = name_23.kind === 134 - ? ts.getTextOfNode(name_23) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_2 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_2.sourcesContent = sourcesContent; - } - return JSON.stringify(map_2); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); - } - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 246) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); - } - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(67); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - function emitTokenText(tokenKind, startPos, emitFn) { - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); - } - else { - write(tokenString); - } - return startPos + tokenString.length; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, false, false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); - } - if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - } - switch (node.kind) { - case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); - case 11: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - var isLast = node.kind === 11 || node.kind === 14; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); - }); - } - write("]"); - } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - if (node.template.kind === 181) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 179 - && templateSpan.expression.operatorToken.kind === 24; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); - } - function emitTemplateExpression(node) { - if (languageVersion >= 2) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 170 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; - if (i > 0 || headEmitted) { - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); - } - } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 166: - case 167: - return parent.expression === template; - case 168: - case 170: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1; - } - } - function comparePrecedenceToBinaryPlus(expression) { - switch (expression.kind) { - case 179: - switch (expression.operatorToken.kind) { - case 37: - case 38: - case 39: - return 1; - case 35: - case 36: - return 0; - default: - return -1; - } - case 182: - case 180: - return -1; - default: - return 1; - } - } - } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); - } - function jsxEmitReact(node) { - function emitTagName(name) { - if (name.kind === 67 && ts.isIntrinsicJsxName(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } - } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(67); - syntheticReactRef.text = 'React'; - syntheticReactRef.parent = openingNode; - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - if (openingNode.attributes.length === 0) { - write("null"); - } - else { - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); - var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 237) { - if (i_1 === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i_1 > 0) { - write(", "); - } - emit(attrs[i_1].expression); - } - else { - ts.Debug.assert(attrs[i_1].kind === 236); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i_1 > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i_1]); - } - } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); - } - else { - write("{"); - for (var i = 0; i < attrs.length; i++) { - if (i > 0) { - write(", "); - } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - if (children) { - for (var i = 0; i < children.length; i++) { - if (children[i].kind === 238 && !(children[i].expression)) { - continue; - } - if (children[i].kind === 234) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); - } - } - else { - write(", "); - emit(children[i]); - } - } - } - write(")"); - emitTrailingComments(openingNode); - } - if (node.kind === 231) { - emitJsxElement(node.openingElement, node.children); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxElement(node); - } - } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); - } - } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); - } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 237) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 236); - emitJsxAttribute(attribs[i]); - } - } - } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 232)) { - write(" "); - } - emitAttributes(node.attributes); - if (node.kind === 232) { - write("/>"); - } - else { - write(">"); - } - } - function emitJsxClosingElement(node) { - write(""); - } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 231) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxOpeningOrSelfClosingElement(node); - } - } - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 161); - if (node.kind === 9) { - emitLiteral(node); - } - else if (node.kind === 134) { - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write("\""); - if (node.kind === 8) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - write("\""); - } - } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 162: - case 179: - case 166: - case 239: - case 134: - case 180: - case 137: - case 173: - case 195: - case 165: - case 225: - case 193: - case 186: - case 197: - case 198: - case 199: - case 194: - case 232: - case 233: - case 237: - case 238: - case 167: - case 170: - case 178: - case 177: - case 202: - case 244: - case 183: - case 204: - case 168: - case 188: - case 206: - case 169: - case 174: - case 175: - case 196: - case 203: - case 182: - return true; - case 161: - case 245: - case 136: - case 243: - case 139: - case 209: - return parent.initializer === node; - case 164: - return parent.expression === node; - case 172: - case 171: - return parent.body === node; - case 219: - return parent.moduleReference === node; - case 133: - return parent.left === node; - } - return false; - } - function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048) { - write("_arguments"); - return; - } - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 246) { - if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - else { - write(getGeneratedNameForNode(container)); - write("."); - } - } - else if (languageVersion < 2) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 221) { - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); - return; - } - else if (declaration.kind === 224) { - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); - if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); - } - else { - write("."); - write(identifier); - } - return; - } - } - declaration = resolver.getReferencedNestedRedeclaration(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function isNameOfNestedRedeclaration(node) { - if (languageVersion < 2) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 161: - case 212: - case 215: - case 209: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); - } - } - return false; - } - function emitIdentifier(node) { - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - emitExpressionIdentifier(node); - } - else if (isNameOfNestedRedeclaration(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2) { - write("_this"); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { - write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write("]"); - } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); - } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); - } - function emitYieldExpression(node) { - write(ts.tokenToString(112)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } - } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(112)); - write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } - } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 179 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 180 && node.parent.condition === node) { - return true; - } - return false; - } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 67: - case 162: - case 164: - case 165: - case 166: - case 170: - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 183) { - e = e.expression; - emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 183) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 183; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); - write("]"); - } - else { - emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } - write("{"); - if (numElements > 0) { - var properties = node.properties; - if (numElements === properties.length) { - emitLinePreservingList(node, properties, languageVersion >= 1, true); - } - else { - var multiLine = (node.flags & 2048) !== 0; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, multiLine, false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - } - write("}"); - } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048) !== 0; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - var tempVar = createAndRecordTempVariable(0); - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 143 || property.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 243) { - emit(property.initializer); - } - else if (property.kind === 244) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 141) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2) { - var numProperties = properties.length; - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 134) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } - } - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(179, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(164); - result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(21); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(165); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - while (expr.kind === 169 || expr.kind === 187) { - expr = expr.expression; - } - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 167 && - expr.kind !== 8) { - return expr; - } - var node = ts.createSynthesizedNode(170); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - function isNamespaceExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 246; - } - function emitShorthandPropertyAssignment(node) { - writeTextOfNode(currentSourceFile, node.name); - if (languageVersion < 2 || isNamespaceExportReference(node.name)) { - write(": "); - emit(node.name); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 164 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 164 || node.kind === 165 - ? resolver.getConstantValue(node) - : undefined; - } - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - var shouldEmitSpace; - if (!indentedBeforeDot) { - if (node.expression.kind === 8) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; - } - else { - var constantValue = tryGetConstEnumValue(node.expression); - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 67) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 67: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 133: - emitQualifiedNameAsExpression(node, useFallback); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 183; }); - } - function skipParentheses(node) { - while (node.kind === 170 || node.kind === 169 || node.kind === 187) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 67 || node.kind === 95 || node.kind === 93) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 164) { - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 165) { - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 93) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 93) { - emitThis(target); - } - else { - emit(target); - } - } - else { - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, false, false, false, true); - write(")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var superCall = false; - if (node.expression.kind === 93) { - emitSuper(node.expression); - superCall = true; - } - else { - emit(node.expression); - superCall = node.expression.kind === 164 && node.expression.expression.kind === 93; - } - if (superCall && languageVersion < 2) { - write(".call("); - emitThis(node.expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - if (languageVersion === 1 && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, false, false, false, false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172) { - if (node.expression.kind === 169 || node.expression.kind === 187) { - var operand = node.expression.expression; - while (operand.kind === 169 || operand.kind === 187) { - operand = operand.expression; - } - if (operand.kind !== 177 && - operand.kind !== 175 && - operand.kind !== 174 && - operand.kind !== 173 && - operand.kind !== 178 && - operand.kind !== 167 && - !(operand.kind === 166 && node.parent.kind === 167) && - !(operand.kind === 171 && node.parent.kind === 166) && - !(operand.kind === 8 && node.parent.kind === 164)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(76)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(101)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(99)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 67 || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 || node.parent.kind === 161); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); - } - function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - write(ts.tokenToString(node.operator)); - if (node.operand.kind === 177) { - var operand = node.operand; - if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { - write(" "); - } - else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 41)) { - write(" "); - } - } - emit(node.operand); - if (exportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 40) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, false); - } - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = node; - while (current) { - if (current.kind === 246) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); - } - else if (ts.isFunctionLike(current) || current.kind === 217) { - return false; - } - else { - current = current.parent; - } - } - } - function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 55 && - (node.left.kind === 163 || node.left.kind === 162)) { - emitDestructuring(node, node.parent.kind === 193); - } - else { - var exportChanged = node.operatorToken.kind >= 55 && - node.operatorToken.kind <= 66 && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - if (exportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 190) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15, node.pos); - write(" "); - emitToken(16, node.statements.end); - return; - } - emitToken(15, node.pos); - increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 217) { - ts.Debug.assert(node.parent.kind === 216); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 217) { - emitTempDeclarations(true); - } - decreaseIndent(); - writeLine(); - emitToken(16, node.statements.end); - scopeEmitEnd(); - } - function emitEmbeddedStatement(node) { - if (node.kind === 190) { - write(" "); - emit(node); - } - else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); - } - } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 172); - write(";"); - } - function emitIfStatement(node) { - var endPos = emitToken(86, node.pos); - write(" "); - endPos = emitToken(17, endPos); - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(78, node.thenStatement.end); - if (node.elseStatement.kind === 194) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - write("do"); - emitEmbeddedStatement(node.statement); - if (node.statement.kind === 190) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); - write(");"); - } - function emitWhileStatement(node) { - write("while ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, true)) { - return false; - } - var tokenKind = 100; - if (decl && languageVersion >= 2) { - if (ts.isLet(decl)) { - tokenKind = 106; - } - else if (ts.isConst(decl)) { - tokenKind = 72; - } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); - } - else { - switch (tokenKind) { - case 100: - write("var "); - break; - case 106: - write("let "); - break; - case 72: - write("const "); - break; - } - } - return true; - } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { - write(", "); - } - emit(decl); - } - return started; - } - function emitForStatement(node) { - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 199) { - return emitDownLevelForOfStatement(node); - } - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 198) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.statement); - } - function emitDownLevelForOfStatement(node) { - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - var rhsIsIdentifier = node.expression.kind === 67; - var counter = createTempVariable(268435456); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - emitStart(node.expression); - write("var "); - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - if (!rhsIsIdentifier) { - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.initializer); - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.initializer); - emitToken(18, node.expression.end); - write(" {"); - writeLine(); - increaseIndent(); - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 210) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - emitDestructuring(declaration, false, rhsIterationValue); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - emitNodeWithoutSourceMap(createTempVariable(0)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - var assignmentExpression = createBinaryExpression(node.initializer, 55, rhsIterationValue, false); - if (node.initializer.kind === 162 || node.initializer.kind === 163) { - emitDestructuring(assignmentExpression, true, undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (node.statement.kind === 190) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - writeLine(); - decreaseIndent(); - write("}"); - } - function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 201 ? 68 : 73, node.pos); - emitOptional(" ", node.label); - write(";"); - } - function emitReturnStatement(node) { - emitToken(92, node.pos); - emitOptional(" ", node.expression); - write(";"); - } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitSwitchStatement(node) { - var endPos = emitToken(94, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.expression); - endPos = emitToken(18, node.expression.end); - write(" "); - emitCaseBlock(node.caseBlock, endPos); - } - function emitCaseBlock(node, startPos) { - emitToken(15, startPos); - increaseIndent(); - emitLines(node.clauses); - decreaseIndent(); - writeLine(); - emitToken(16, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 239) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(70, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.variableDeclaration); - emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(74, node.pos); - write(";"); - } - function emitLabelledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 216); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8); - zero.text = "0"; - var result = ts.createSynthesizedNode(175); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 246) { - ts.Debug.assert(!!(node.flags & 1024) || node.kind === 225); - if (compilerOptions.module === 1 || compilerOptions.module === 2 || compilerOptions.module === 3) { - if (!currentSourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 1) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); - writeLine(); - } - else if (languageVersion === 0) { - write("exports.__esModule = true;"); - writeLine(); - } - } - } - } - } - function emitExportMemberAssignment(node) { - if (node.flags & 1) { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4 && node.parent === currentSourceFile) { - write(exportFunctionForFile + "(\""); - if (node.flags & 1024) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 1024) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0) { - write("exports[\"default\"]"); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } - } - function emitExportMemberAssignments(name) { - if (compilerOptions.module === 4) { - return; - } - if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } - } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(compilerOptions.module === 4); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; - } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - var canDefineTempVariablesInPlace = false; - if (root.kind === 209) { - var isExported = ts.getCombinedNodeFlags(root) & 1; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 136) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 179) { - emitAssignmentExpression(root); - } - else { - ts.Debug.assert(!isAssignmentExpressionStatement); - emitBindingElement(root, value); - } - function emitAssignment(name, value) { - if (emitCount++) { - write(", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 || name.parent.kind === 161); - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - if (exportChanged) { - write(")"); - } - } - function ensureIdentifier(expr, reuseIdentifierExpressions) { - if (expr.kind === 67 && reuseIdentifierExpressions) { - return expr; - } - var identifier = createTempVariable(0); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - return identifier; - } - function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value, true); - var equals = ts.createSynthesizedNode(179); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(180); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(52); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(53); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 67) { - return createElementAccessExpression(object, syntheticName); - } - return createPropertyAccessExpression(object, syntheticName); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(166); - var sliceIdentifier = ts.createSynthesizedNode(67); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; - if (p.kind === 243 || p.kind === 244) { - var propName = p.name; - emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); - } - } - } - function emitArrayLiteralAssignment(target, value) { - var elements = target.elements; - if (elements.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); - } - } - } - } - function emitDestructuringAssignment(target, value) { - if (target.kind === 179 && target.operatorToken.kind === 55) { - value = createDefaultValueCheck(value, target.right); - target = target.left; - } - if (target.kind === 163) { - emitObjectLiteralAssignment(target, value); - } - else if (target.kind === 162) { - emitArrayLiteralAssignment(target, value); - } - else { - emitAssignment(target, value); - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { - if (root.parent.kind !== 170) { - write("("); - } - value = ensureIdentifier(value, true); - emitDestructuringAssignment(target, value); - write(", "); - emit(value); - if (root.parent.kind !== 170) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - if (target.initializer) { - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; - } - else if (!value) { - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 159) { - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 185) { - if (!element.dotDotDotToken) { - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value); - } - } - } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - else { - var initializer = node.initializer; - if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 16384); - if (isUninitializedLet && - node.parent.parent.kind !== 198 && - node.parent.parent.kind !== 199) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 185) { - return; - } - var name = node.name; - if (name.kind === 67) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 209 && node.parent.kind !== 161)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && - languageVersion >= 2 && - node.parent.kind === 246; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1) { - if (isES6ExportedDeclaration(node)) { - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 1)) { - return true; - } - if (isES6ExportedDeclaration(node)) { - return true; - } - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2) { - if (ts.isBindingPattern(node.name)) { - var name_24 = createTempVariable(0); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_24); - emit(name_24); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2) { - var tempIndex = 0; - ts.forEach(node.parameters, function (parameter) { - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); - } - else { - emit(tempParameters[tempIndex]); - write(" = "); - emit(initializer); - } - write(";"); - tempIndex++; - } - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); - } - }); - } - } - function emitRestParameter(node) { - if (languageVersion < 2 && ts.hasRestParameter(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - if (ts.isBindingPattern(restParam.name)) { - return; - } - var tempName = createTempVariable(268435456).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitAccessor(node) { - write(node.kind === 143 ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); - } - function shouldEmitAsArrowFunction(node) { - return node.kind === 172 && languageVersion >= 2; - } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 171) { - return !!node.name; - } - if (node.kind === 211) { - return !!node.name || languageVersion < 2; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitCommentsOnNotEmittedNode(node); - } - if (node.kind !== 141 && node.kind !== 140 && - node.parent && node.parent.kind !== 243 && - node.parent.kind !== 166) { - emitLeadingComments(node); - } - emitStart(node); - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - write("function"); - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 211 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (node.kind !== 141 && node.kind !== 140) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 172; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; - var args; - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments"); - } - else { - write(", void 0"); - } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); - } - else { - write(", Promise"); - } - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } - emitFunctionBody(node); - write(")"); - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitFunctionBody(node) { - if (!node.body) { - write(" { }"); - } - else { - if (node.body.kind === 190) { - emitBlockFunctionBody(node, node.body); - } - else { - emitExpressionFunctionBody(node, node.body); - } - } - } - function emitSignatureAndBody(node) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 || node.flags & 512) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - write(" "); - var current = body; - while (current.kind === 169) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 163); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedComments(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - scopeEmitEnd(); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedComments(body.statements); - var startIndex = emitDirectivePrologues(body.statements, true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16, body.statements.end); - scopeEmitEnd(); - } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 193) { - var expr = statement.expression; - if (expr && expr.kind === 166) { - var func = expr.expression; - if (func && func.kind === 93) { - return statement; - } - } - } - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 112) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 9 || memberName.kind === 8) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 134) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 139 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { - properties.push(member); - } - } - return properties; - } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; - emitPropertyDeclaration(node, property); - } - } - function emitPropertyDeclaration(node, property, receiver, isExpression) { - writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - emit(receiver); - } - else { - if (property.flags & 128) { - emitDeclarationName(node); - } - else { - write("this"); - } - } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 189) { - writeLine(); - write(";"); - } - else if (member.kind === 141 || node.kind === 140) { - if (!member.body) { - return emitCommentsOnNotEmittedNode(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 143 || member.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 141 || node.kind === 140) && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - else if (member.kind === 141 || - member.kind === 143 || - member.kind === 144) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 128) { - write("static "); - } - if (member.kind === 143) { - write("get "); - } - else if (member.kind === 144) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 189) { - writeLine(); - write(";"); - } - } - } - function emitConstructor(node, baseTypeElement) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitConstructorWorker(node, baseTypeElement) { - var hasInstancePropertyWithInitializer = false; - ts.forEach(node.members, function (member) { - if (member.kind === 142 && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { - return; - } - if (ctor) { - emitLeadingComments(ctor); - } - emitStart(ctor || node); - if (languageVersion < 2) { - write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); - } - else { - write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - if (baseTypeElement) { - write("(...args)"); - } - else { - write("()"); - } - } - } - var startIndex = 0; - write(" {"); - scopeEmitStart(node, "constructor"); - increaseIndent(); - if (ctor) { - startIndex = emitDirectivePrologues(ctor.body.statements, true); - emitDetachedComments(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); - } - else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2) { - write("_super.apply(this, arguments);"); - } - else { - write("super(...args);"); - } - emitEnd(baseTypeElement); - } - } - emitPropertyDeclarations(node, getInitializedProperties(node, false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } - } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); - } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2) { - emitClassLikeDeclarationBelowES6(node); - } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 212) { - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - } - var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184; - var tempVariable; - if (isClassExpressionWithStaticProperties) { - tempVariable = createAndRecordTempVariable(0); - write("("); - increaseIndent(); - emit(tempVariable); - write(" = "); - } - write("class"); - if ((node.name || !(node.flags & 1024)) && !thisNodeIsDecorated) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - scopeEmitStart(node); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - if (thisNodeIsDecorated) { - write(";"); - } - if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, tempVariable, true); - } - write(","); - writeLine(); - emit(tempVariable); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); - } - if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 212) { - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - scopeEmitStart(node); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, true)); - writeLine(); - emitDecoratorsOfClass(node); - writeLine(); - emitToken(16, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(true); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - emitStart(node); - write(")("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write(")"); - if (node.kind === 212) { - write(";"); - } - emitEnd(node); - if (node.kind === 212) { - emitExportMemberAssignment(node); - } - if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 128)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 128); - emitDecoratorsOfConstructor(node); - } - function emitDecoratorsOfConstructor(node) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - if (!decorators && !hasDecoratedParameters) { - return; - } - writeLine(); - emitStart(node); - emitDeclarationName(node); - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); - emitSerializedTypeMetadata(node, argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(");"); - emitEnd(node); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.flags & 128) !== staticFlag) { - continue; - } - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - if (member.kind === 141) { - functionLikeMember = member; - } - } - writeLine(); - emitStart(member); - if (member.kind !== 139) { - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(","); - increaseIndent(); - writeLine(); - } - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - if (member.kind !== 139) { - write(", Object.getOwnPropertyDescriptor("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write("))"); - decreaseIndent(); - } - write(");"); - emitEnd(member); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); - emit(decorator.expression); - write(")"); - emitEnd(decorator); - }); - leadingComma = true; - } - ++parameterIndex; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - switch (node.kind) { - case 141: - case 143: - case 144: - case 139: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - switch (node.kind) { - case 141: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - switch (node.kind) { - case 212: - case 141: - case 144: - return true; - } - return false; - } - function emitSerializedTypeOfNode(node) { - switch (node.kind) { - case 212: - write("Function"); - return; - case 139: - emitSerializedTypeNode(node.type); - return; - case 136: - emitSerializedTypeNode(node.type); - return; - case 143: - emitSerializedTypeNode(node.type); - return; - case 144: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 101: - write("void 0"); - return; - case 158: - emitSerializedTypeNode(node.type); - return; - case 150: - case 151: - write("Function"); - return; - case 154: - case 155: - write("Array"); - return; - case 148: - case 118: - write("Boolean"); - return; - case 128: - case 9: - write("String"); - return; - case 126: - write("Number"); - return; - case 129: - write("Symbol"); - return; - case 149: - emitSerializedTypeReferenceNode(node); - return; - case 152: - case 153: - case 156: - case 157: - case 115: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - function emitSerializedParameterTypesOfNode(node) { - if (node) { - var valueDeclaration; - if (node.kind === 212) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; - if (parameterCount > 0) { - for (var i = 0; i < parameterCount; i++) { - if (i > 0) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType.kind === 154) { - parameterType = parameterType.elementType; - } - else if (parameterType.kind === 149 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node) && node.type) { - emitSerializedTypeNode(node.type); - return; - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitCommentsOnNotEmittedNode(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - scopeEmitStart(node); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 216) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); - } - function emitModuleDeclaration(node) { - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitCommentsOnNotEmittedNode(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - if (node.body.kind === 217) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - scopeEmitStart(node); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16, moduleBlock.statements.end); - scopeEmitEnd(); - } - write(")("); - if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 67 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 219) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 220 && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (languageVersion < 2) { - return emitExternalImportDeclaration(node); - } - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 222) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 219 && (node.flags & 1) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (compilerOptions.module !== 2) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - if (!isExportedImport) - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - var isNakedImport = 220 && !node.importClause; - if (!isNakedImport) { - write("var "); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - var variableDeclarationIsHoisted = shouldHoistVariable(node, true); - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(compilerOptions.module !== 4); - if (languageVersion < 2) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - if (compilerOptions.module !== 2) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - writeLine(); - write("__export("); - if (compilerOptions.module !== 2) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(languageVersion >= 2); - var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= 2) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 211 && - expression.kind !== 212) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0) { - write("[\"default\"] = "); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = {}; - exportEquals = undefined; - hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 220: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { - externalImports.push(node); - } - break; - case 219: - if (node.moduleReference.kind === 230 && resolver.isReferencedAliasDeclaration(node)) { - externalImports.push(node); - } - break; - case 226: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStars = true; - } - else if (resolver.isValueAliasDeclaration(node)) { - externalImports.push(node); - } - } - else { - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_25 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_25] || (exportSpecifiers[name_25] = [])).push(specifier); - } - } - break; - case 225: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStars) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - if (node.kind === 220 && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 226 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; - var skipNode = importNode.kind === 226 || - (importNode.kind === 220 && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - if (!hasExportStars) { - return undefined; - } - if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { - var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; - if (externalImport.kind === 226 && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - return emitExportStarFunction(undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - writeExportedName(specifier.name); - } - } - } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; - if (externalImport.kind !== 226) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - if (node.kind !== 67 && node.flags & 1024) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 67) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { - var local = hoistedVars[i]; - var name_26 = local.kind === 67 - ? local - : local.name; - if (name_26) { - var text = ts.unescapeIdentifier(name_26.text); - if (ts.hasProperty(seen, text)) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 212 || local.kind === 216 || local.kind === 215) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 67 ? local.parent : local); - if (flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; - writeLine(); - emit(f); - if (f.flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2) { - return; - } - if (node.kind === 211) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 212) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 215) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 216) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 209 || node.kind === 161) { - if (shouldHoistVariable(node, false)) { - var name_27 = node.name; - if (name_27.kind === 67) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_27); - } - else { - ts.forEachChild(name_27, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - return (ts.getCombinedNodeFlags(node) & 49152) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 246; - } - function isCurrentFileSystemExternalModule() { - return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); - emitTempDeclarations(true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 220: - if (!entry.importClause) { - break; - } - case 219: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 226: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_2]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - writeLine(); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { - var statement = node.statements[i]; - switch (statement.kind) { - case 211: - case 220: - continue; - case 226: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 219: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - continue; - } - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); - } - function emitSystemModule(node, startIndex) { - collectExternalModuleInfo(node); - ts.Debug.assert(!exportFunctionForFile); - exportFunctionForFile = makeUniqueName("exports"); - writeLine(); - write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - write("["); - var groupIndices = {}; - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ") {"); - writeLine(); - increaseIndent(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitAMDDependencies(node, includeNonAmdDependencies) { - var aliasedModuleNames = []; - var unaliasedModuleNames = []; - var importAliasNames = []; - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); - } - } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; - var externalModuleName = getExternalModuleNameText(importNode); - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - write("[\"require\", \"exports\""); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } - write("], function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - } - function emitAMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, true); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(false); - } - function emitUMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); - emitAMDDependencies(node, false); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node, startIndex) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); - } - } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2: - jsxEmitReact(node); - break; - case 1: - default: - jsxEmitPreserve(node); - break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpace(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - if (result) { - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); - } - else { - return s; - } - }); - } - return result; - } - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1: - default: - return ts.getTextOfNode(node, true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2: - write("\""); - write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); - break; - case 1: - default: - writer.writeLiteral(ts.getTextOfNode(node, true)); - break; - } - } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2: - emit(node.expression); - break; - } - } - } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - return i; - } - } - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - writeLine(); - emitShebang(); - emitDetachedComments(node); - var startIndex = emitDirectivePrologues(node.statements, false); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= 2) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === 2) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === 4) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === 3) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } - } - else { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - emitLeadingComments(node.endOfFileToken); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2) { - return emitCommentsOnNotEmittedNode(node); - } - if (isSpecializedCommentHandling(node)) { - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - case 213: - case 211: - case 220: - case 219: - case 214: - case 225: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 191: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 216: - return shouldEmitModuleDeclaration(node); - case 215: - return shouldEmitEnumDeclaration(node); - } - ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 190 && - node.parent && - node.parent.kind === 172 && - node.parent.body === node && - compilerOptions.target <= 1) { - return false; - } - return true; - } - function emitJavaScriptWorker(node) { - switch (node.kind) { - case 67: - return emitIdentifier(node); - case 136: - return emitParameter(node); - case 141: - case 140: - return emitMethod(node); - case 143: - case 144: - return emitAccessor(node); - case 95: - return emitThis(node); - case 93: - return emitSuper(node); - case 91: - return write("null"); - case 97: - return write("true"); - case 82: - return write("false"); - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - return emitLiteral(node); - case 181: - return emitTemplateExpression(node); - case 188: - return emitTemplateSpan(node); - case 231: - case 232: - return emitJsxElement(node); - case 234: - return emitJsxText(node); - case 238: - return emitJsxExpression(node); - case 133: - return emitQualifiedName(node); - case 159: - return emitObjectBindingPattern(node); - case 160: - return emitArrayBindingPattern(node); - case 161: - return emitBindingElement(node); - case 162: - return emitArrayLiteral(node); - case 163: - return emitObjectLiteral(node); - case 243: - return emitPropertyAssignment(node); - case 244: - return emitShorthandPropertyAssignment(node); - case 134: - return emitComputedPropertyName(node); - case 164: - return emitPropertyAccess(node); - case 165: - return emitIndexedAccess(node); - case 166: - return emitCallExpression(node); - case 167: - return emitNewExpression(node); - case 168: - return emitTaggedTemplateExpression(node); - case 169: - return emit(node.expression); - case 187: - return emit(node.expression); - case 170: - return emitParenExpression(node); - case 211: - case 171: - case 172: - return emitFunctionDeclaration(node); - case 173: - return emitDeleteExpression(node); - case 174: - return emitTypeOfExpression(node); - case 175: - return emitVoidExpression(node); - case 176: - return emitAwaitExpression(node); - case 177: - return emitPrefixUnaryExpression(node); - case 178: - return emitPostfixUnaryExpression(node); - case 179: - return emitBinaryExpression(node); - case 180: - return emitConditionalExpression(node); - case 183: - return emitSpreadElementExpression(node); - case 182: - return emitYieldExpression(node); - case 185: - return; - case 190: - case 217: - return emitBlock(node); - case 191: - return emitVariableStatement(node); - case 192: - return write(";"); - case 193: - return emitExpressionStatement(node); - case 194: - return emitIfStatement(node); - case 195: - return emitDoStatement(node); - case 196: - return emitWhileStatement(node); - case 197: - return emitForStatement(node); - case 199: - case 198: - return emitForInOrForOfStatement(node); - case 200: - case 201: - return emitBreakOrContinueStatement(node); - case 202: - return emitReturnStatement(node); - case 203: - return emitWithStatement(node); - case 204: - return emitSwitchStatement(node); - case 239: - case 240: - return emitCaseOrDefaultClause(node); - case 205: - return emitLabelledStatement(node); - case 206: - return emitThrowStatement(node); - case 207: - return emitTryStatement(node); - case 242: - return emitCatchClause(node); - case 208: - return emitDebuggerStatement(node); - case 209: - return emitVariableDeclaration(node); - case 184: - return emitClassExpression(node); - case 212: - return emitClassDeclaration(node); - case 213: - return emitInterfaceDeclaration(node); - case 215: - return emitEnumDeclaration(node); - case 245: - return emitEnumMember(node); - case 216: - return emitModuleDeclaration(node); - case 220: - return emitImportDeclaration(node); - case 219: - return emitImportEqualsDeclaration(node); - case 226: - return emitExportDeclaration(node); - case 225: - return emitExportAssignment(node); - case 246: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } - function isTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; - } - function getLeadingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - return getLeadingCommentsWithoutDetachedComments(); - } - else { - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - } - } - } - function getTrailingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - } - } - } - function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, false); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, true); - } - function emitLeadingCommentsWorker(node, isEmittedNode) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (isEmittedNode) { - leadingComments = getLeadingCommentsToEmit(node); - } - else { - if (node.pos === 0) { - leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); - } - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitTrailingComments(node) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = getTrailingCommentsToEmit(node); - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); - } - function emitTrailingCommentsOfPosition(pos) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); - } - function emitLeadingCommentsOfPositionWorker(pos) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (hasDetachedComments(pos)) { - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); - } - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - } - } - function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); - if (shebang) { - write(shebang); - } - } - } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); - } - } - } - ts.emitFiles = emitFiles; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -29780,6 +24755,5552 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }; + function emitFiles(resolver, host, targetSourceFile) { + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + var jsxDesugaring = host.getCompilerOptions().jsx !== 1; + var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + else { + if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + return false; + } + } + } + return true; + } + function emitJavaScript(jsFilePath, root) { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var exportFunctionForFile; + var generatedNameSet = {}; + var nodeToGeneratedName = []; + var computedPropertyNamesToGeneratedNames; + var extendsEmitted = false; + var decorateEmitted = false; + var paramEmitted = false; + var awaiterEmitted = false; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStars; + var writeEmittedFiles = writeJavaScriptFile; + var detachedCommentsInfo; + var writeComment = ts.writeCommentRange; + var emit = emitNodeWithCommentsAndWithoutSourcemap; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; + var sourceMapData; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var moduleEmitDelegates = (_a = {}, + _a[5] = emitES6Module, + _a[2] = emitAMDModule, + _a[4] = emitSystemModule, + _a[3] = emitUMDModule, + _a[1] = emitCommonJSModule, + _a + ); + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emitSourceFile(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + emit(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_20 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_20)) { + tempFlags |= flags; + return name_20; + } + } + while (true) { + var count = tempFlags & 268435455; + tempFlags++; + if (count !== 8 && count !== 13) { + var name_21 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_21)) { + return name_21; + } + } + } + } + function makeUniqueName(baseName) { + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69: + return makeUniqueName(node.text); + case 218: + case 217: + return generateNameForModuleOrEnum(node); + case 222: + case 228: + return generateNameForImportOrExportDeclaration(node); + case 213: + case 214: + case 227: + return generateNameForExportDefault(); + case 186: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + var name_22 = node.name; + if (!name_22 || name_22.kind !== 136) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + recordScopeNameStart(scopeName); + } + else if (node.kind === 213 || + node.kind === 173 || + node.kind === 143 || + node.kind === 142 || + node.kind === 145 || + node.kind === 146 || + node.kind === 218 || + node.kind === 214 || + node.kind === 217) { + if (node.name) { + var name_23 = node.name; + scopeName = name_23.kind === 136 + ? ts.getTextOfNode(name_23) + : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { + if (typeof JSON !== "undefined") { + var map_2 = { + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }; + if (sourcesContent !== undefined) { + map_2.sourcesContent = sourcesContent; + } + return JSON.stringify(map_2); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); + sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithSourceMap(node) { + if (node) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind !== 248) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMap(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNodeWithoutSourceMap(node); + } + } + } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithCommentsAndWithSourcemap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, false, false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98: + case 66: + case 111: + case 79: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText("\"", node.text, "\""); + } + if (node.parent) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + switch (node.kind) { + case 9: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var isLast = node.kind === 11 || node.kind === 14; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + if (node.template.kind === 183) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 181 + && templateSpan.expression.operatorToken.kind === 24; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + if (languageVersion >= 2) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 172 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 168: + case 169: + return parent.expression === template; + case 170: + case 172: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 181: + switch (expression.operatorToken.kind) { + case 37: + case 39: + case 40: + return 1; + case 35: + case 36: + return 0; + default: + return -1; + } + case 184: + case 182: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + function emitTagName(name) { + if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitAttributeName(name) { + if (/[A-Za-z_]+[\w*]/.test(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69); + syntheticReactRef.text = "React"; + syntheticReactRef.parent = openingNode; + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + if (openingNode.attributes.length === 0) { + write("null"); + } + else { + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 239; })) { + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); + var haveOpenedObjectLiteral = false; + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 239) { + if (i_1 === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i_1 > 0) { + write(", "); + } + emit(attrs[i_1].expression); + } + else { + ts.Debug.assert(attrs[i_1].kind === 238); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i_1 > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i_1]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); + } + else { + write("{"); + for (var i = 0; i < attrs.length; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + if (children) { + for (var i = 0; i < children.length; i++) { + if (children[i].kind === 240 && !(children[i].expression)) { + continue; + } + if (children[i].kind === 236) { + var text = getTextToEmit(children[i]); + if (text !== undefined) { + write(", \""); + write(text); + write("\""); + } + } + else { + write(", "); + emit(children[i]); + } + } + } + write(")"); + emitTrailingComments(openingNode); + } + if (node.kind === 233) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 239) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 238); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 234)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 234) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 233) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxOpeningOrSelfClosingElement(node); + } + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 163); + if (node.kind === 9) { + emitLiteral(node); + } + else if (node.kind === 136) { + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write("\""); + if (node.kind === 8) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 164: + case 189: + case 181: + case 168: + case 241: + case 136: + case 182: + case 139: + case 175: + case 197: + case 167: + case 227: + case 195: + case 188: + case 199: + case 200: + case 201: + case 196: + case 234: + case 235: + case 239: + case 240: + case 169: + case 172: + case 180: + case 179: + case 204: + case 246: + case 185: + case 206: + case 170: + case 190: + case 208: + case 171: + case 176: + case 177: + case 198: + case 205: + case 184: + return true; + case 163: + case 247: + case 138: + case 245: + case 141: + case 211: + return parent.initializer === node; + case 166: + return parent.expression === node; + case 174: + case 173: + return parent.body === node; + case 221: + return parent.moduleReference === node; + case 135: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + if (resolver.getNodeCheckFlags(node) & 2048) { + write("_arguments"); + return; + } + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 248) { + if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + else { + write(getGeneratedNameForNode(container)); + write("."); + } + } + else if (modulekind !== 5) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 223) { + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 ? "[\"default\"]" : ".default"); + return; + } + else if (declaration.kind === 226) { + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_24 = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_24); + if (languageVersion === 0 && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } + return; + } + } + declaration = resolver.getReferencedNestedRedeclaration(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function isNameOfNestedRedeclaration(node) { + if (languageVersion < 2) { + var parent_6 = node.parent; + switch (parent_6.kind) { + case 163: + case 214: + case 217: + case 211: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + } + } + return false; + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedRedeclaration(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 181 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 182 && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69: + case 164: + case 166: + case 167: + case 168: + case 172: + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 185) { + e = e.expression; + emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 185) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 185; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + write("]"); + } + else { + emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + if (numElements === properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + else { + var multiLine = (node.flags & 2048) !== 0; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, multiLine, false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = (node.flags & 2048) !== 0; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + var tempVar = createAndRecordTempVariable(0); + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 145 || property.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 245) { + emit(property.initializer); + } + else if (property.kind === 246) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 143) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 136) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(181, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(166); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(167); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + while (expr.kind === 171 || expr.kind === 189) { + expr = expr.expression; + } + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 169 && + expr.kind !== 8) { + return expr; + } + var node = ts.createSynthesizedNode(172); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 248; + } + function emitShorthandPropertyAssignment(node) { + writeTextOfNode(currentSourceFile, node.name); + if (languageVersion < 2 || isNamespaceExportReference(node.name)) { + write(": "); + emit(node.name); + } + if (languageVersion >= 2 && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 166 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 166 || node.kind === 167 + ? resolver.getConstantValue(node) + : undefined; + } + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var shouldEmitSpace; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 135: + emitQualifiedNameAsExpression(node, useFallback); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 185; }); + } + function skipParentheses(node) { + while (node.kind === 172 || node.kind === 171 || node.kind === 189) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 || node.kind === 97 || node.kind === 95) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 166) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 167) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false, false, true); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 95) { + emitSuper(node.expression); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 166 && node.expression.expression.kind === 95; + } + if (superCall && languageVersion < 2) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + if (languageVersion === 1 && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, false, false, false, false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174) { + if (node.expression.kind === 171 || node.expression.kind === 189) { + var operand = node.expression.expression; + while (operand.kind === 171 || operand.kind === 189) { + operand = operand.expression; + } + if (operand.kind !== 179 && + operand.kind !== 177 && + operand.kind !== 176 && + operand.kind !== 175 && + operand.kind !== 180 && + operand.kind !== 169 && + !(operand.kind === 168 && node.parent.kind === 169) && + !(operand.kind === 173 && node.parent.kind === 168) && + !(operand.kind === 8 && node.parent.kind === 166)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 || node.parent.kind === 163); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 179) { + var operand = node.operand; + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { + write(" "); + } + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 248) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 219) { + return false; + } + else { + current = current.parent; + } + } + } + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60) { + var synthesizedLHS; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(167, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 && + leftHandSideExpression.argumentExpression.kind !== 9) { + var tempArgumentExpression = createAndRecordTempVariable(268435456); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(166, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 56 && + (node.left.kind === 165 || node.left.kind === 164)) { + emitDestructuring(node, node.parent.kind === 195); + } + else { + var exportChanged = node.operatorToken.kind >= 56 && + node.operatorToken.kind <= 68 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 || node.operatorToken.kind === 60) { + emitExponentiationOperator(node); + } + else { + emit(node.left); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 192) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15, node.pos); + write(" "); + emitToken(16, node.statements.end); + return; + } + emitToken(15, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 219) { + ts.Debug.assert(node.parent.kind === 218); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 219) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(16, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 192) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, node.expression.kind === 174); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88, node.pos); + write(" "); + endPos = emitToken(17, endPos); + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80, node.thenStatement.end); + if (node.elseStatement.kind === 196) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 192) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + return false; + } + var tokenKind = 102; + if (decl && languageVersion >= 2) { + if (ts.isLet(decl)) { + tokenKind = 108; + } + else if (ts.isConst(decl)) { + tokenKind = 74; + } + } + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + write(" "); + } + else { + switch (tokenKind) { + case 102: + write("var "); + break; + case 108: + write("let "); + break; + case 74: + write("const "); + break; + } + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function emitForStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 201) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 200) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + var rhsIsIdentifier = node.expression.kind === 69; + var counter = createTempVariable(268435456); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(18, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 212) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(0)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); + if (node.initializer.kind === 164 || node.initializer.kind === 165) { + emitDestructuring(assignmentExpression, true, undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 192) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 203 ? 70 : 75, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(94, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.expression); + endPos = emitToken(18, node.expression.end); + write(" "); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(15, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 241) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.variableDeclaration); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 218); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8); + zero.text = "0"; + var result = ts.createSynthesizedNode(177); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 248) { + ts.Debug.assert(!!(node.flags & 1024) || node.kind === 227); + if (modulekind === 1 || modulekind === 2 || modulekind === 3) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1) { + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1) { + writeLine(); + emitStart(node); + if (modulekind === 4 && node.parent === currentSourceFile) { + write(exportFunctionForFile + "(\""); + if (node.flags & 1024) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 1024) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === 4) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === 4); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 || name.parent.kind === 163); + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + if (exportChanged) { + write(")"); + } + } + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + return identifier; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + var canDefineTempVariablesInPlace = false; + if (root.kind === 211) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 138) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 181) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + emitBindingElement(root, value); + } + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 69 && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue) { + value = ensureIdentifier(value, true); + var equals = ts.createSynthesizedNode(181); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(182); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + var syntheticName = ts.createSynthesizedNode(propName.kind); + syntheticName.text = propName.text; + if (syntheticName.kind !== 69) { + return createElementAccessExpression(object, syntheticName); + } + return createPropertyAccessExpression(object, syntheticName); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(168); + var sliceIdentifier = ts.createSynthesizedNode(69); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 245 || p.kind === 246) { + var propName = p.name; + var target_1 = p.kind === 246 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 187) { + if (e.kind !== 185) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 246) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + } + target = target.name; + } + else if (target.kind === 181 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 165) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 164) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value, emitCount > 0); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 172) { + write("("); + } + value = ensureIdentifier(value, true); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 172) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 161) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 187) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, emitCount > 0); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2) { + emitDestructuring(node, false); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + var initializer = node.initializer; + if (!initializer && languageVersion < 2) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && + (getCombinedFlagsForIdentifier(node.name) & 16384); + if (isUninitializedLet && + node.parent.parent.kind !== 200 && + node.parent.parent.kind !== 201) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 187) { + return; + } + var name = node.name; + if (name.kind === 69) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function getCombinedFlagsForIdentifier(node) { + if (!node.parent || (node.parent.kind !== 211 && node.parent.kind !== 163)) { + return 0; + } + return ts.getCombinedNodeFlags(node.parent); + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1) && + modulekind === 5 && + node.parent.kind === 248; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + if (!(node.flags & 1)) { + return true; + } + if (isES6ExportedDeclaration(node)) { + return true; + } + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name_25 = createTempVariable(0); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_25); + emit(name_25); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2) { + var tempIndex = 0; + ts.forEach(node.parameters, function (parameter) { + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, false, tempParameters[tempIndex]); + } + else { + emit(tempParameters[tempIndex]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 145 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 174 && languageVersion >= 2; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 173) { + return !!node.name; + } + if (node.kind === 213) { + return !!node.name || languageVersion < 2; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + if (node.kind !== 143 && node.kind !== 142 && + node.parent && node.parent.kind !== 245 && + node.parent.kind !== 168) { + emitLeadingComments(node); + } + emitStart(node); + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== 5 && node.kind === 213 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (node.kind !== 143 && node.kind !== 142) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, false, false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 174; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var args; + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments"); + } + else { + write(", void 0"); + } + if (promiseConstructor) { + write(", "); + emitNodeWithoutSourceMap(promiseConstructor); + } + else { + write(", Promise"); + } + if (hasLexicalArguments) { + write(", function* (_arguments)"); + } + else { + write(", function* ()"); + } + emitFunctionBody(node); + write(")"); + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + write(" { }"); + } + else { + if (node.body.kind === 192) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync && languageVersion === 2) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 || node.flags & 512) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + write(" "); + var current = body; + while (current.kind === 171) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 165); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 195) { + var expr = statement.expression; + if (expr && expr.kind === 168) { + var func = expr.expression; + if (func && func.kind === 95) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 9 || memberName.kind === 8) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 136) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 141 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0; _a < properties.length; _a++) { + var property = properties[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 128) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 191) { + writeLine(); + write(";"); + } + else if (member.kind === 143 || node.kind === 142) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 145 || member.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 143 || node.kind === 142) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 143 || + member.kind === 145 || + member.kind === 146) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 128) { + write("static "); + } + if (member.kind === 145) { + write("get "); + } + else if (member.kind === 146) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 191) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + var hasInstancePropertyWithInitializer = false; + ts.forEach(node.members, function (member) { + if (member.kind === 144 && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + if (member.kind === 141 && member.initializer && (member.flags & 128) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== 5 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var thisNodeIsDecorated = ts.nodeIsDecorated(node); + if (node.kind === 214) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + } + var staticProperties = getInitializedProperties(node, true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + if ((node.name || (node.flags & 1024 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + scopeEmitStart(node); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + if (thisNodeIsDecorated) { + write(";"); + } + if (isClassExpressionWithStaticProperties) { + for (var _a = 0; _a < staticProperties.length; _a++) { + var property = staticProperties[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, tempVariable, true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node); + } + if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 214) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, true)); + writeLine(); + emitDecoratorsOfClass(node); + writeLine(); + emitToken(16, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(true); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 214) { + write(";"); + } + emitEnd(node); + if (node.kind === 214) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 128)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node) { + emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, 128); + emitDecoratorsOfConstructor(node); + } + function emitDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + if (!decorators && !hasDecoratedParameters) { + return; + } + writeLine(); + emitStart(node); + emitDeclarationName(node); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + emitSerializedTypeMetadata(node, argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(");"); + emitEnd(node); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.flags & 128) !== staticFlag) { + continue; + } + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + if (!ts.nodeOrChildIsDecorated(member)) { + continue; + } + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + if (member.kind === 143) { + functionLikeMember = member; + } + } + writeLine(); + emitStart(member); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + if (languageVersion > 0) { + if (member.kind !== 141) { + write(", null"); + } + else { + write(", void 0"); + } + } + write(");"); + emitEnd(member); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + emitStart(decorator); + write("__param(" + parameterIndex + ", "); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + switch (node.kind) { + case 143: + case 145: + case 146: + case 141: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + switch (node.kind) { + case 143: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + switch (node.kind) { + case 214: + case 143: + case 146: + return true; + } + return false; + } + function emitSerializedTypeOfNode(node) { + switch (node.kind) { + case 214: + write("Function"); + return; + case 141: + emitSerializedTypeNode(node.type); + return; + case 138: + emitSerializedTypeNode(node.type); + return; + case 145: + emitSerializedTypeNode(node.type); + return; + case 146: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103: + write("void 0"); + return; + case 160: + emitSerializedTypeNode(node.type); + return; + case 152: + case 153: + write("Function"); + return; + case 156: + case 157: + write("Array"); + return; + case 150: + case 120: + write("Boolean"); + return; + case 130: + case 9: + write("String"); + return; + case 128: + write("Number"); + return; + case 131: + write("Symbol"); + return; + case 151: + emitSerializedTypeReferenceNode(node); + return; + case 154: + case 155: + case 158: + case 159: + case 117: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + function emitSerializedParameterTypesOfNode(node) { + if (node) { + var valueDeclaration; + if (node.kind === 214) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 156) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 151 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 218) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 219) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 221) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 222 && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== 5) { + return emitExternalImportDeclaration(node); + } + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 224) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 221 && (node.flags & 1) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (modulekind !== 2) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + if (!isExportedImport) + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + var isNakedImport = 222 && !node.importClause; + if (!isNakedImport) { + write("var "); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== 4); + if (modulekind !== 5) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + if (modulekind !== 2) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + writeLine(); + write("__export("); + if (modulekind !== 2) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === 5); + var needsComma = false; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === 5) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 213 && + expression.kind !== 214) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === 4) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStars = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 222: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, true)) { + externalImports.push(node); + } + break; + case 221: + if (node.moduleReference.kind === 232 && resolver.isReferencedAliasDeclaration(node)) { + externalImports.push(node); + } + break; + case 228: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStars = true; + } + else if (resolver.isValueAliasDeclaration(node)) { + externalImports.push(node); + } + } + else { + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_26 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_26] || (exportSpecifiers[name_26] = [])).push(specifier); + } + } + break; + case 227: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStars) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + if (node.kind === 222 && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 228 && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + var skipNode = importNode.kind === 228 || + (importNode.kind === 222 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStars) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 228 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 228) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 69 && node.flags & 1024) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + var name_27 = local.kind === 69 + ? local + : local.name; + if (name_27) { + var text = ts.unescapeIdentifier(name_27.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 214 || local.kind === 218 || local.kind === 217) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2) { + return; + } + if (node.kind === 213) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 214) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 217) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 211 || node.kind === 163) { + if (shouldHoistVariable(node, false)) { + var name_28 = node.name; + if (name_28.kind === 69) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_28); + } + else { + ts.forEachChild(name_28, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 49152) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 248; + } + function isCurrentFileSystemExternalModule() { + return modulekind === 4 && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); + emitTempDeclarations(true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 222: + if (!entry.importClause) { + break; + } + case 221: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 228: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + case 213: + case 222: + continue; + case 228: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 221: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSystemModule(node) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + writeLine(); + write("System.register("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push("\"" + amdDependency.path + "\""); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + } + } + for (var _c = 0; _c < externalImports.length; _c++) { + var importNode = externalImports[_c]; + var externalModuleName = getExternalModuleNameText(importNode); + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write("[\"require\", \"exports\""); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + emitAMDDependencies(node, true); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(false); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, false); + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2: + jsxEmitReact(node); + break; + case 1: + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; + } + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1: + default: + return ts.getTextOfNode(node, true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2: + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); + break; + case 1: + default: + writer.writeLiteral(ts.getTextOfNode(node, true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2: + emit(node.expression); + break; + } + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + if (!compilerOptions.noEmitHelpers) { + if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedComments(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + emitModule(node); + } + else { + var startIndex = emitDirectivePrologues(node.statements, false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 215: + case 213: + case 222: + case 221: + case 216: + case 227: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 193: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 218: + return shouldEmitModuleDeclaration(node); + case 217: + return shouldEmitEnumDeclaration(node); + } + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 192 && + node.parent && + node.parent.kind === 174 && + node.parent.body === node && + compilerOptions.target <= 1) { + return false; + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 69: + return emitIdentifier(node); + case 138: + return emitParameter(node); + case 143: + case 142: + return emitMethod(node); + case 145: + case 146: + return emitAccessor(node); + case 97: + return emitThis(node); + case 95: + return emitSuper(node); + case 93: + return write("null"); + case 99: + return write("true"); + case 84: + return write("false"); + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + return emitLiteral(node); + case 183: + return emitTemplateExpression(node); + case 190: + return emitTemplateSpan(node); + case 233: + case 234: + return emitJsxElement(node); + case 236: + return emitJsxText(node); + case 240: + return emitJsxExpression(node); + case 135: + return emitQualifiedName(node); + case 161: + return emitObjectBindingPattern(node); + case 162: + return emitArrayBindingPattern(node); + case 163: + return emitBindingElement(node); + case 164: + return emitArrayLiteral(node); + case 165: + return emitObjectLiteral(node); + case 245: + return emitPropertyAssignment(node); + case 246: + return emitShorthandPropertyAssignment(node); + case 136: + return emitComputedPropertyName(node); + case 166: + return emitPropertyAccess(node); + case 167: + return emitIndexedAccess(node); + case 168: + return emitCallExpression(node); + case 169: + return emitNewExpression(node); + case 170: + return emitTaggedTemplateExpression(node); + case 171: + return emit(node.expression); + case 189: + return emit(node.expression); + case 172: + return emitParenExpression(node); + case 213: + case 173: + case 174: + return emitFunctionDeclaration(node); + case 175: + return emitDeleteExpression(node); + case 176: + return emitTypeOfExpression(node); + case 177: + return emitVoidExpression(node); + case 178: + return emitAwaitExpression(node); + case 179: + return emitPrefixUnaryExpression(node); + case 180: + return emitPostfixUnaryExpression(node); + case 181: + return emitBinaryExpression(node); + case 182: + return emitConditionalExpression(node); + case 185: + return emitSpreadElementExpression(node); + case 184: + return emitYieldExpression(node); + case 187: + return; + case 192: + case 219: + return emitBlock(node); + case 193: + return emitVariableStatement(node); + case 194: + return write(";"); + case 195: + return emitExpressionStatement(node); + case 196: + return emitIfStatement(node); + case 197: + return emitDoStatement(node); + case 198: + return emitWhileStatement(node); + case 199: + return emitForStatement(node); + case 201: + case 200: + return emitForInOrForOfStatement(node); + case 202: + case 203: + return emitBreakOrContinueStatement(node); + case 204: + return emitReturnStatement(node); + case 205: + return emitWithStatement(node); + case 206: + return emitSwitchStatement(node); + case 241: + case 242: + return emitCaseOrDefaultClause(node); + case 207: + return emitLabelledStatement(node); + case 208: + return emitThrowStatement(node); + case 209: + return emitTryStatement(node); + case 244: + return emitCatchClause(node); + case 210: + return emitDebuggerStatement(node); + case 211: + return emitVariableDeclaration(node); + case 186: + return emitClassExpression(node); + case 214: + return emitClassDeclaration(node); + case 215: + return emitInterfaceDeclaration(node); + case 217: + return emitEnumDeclaration(node); + case 247: + return emitEnumMember(node); + case 218: + return emitModuleDeclaration(node); + case 222: + return emitImportDeclaration(node); + case 221: + return emitImportEqualsDeclaration(node); + case 228: + return emitExportDeclaration(node); + case 227: + return emitExportAssignment(node); + case 248: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + function isTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + return getLeadingCommentsWithoutDetachedComments(); + } + else { + return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + } + } + } + function getTrailingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + } + } + } + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); + ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedComments(node) { + var leadingComments; + if (compilerOptions.removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } + var _a; + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + } + } + } + ts.emitFiles = emitFiles; })(ts || (ts = {})); var ts; (function (ts) { @@ -29826,11 +30347,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -29840,13 +30361,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, loadOnlyDts, failedLookupLocation, host) { - if (loadOnlyDts) { - return tryLoad(".d.ts"); - } - else { - return ts.forEach(ts.supportedExtensions, tryLoad); - } + function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { + return ts.forEach(ts.supportedJsExtensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -29858,7 +30374,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, loadOnlyDts, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -29870,7 +30386,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -29879,7 +30395,7 @@ var ts; else { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -29889,11 +30405,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host); + var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -29911,16 +30427,17 @@ var ts; return i === 0 || (i === 1 && name.charCodeAt(0) === 46); } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - if (moduleName.indexOf('!') != -1) { + if (moduleName.indexOf("!") != -1) { return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { return undefined; } @@ -30220,7 +30737,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(fileName); + return filesByName.get(fileName) || filesByName.get(ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory())); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -30306,13 +30823,18 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; + collect(node, true); + } + file.imports = imports || emptyArray; + function collect(node, allowRelativeModuleNames) { switch (node.kind) { - case 220: - case 219: - case 226: + case 222: + case 221: + case 228: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -30320,24 +30842,35 @@ var ts; if (!moduleNameExpr.text) { break; } - (imports || (imports = [])).push(moduleNameExpr); + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - case 216: - if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9) { - var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); - if (moduleName) { - (imports || (imports = [])).push(moduleName); + case 168: + if (isJavaScriptFile && ts.isRequireCall(node)) { + var jsImports = node.arguments; + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === 9) { + imports.push(jsImports[i]); } } + } + } + break; + case 218: + if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + collect(node, false); }); } break; } + if (ts.isSourceFileJavaScript(file)) { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames); }); + } } - file.imports = imports || emptyArray; } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; @@ -30380,48 +30913,46 @@ var ts; } } function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); - if (filesByName.contains(canonicalName)) { - return getSourceFileFromCache(fileName, canonicalName, false); + if (filesByName.contains(fileName)) { + return getSourceFileFromCache(fileName, false); } - else { - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); - if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); - } - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(canonicalName, file); - if (file) { - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - filesByName.set(canonicalAbsolutePath, file); - var basePath = ts.getDirectoryPath(fileName); - if (!options.noResolve) { - processReferencedFiles(file, basePath); - } - processImportedModules(file, basePath); - if (isDefaultLib) { - file.isDefaultLib = true; - files.unshift(file); - } - else { - files.push(file); - } - } - return file; + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + if (filesByName.contains(normalizedAbsolutePath)) { + var file_1 = getSourceFileFromCache(normalizedAbsolutePath, true); + filesByName.set(fileName, file_1); + return file_1; } - function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName.get(canonicalName); + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(fileName, file); + if (file) { + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + filesByName.set(normalizedAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath); + } + processImportedModules(file, basePath); + if (isDefaultLib) { + file.isDefaultLib = true; + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + function getSourceFileFromCache(fileName, useAbsolutePath) { + var file = filesByName.get(fileName); if (file && host.useCaseSensitiveFileNames()) { var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; - if (canonicalName !== sourceFileName) { + if (ts.normalizeSlashes(fileName) !== ts.normalizeSlashes(sourceFileName)) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } @@ -30582,8 +31113,8 @@ var ts; var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - if (options.module && languageVersion >= 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + if (options.module === 5 && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } if (options.outDir || options.sourceRoot || @@ -30617,10 +31148,6 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.experimentalAsyncFunctions && - options.target !== 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); - } } } ts.createProgram = createProgram; @@ -30663,98 +31190,98 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return spanInPreviousNode(node); } - if (node.parent.kind === 197) { + if (node.parent.kind === 199) { return textSpan(node); } - if (node.parent.kind === 179 && node.parent.operatorToken.kind === 24) { + if (node.parent.kind === 181 && node.parent.operatorToken.kind === 24) { return textSpan(node); } - if (node.parent.kind === 172 && node.parent.body === node) { + if (node.parent.kind === 174 && node.parent.body === node) { return textSpan(node); } } switch (node.kind) { - case 191: + case 193: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 209: - case 139: - case 138: - return spanInVariableDeclaration(node); - case 136: - return spanInParameterDeclaration(node); case 211: case 141: case 140: + return spanInVariableDeclaration(node); + case 138: + return spanInParameterDeclaration(node); + case 213: case 143: - case 144: case 142: - case 171: - case 172: + case 145: + case 146: + case 144: + case 173: + case 174: return spanInFunctionDeclaration(node); - case 190: + case 192: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 217: + case 219: return spanInBlock(node); - case 242: + case 244: return spanInBlock(node.block); - case 193: + case 195: return textSpan(node.expression); - case 202: + case 204: return textSpan(node.getChildAt(0), node.expression); + case 198: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 197: + return spanInNode(node.statement); + case 210: + return textSpan(node.getChildAt(0)); case 196: return textSpan(node, ts.findNextToken(node.expression, node)); - case 195: - return spanInNode(node.statement); - case 208: - return textSpan(node.getChildAt(0)); - case 194: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 205: - return spanInNode(node.statement); - case 201: - case 200: - return textSpan(node.getChildAt(0), node.label); - case 197: - return spanInForStatement(node); - case 198: - case 199: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 204: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 239: - case 240: - return spanInNode(node.statements[0]); case 207: - return spanInBlock(node.tryBlock); + return spanInNode(node.statement); + case 203: + case 202: + return textSpan(node.getChildAt(0), node.label); + case 199: + return spanInForStatement(node); + case 200: + case 201: + return textSpan(node, ts.findNextToken(node.expression, node)); case 206: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 241: + case 242: + return spanInNode(node.statements[0]); + case 209: + return spanInBlock(node.tryBlock); + case 208: return textSpan(node, node.expression); - case 225: + case 227: return textSpan(node, node.expression); - case 219: + case 221: return textSpan(node, node.moduleReference); - case 220: + case 222: return textSpan(node, node.moduleSpecifier); - case 226: + case 228: return textSpan(node, node.moduleSpecifier); - case 216: + case 218: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 212: - case 215: - case 245: - case 166: - case 167: - return textSpan(node); - case 203: - return spanInNode(node.statement); - case 213: case 214: + case 217: + case 247: + case 168: + case 169: + return textSpan(node); + case 205: + return spanInNode(node.statement); + case 215: + case 216: return undefined; case 23: case 1: @@ -30769,22 +31296,22 @@ var ts; return spanInOpenParenToken(node); case 18: return spanInCloseParenToken(node); - case 53: + case 54: return spanInColonToken(node); case 27: case 25: return spanInGreaterThanOrLessThanToken(node); - case 102: + case 104: return spanInWhileKeyword(node); - case 78: - case 70: - case 83: + case 80: + case 72: + case 85: return spanInNextNode(node); default: - if (node.parent.kind === 243 && node.parent.name === node) { + if (node.parent.kind === 245 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 169 && node.parent.type === node) { + if (node.parent.kind === 171 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { @@ -30794,12 +31321,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 198 || - variableDeclaration.parent.parent.kind === 199) { + if (variableDeclaration.parent.parent.kind === 200 || + variableDeclaration.parent.parent.kind === 201) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -30845,7 +31372,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 212 && functionDeclaration.kind !== 142); + (functionDeclaration.parent.kind === 214 && functionDeclaration.kind !== 144); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -30865,23 +31392,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 216: + case 218: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 196: - case 194: case 198: - case 199: + case 196: + case 200: + case 201: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 197: + case 199: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 210) { + if (forStatement.initializer.kind === 212) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -30900,34 +31427,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 215: + case 217: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 212: + case 214: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 218: + case 220: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 217: + case 219: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 215: - case 212: + case 217: + case 214: return textSpan(node); - case 190: + case 192: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 242: + case 244: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 218: + case 220: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { @@ -30939,24 +31466,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 171: - case 211: - case 172: - case 141: - case 140: + case 173: + case 213: + case 174: case 143: - case 144: case 142: - case 196: - case 195: + case 145: + case 146: + case 144: + case 198: case 197: + case 199: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -30964,19 +31491,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 243) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 245) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 169) { + if (node.parent.kind === 171) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -31054,7 +31581,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 172; + return ts.isFunctionBlock(node) && node.parent.kind !== 174; } var depth = 0; var maxDepth = 20; @@ -31066,30 +31593,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 190: + case 192: if (!ts.isFunctionBlock(n)) { var parent_7 = n.parent; var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); - if (parent_7.kind === 195 || - parent_7.kind === 198 || + if (parent_7.kind === 197 || + parent_7.kind === 200 || + parent_7.kind === 201 || parent_7.kind === 199 || - parent_7.kind === 197 || - parent_7.kind === 194 || parent_7.kind === 196 || - parent_7.kind === 203 || - parent_7.kind === 242) { + parent_7.kind === 198 || + parent_7.kind === 205 || + parent_7.kind === 244) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 207) { + if (parent_7.kind === 209) { var tryStatement = parent_7; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -31105,23 +31632,23 @@ var ts; }); break; } - case 217: { + case 219: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 212: - case 213: + case 214: case 215: - case 163: - case 218: { + case 217: + case 165: + case 220: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 162: + case 164: var openBracket = ts.findChildOfKind(n, 19, sourceFile); var closeBracket = ts.findChildOfKind(n, 20, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -31147,10 +31674,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_28 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_28); + for (var name_29 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_29); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_28); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_29); if (!matches) { continue; } @@ -31161,14 +31688,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_28); + matches = patternMatcher.getMatches(containers, name_29); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_28, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_29, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31191,7 +31718,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 || + if (node.kind === 69 || node.kind === 9 || node.kind === 8) { return node.text; @@ -31205,7 +31732,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 134) { + else if (declaration.name.kind === 136) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -31222,7 +31749,7 @@ var ts; } return true; } - if (expression.kind === 164) { + if (expression.kind === 166) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -31233,7 +31760,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 134) { + if (declaration.name.kind === 136) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -31296,14 +31823,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 216: + case 218: do { current = current.parent; - } while (current.kind === 216); - case 212: + } while (current.kind === 218); + case 214: + case 217: case 215: case 213: - case 211: indent++; } current = current.parent; @@ -31314,26 +31841,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 191: + case 193: ts.forEach(node.declarationList.declarations, visit); break; - case 159: - case 160: + case 161: + case 162: ts.forEach(node.elements, visit); break; - case 226: + case 228: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220: + case 222: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { childNodes.push(importClause.namedBindings); } else { @@ -31342,20 +31869,20 @@ var ts; } } break; - case 161: - case 209: + case 163: + case 211: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 212: + case 214: + case 217: case 215: + case 218: case 213: - case 216: - case 211: - case 219: - case 224: - case 228: + case 221: + case 226: + case 230: childNodes.push(node); break; } @@ -31390,17 +31917,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 212: + case 214: + case 217: case 215: - case 213: topLevelNodes.push(node); break; - case 216: + case 218: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 211: + case 213: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -31411,9 +31938,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 211) { - if (functionDeclaration.body && functionDeclaration.body.kind === 190) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 213) { + if (functionDeclaration.body && functionDeclaration.body.kind === 192) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -31466,7 +31993,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 136: + case 138: if (ts.isBindingPattern(node.name)) { break; } @@ -31474,34 +32001,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 143: + case 142: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 145: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 146: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 149: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 247: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 147: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 148: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); case 141: case 140: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 143: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 144: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 147: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 245: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 146: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 139: - case 138: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 211: + case 213: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 209: - case 161: + case 211: + case 163: var variableDeclarationNode; - var name_29; - if (node.kind === 161) { - name_29 = node.name; + var name_30; + if (node.kind === 163) { + name_30 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 209) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 211) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -31509,24 +32036,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_29 = node.name; + name_30 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.variableElement); } - case 142: + case 144: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 228: - case 224: - case 219: + case 230: + case 226: case 221: - case 222: + case 223: + case 224: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -31556,17 +32083,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 246: + case 248: return createSourceFileItem(node); - case 212: + case 214: return createClassItem(node); - case 215: + case 217: return createEnumItem(node); - case 213: + case 215: return createIterfaceItem(node); - case 216: + case 218: return createModuleItem(node); - case 211: + case 213: return createFunctionItem(node); } return undefined; @@ -31576,7 +32103,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 216) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 218) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -31588,7 +32115,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 190) { + if (node.body && node.body.kind === 192) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -31609,7 +32136,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 142 && member; + return member.kind === 144 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -31630,19 +32157,19 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 216) { + while (node.body.kind === 218) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 246 + return node.kind === 248 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -32125,21 +32652,21 @@ var ts; var resolvedSignature = typeChecker.getResolvedSignature(call, candidates); cancellationToken.throwIfCancellationRequested(); if (!candidates.length) { - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 166) { + if (argumentInfo.invocation.kind !== 168) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 67 + var name = expression.kind === 69 ? expression - : expression.kind === 164 + : expression.kind === 166 ? expression.name : undefined; if (!name || !name.text) { @@ -32168,7 +32695,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 166 || node.parent.kind === 167) { + if (node.parent.kind === 168 || node.parent.kind === 169) { var callExpression = node.parent; if (node.kind === 25 || node.kind === 17) { @@ -32199,23 +32726,23 @@ var ts; }; } } - else if (node.kind === 11 && node.parent.kind === 168) { + else if (node.kind === 11 && node.parent.kind === 170) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 12 && node.parent.parent.kind === 168) { + else if (node.kind === 12 && node.parent.parent.kind === 170) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181); + ts.Debug.assert(templateExpression.kind === 183); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 188 && node.parent.parent.parent.kind === 168) { + else if (node.parent.kind === 190 && node.parent.parent.parent.kind === 170) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181); + ts.Debug.assert(templateExpression.kind === 183); if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -32279,7 +32806,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 181) { + if (template.kind === 183) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -32288,7 +32815,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 246; n = n.parent) { + for (var n = node; n.kind !== 248; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -32468,39 +32995,39 @@ var ts; return false; } switch (n.kind) { - case 212: - case 213: + case 214: case 215: - case 163: - case 159: - case 153: - case 190: case 217: - case 218: + case 165: + case 161: + case 155: + case 192: + case 219: + case 220: return nodeEndsWith(n, 16, sourceFile); - case 242: + case 244: return isCompletedNode(n.block, sourceFile); - case 167: + case 169: if (!n.arguments) { return true; } - case 166: - case 170: - case 158: - return nodeEndsWith(n, 18, sourceFile); - case 150: - case 151: - return isCompletedNode(n.type, sourceFile); - case 142: - case 143: - case 144: - case 211: - case 171: - case 141: - case 140: - case 146: - case 145: + case 168: case 172: + case 160: + return nodeEndsWith(n, 18, sourceFile); + case 152: + case 153: + return isCompletedNode(n.type, sourceFile); + case 144: + case 145: + case 146: + case 213: + case 173: + case 143: + case 142: + case 148: + case 147: + case 174: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -32508,61 +33035,62 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 18, sourceFile); - case 216: + case 218: return n.body && isCompletedNode(n.body, sourceFile); - case 194: + case 196: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 193: - return isCompletedNode(n.expression, sourceFile); + case 195: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 23); + case 164: case 162: - case 160: - case 165: - case 134: - case 155: + case 167: + case 136: + case 157: return nodeEndsWith(n, 20, sourceFile); - case 147: + case 149: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20, sourceFile); - case 239: - case 240: + case 241: + case 242: return false; - case 197: - case 198: case 199: - case 196: + case 200: + case 201: + case 198: return isCompletedNode(n.statement, sourceFile); - case 195: - var hasWhileKeyword = findChildOfKind(n, 102, sourceFile); + case 197: + var hasWhileKeyword = findChildOfKind(n, 104, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 152: + case 154: return isCompletedNode(n.exprName, sourceFile); - case 174: - case 173: + case 176: case 175: - case 182: - case 183: + case 177: + case 184: + case 185: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 168: + case 170: return isCompletedNode(n.template, sourceFile); - case 181: + case 183: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 188: + case 190: return ts.nodeIsPresent(n.literal); - case 177: - return isCompletedNode(n.operand, sourceFile); case 179: + return isCompletedNode(n.operand, sourceFile); + case 181: return isCompletedNode(n.right, sourceFile); - case 180: + case 182: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -32605,7 +33133,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 269 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 271 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -32685,7 +33213,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 234) { + if (isToken(n) || n.kind === 236) { return n; } var children = n.getChildren(); @@ -32693,16 +33221,16 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 234) { + if (isToken(n) || n.kind === 236) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (position < child.end && (nodeHasTokens(child) || child.kind === 234)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 236)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 234 && start === child.end); + (child.kind === 236 && start === child.end); if (lookInPreviousChild) { var candidate = findRightmostChildNodeWithTokens(children, i); return candidate && findRightmostToken(candidate); @@ -32712,7 +33240,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 246); + ts.Debug.assert(startNode !== undefined || n.kind === 248); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -32764,9 +33292,9 @@ var ts; var node = ts.getTokenAtPosition(sourceFile, position); if (isToken(node)) { switch (node.kind) { - case 100: - case 106: - case 72: + case 102: + case 108: + case 74: node = node.parent === undefined ? undefined : node.parent.parent; break; default: @@ -32812,21 +33340,21 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 149 || node.kind === 166) { + if (node.kind === 151 || node.kind === 168) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 212 || node.kind === 213) { + if (ts.isFunctionLike(node) || node.kind === 214 || node.kind === 215) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 132; + return n.kind >= 0 && n.kind <= 134; } ts.isToken = isToken; function isWord(kind) { - return kind === 67 || ts.isKeyword(kind); + return kind === 69 || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { @@ -32836,8 +33364,17 @@ var ts; return kind === 2 || kind === 3; } ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 + || kind === 10 + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; function isPunctuation(kind) { - return 15 <= kind && kind <= 66; + return 15 <= kind && kind <= 68; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -32847,9 +33384,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { + case 112: case 110: - case 108: - case 109: + case 111: return true; } return false; @@ -32875,7 +33412,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -32897,7 +33434,8 @@ var ts; increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; function writeIndent() { if (lineStart) { @@ -33055,7 +33593,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 224 || location.parent.kind === 228) && + (location.parent.kind === 226 || location.parent.kind === 230) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -33075,8 +33613,12 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2, false); + var standardScanner = ts.createScanner(2, false, 0); + var jsxScanner = ts.createScanner(2, false, 1); + var scanner; function getFormattingScanner(sourceFile, startPos, endPos) { + ts.Debug.assert(scanner === undefined); + scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner; scanner.setText(sourceFile.text); scanner.setTextPos(startPos); var wasNewLine = true; @@ -33091,11 +33633,14 @@ var ts; isOnToken: isOnToken, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; scanner.setText(undefined); + scanner = undefined; } }; function advance() { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; var isStarted = scanner.getStartPos() !== startPos; if (isStarted) { @@ -33137,10 +33682,10 @@ var ts; if (node) { switch (node.kind) { case 29: - case 62: - case 63: + case 64: + case 65: + case 45: case 44: - case 43: return true; } } @@ -33149,11 +33694,11 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 236: - case 233: + case 238: case 235: - case 232: - return node.kind === 67; + case 237: + case 234: + return node.kind === 69; } } return false; @@ -33166,9 +33711,10 @@ var ts; container.kind === 14; } function startsWithSlashToken(t) { - return t === 38 || t === 59; + return t === 39 || t === 61; } function readTokenInfo(n) { + ts.Debug.assert(scanner !== undefined); if (!isOnToken()) { return { leadingTrivia: leadingTrivia, @@ -33208,7 +33754,7 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3; } - else if (expectedScanAction === 4 && currentToken === 67) { + else if (expectedScanAction === 4 && currentToken === 69) { currentToken = scanner.scanJsxIdentifier(); lastScanAction = 4; } @@ -33250,6 +33796,7 @@ var ts; return fixTokenKind(lastTokenInfo, n); } function isOnToken() { + ts.Debug.assert(scanner !== undefined); var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== 1 && !ts.isTrivia(current); @@ -33462,15 +34009,15 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 78), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 102), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -33478,9 +34025,9 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67, 3, 71]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69, 3, 73]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 77, 98, 83, 78]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 79, 100, 85, 80]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -33488,37 +34035,37 @@ var ts; this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100, 96, 90, 76, 92, 99, 117]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 77, 78, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98, 83]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121, 127]), 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 129]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 125]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113, 71, 120, 75, 79, 80, 81, 121, 104, 87, 105, 123, 124, 108, 110, 109, 127, 111, 130]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81, 104])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 127]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 129, 113, 132]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); @@ -33526,15 +34073,18 @@ var ts; this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113, 67, 80, 75, 71, 111, 110, 108, 109, 121, 127, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([67, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116, 85), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 129, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([69, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -33560,8 +34110,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, @@ -33613,46 +34163,46 @@ var ts; this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_30 in o) { - if (o[name_30] === rule) { - return name_30; + for (var name_31 in o) { + if (o[name_31] === rule) { + return name_31; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 197; + return context.contextNode.kind === 199; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 179: - case 180: - case 187: - case 148: - case 156: - case 157: + case 181: + case 182: + case 189: + case 150: + case 158: + case 159: return true; - case 161: - case 214: - case 219: - case 209: - case 136: - case 245: - case 139: + case 163: + case 216: + case 221: + case 211: case 138: - return context.currentTokenSpan.kind === 55 || context.nextTokenSpan.kind === 55; - case 198: - return context.currentTokenSpan.kind === 88 || context.nextTokenSpan.kind === 88; - case 199: - return context.currentTokenSpan.kind === 132 || context.nextTokenSpan.kind === 132; + case 247: + case 141: + case 140: + return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56; + case 200: + return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90; + case 201: + return context.currentTokenSpan.kind === 134 || context.nextTokenSpan.kind === 134; } return false; }; @@ -33660,7 +34210,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 182; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); @@ -33685,86 +34235,86 @@ var ts; return true; } switch (node.kind) { - case 190: - case 218: - case 163: - case 217: + case 192: + case 220: + case 165: + case 219: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 211: - case 141: - case 140: - case 143: - case 144: - case 145: - case 171: - case 142: - case 172: case 213: + case 143: + case 142: + case 145: + case 146: + case 147: + case 173: + case 144: + case 174: + case 215: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 211 || context.contextNode.kind === 171; + return context.contextNode.kind === 213 || context.contextNode.kind === 173; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 212: - case 184: - case 213: + case 214: + case 186: case 215: - case 153: - case 216: + case 217: + case 155: + case 218: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 212: - case 216: - case 215: - case 190: - case 242: + case 214: + case 218: case 217: - case 204: + case 192: + case 244: + case 219: + case 206: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 194: - case 204: - case 197: - case 198: - case 199: case 196: - case 207: - case 195: - case 203: - case 242: + case 206: + case 199: + case 200: + case 201: + case 198: + case 209: + case 197: + case 205: + case 244: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 163; + return context.contextNode.kind === 165; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 166; + return context.contextNode.kind === 168; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 167; + return context.contextNode.kind === 169; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -33772,6 +34322,9 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24; }; + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 174; + }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); }; @@ -33788,41 +34341,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 137; + return node.kind === 139; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 210 && + return context.currentTokenParent.kind === 212 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 216; + return context.contextNode.kind === 218; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 153; + return context.contextNode.kind === 155; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 && token.kind !== 27) { return false; } switch (parent.kind) { - case 149: - case 169: - case 212: - case 184: - case 213: - case 211: + case 151: case 171: - case 172: - case 141: - case 140: - case 145: - case 146: - case 166: - case 167: + case 214: case 186: + case 215: + case 213: + case 173: + case 174: + case 143: + case 142: + case 147: + case 148: + case 168: + case 169: + case 188: return true; default: return false; @@ -33833,13 +34386,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 169; + return context.contextNode.kind === 171; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 101 && context.currentTokenParent.kind === 175; + return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 177; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 182 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 184 && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -33861,7 +34414,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 132 + 1; + this.mapRowLength = 134 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -34037,7 +34590,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 132; token++) { + for (var token = 0; token <= 134; token++) { result.push(token); } return result; @@ -34079,17 +34632,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(68, 132); - TokenRange.BinaryOperators = TokenRange.FromRange(25, 66); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88, 89, 132, 114, 122]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40, 41, 49, 48]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 67, 17, 19, 15, 95, 90]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); + TokenRange.Keywords = TokenRange.FromRange(70, 134); + TokenRange.BinaryOperators = TokenRange.FromRange(25, 68); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 134, 116, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([67, 126, 128, 118, 129, 101, 115]); + TokenRange.TypeNames = TokenRange.FromTokens([69, 128, 130, 120, 131, 103, 117]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -34260,17 +34813,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 212: - case 213: + case 214: + case 215: return ts.rangeContainsRange(parent.members, node); - case 216: + case 218: var body = parent.body; - return body && body.kind === 190 && ts.rangeContainsRange(body.statements, node); - case 246: - case 190: - case 217: + return body && body.kind === 192 && ts.rangeContainsRange(body.statements, node); + case 248: + case 192: + case 219: return ts.rangeContainsRange(parent.statements, node); - case 242: + case 244: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -34395,9 +34948,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 246 || - parent.kind === 239 || - parent.kind === 240) { + parent.kind === 248 || + parent.kind === 241 || + parent.kind === 242) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -34430,18 +34983,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 212: return 71; - case 213: return 105; - case 211: return 85; - case 215: return 215; - case 143: return 121; - case 144: return 127; - case 141: + case 214: return 73; + case 215: return 107; + case 213: return 87; + case 217: return 217; + case 145: return 123; + case 146: return 129; + case 143: if (node.asteriskToken) { return 37; } - case 139: - case 136: + case 141: + case 138: return node.name.kind; } } @@ -34469,9 +35022,9 @@ var ts; case 20: case 17: case 18: - case 78: - case 102: - case 54: + case 80: + case 104: + case 55: return indentation; default: return nodeStartLine !== line ? indentation + delta : indentation; @@ -34551,7 +35104,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 137 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 139 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -34783,7 +35336,7 @@ var ts; for (var line = line1; line < line2; ++line) { var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); var lineEndPosition = ts.getEndLinePosition(line, sourceFile); - if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } var pos = lineEndPosition; @@ -34842,20 +35395,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 190: - case 217: + case 192: + case 219: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 144: + case 213: + case 173: + case 143: case 142: - case 211: - case 171: - case 141: - case 140: - case 172: + case 174: if (node.typeParameters === list) { return 25; } @@ -34863,8 +35416,8 @@ var ts; return 17; } break; - case 166: - case 167: + case 168: + case 169: if (node.typeArguments === list) { return 25; } @@ -34872,7 +35425,7 @@ var ts; return 17; } break; - case 149: + case 151: if (node.typeArguments === list) { return 25; } @@ -34949,21 +35502,31 @@ var ts; if (position > sourceFile.text.length) { return 0; } + if (options.IndentStyle === ts.IndentStyle.None) { + return 0; + } var precedingToken = ts.findPrecedingToken(position, sourceFile); if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 9 || - precedingToken.kind === 10 || - precedingToken.kind === 11 || - precedingToken.kind === 12 || - precedingToken.kind === 13 || - precedingToken.kind === 14; + var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 24 && precedingToken.parent.kind !== 179) { + if (options.IndentStyle === ts.IndentStyle.Block) { + var current_1 = position; + while (current_1 > 0) { + var char = sourceFile.text.charCodeAt(current_1); + if (!ts.isWhiteSpace(char) && !ts.isLineBreak(char)) { + break; + } + current_1--; + } + var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); + return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); + } + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 181) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -35061,7 +35624,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 246 || !parentAndChildShareLine); + (parent.kind === 248 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -35085,8 +35648,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 194 && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 78, sourceFile); + if (parent.kind === 196 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -35097,23 +35660,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 149: + case 151: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 163: + case 165: return node.parent.properties; - case 162: + case 164: return node.parent.elements; - case 211: - case 171: - case 172: - case 141: - case 140: - case 145: - case 146: { + case 213: + case 173: + case 174: + case 143: + case 142: + case 147: + case 148: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -35124,8 +35687,8 @@ var ts; } break; } - case 167: - case 166: { + case 169: + case 168: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -35153,8 +35716,8 @@ var ts; if (node.kind === 18) { return -1; } - if (node.parent && (node.parent.kind === 166 || - node.parent.kind === 167) && + if (node.parent && (node.parent.kind === 168 || + node.parent.kind === 169) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -35172,10 +35735,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { + case 168: + case 169: case 166: case 167: - case 164: - case 165: node = node.expression; break; default: @@ -35230,42 +35793,43 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 212: - case 184: - case 213: - case 215: + case 195: case 214: - case 162: - case 190: + case 186: + case 215: case 217: - case 163: - case 153: - case 155: - case 218: - case 240: - case 239: - case 170: + case 216: case 164: + case 192: + case 219: + case 165: + case 155: + case 157: + case 220: + case 242: + case 241: + case 172: case 166: - case 167: - case 191: - case 209: - case 225: - case 202: - case 180: - case 160: - case 159: - case 231: - case 232: - case 140: - case 145: - case 146: - case 136: - case 150: - case 151: - case 158: case 168: - case 176: + case 169: + case 193: + case 211: + case 227: + case 204: + case 182: + case 162: + case 161: + case 233: + case 234: + case 142: + case 147: + case 148: + case 138: + case 152: + case 153: + case 160: + case 170: + case 178: return true; } return false; @@ -35275,20 +35839,20 @@ var ts; return true; } switch (parent) { - case 195: - case 196: - case 198: - case 199: case 197: - case 194: - case 211: - case 171: - case 141: - case 172: - case 142: + case 198: + case 200: + case 201: + case 199: + case 196: + case 213: + case 173: case 143: + case 174: case 144: - return child !== 190; + case 145: + case 146: + return child !== 192; default: return false; } @@ -35417,7 +35981,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(269, nodes.pos, nodes.end, 4096, this); + var list = createNode(271, nodes.pos, nodes.end, 4096, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -35436,7 +36000,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 133) { + if (this.kind >= 135) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -35483,7 +36047,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 133 ? child : child.getFirstToken(sourceFile); + return child.kind < 135 ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -35491,7 +36055,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 133 ? child : child.getLastToken(sourceFile); + return child.kind < 135 ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -35533,7 +36097,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 136) { + if (canUseParsedParamTagComments && declaration.kind === 138) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -35541,13 +36105,13 @@ var ts; } }); } - if (declaration.kind === 216 && declaration.body.kind === 216) { + if (declaration.kind === 218 && declaration.body.kind === 218) { return; } - while (declaration.kind === 216 && declaration.parent.kind === 216) { + while (declaration.kind === 218 && declaration.parent.kind === 218) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -35857,9 +36421,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 134) { + if (declaration.name.kind === 136) { var expr = declaration.name.expression; - if (expr.kind === 164) { + if (expr.kind === 166) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -35869,7 +36433,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 || + if (node.kind === 69 || node.kind === 9 || node.kind === 8) { return node.text; @@ -35879,9 +36443,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 211: - case 141: - case 140: + case 213: + case 143: + case 142: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -35898,62 +36462,62 @@ var ts; ts.forEachChild(node, visit); } break; - case 212: - case 213: case 214: case 215: case 216: - case 219: - case 228: - case 224: - case 219: - case 221: - case 222: - case 143: - case 144: - case 153: - addDeclaration(node); - case 142: - case 191: - case 210: - case 159: - case 160: case 217: + case 218: + case 221: + case 230: + case 226: + case 221: + case 223: + case 224: + case 145: + case 146: + case 155: + addDeclaration(node); + case 144: + case 193: + case 212: + case 161: + case 162: + case 219: ts.forEachChild(node, visit); break; - case 190: + case 192: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 136: + case 138: if (!(node.flags & 112)) { break; } - case 209: - case 161: + case 211: + case 163: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 245: - case 139: - case 138: + case 247: + case 141: + case 140: addDeclaration(node); break; - case 226: + case 228: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220: + case 222: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { addDeclaration(importClause.namedBindings); } else { @@ -35980,6 +36544,12 @@ var ts; HighlightSpanKind.reference = "reference"; HighlightSpanKind.writtenReference = "writtenReference"; })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(ts.IndentStyle || (ts.IndentStyle = {})); + var IndentStyle = ts.IndentStyle; (function (SymbolDisplayPartKind) { SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; @@ -36095,14 +36665,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 171) { + if (declaration.kind === 173) { return true; } - if (declaration.kind !== 209 && declaration.kind !== 211) { + if (declaration.kind !== 211 && declaration.kind !== 213) { return false; } for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { - if (parent_8.kind === 246 || parent_8.kind === 217) { + if (parent_8.kind === 248 || parent_8.kind === 219) { return false; } } @@ -36213,7 +36783,7 @@ var ts; options.allowNonTsExtensions = true; options.noLib = true; options.noResolve = true; - var inputFileName = transpileOptions.fileName || "module.ts"; + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; @@ -36394,8 +36964,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -36429,98 +37000,58 @@ var ts; end: pos + importPath.length }); } - function processImport() { - scanner.setText(sourceText); - var token = scanner.scan(); - while (token !== 1) { - if (token === 120) { - token = scanner.scan(); - if (token === 123) { - token = scanner.scan(); - if (token === 9) { - recordAmbientExternalModule(); - continue; - } - } - } - else if (token === 87) { + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122) { + token = scanner.scan(); + if (token === 125) { token = scanner.scan(); if (token === 9) { - recordModuleName(); - continue; - } - else { - if (token === 67 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - continue; - } - } - else if (token === 55) { - token = scanner.scan(); - if (token === 125) { - token = scanner.scan(); - if (token === 17) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - continue; - } - } - } - } - else if (token === 24) { - token = scanner.scan(); - } - else { - continue; - } - } - if (token === 15) { - token = scanner.scan(); - while (token !== 16) { - token = scanner.scan(); - } - if (token === 16) { - token = scanner.scan(); - if (token === 131) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } - } - else if (token === 37) { - token = scanner.scan(); - if (token === 114) { - token = scanner.scan(); - if (token === 67 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } - } - } + recordAmbientExternalModule(); } } - else if (token === 80) { - token = scanner.scan(); + return true; + } + return false; + } + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + return true; + } + else { + if (token === 69 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + return true; + } + } + else if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; + } + } + else if (token === 24) { + token = scanner.scan(); + } + else { + return true; + } + } if (token === 15) { token = scanner.scan(); - while (token !== 16) { + while (token !== 16 && token !== 1) { token = scanner.scan(); } if (token === 16) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); @@ -36530,38 +37061,135 @@ var ts; } else if (token === 37) { token = scanner.scan(); - if (token === 131) { + if (token === 116) { token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } - else if (token === 87) { - token = scanner.scan(); - if (token === 67 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 55) { + if (token === 69 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 125) { + if (token === 133) { token = scanner.scan(); - if (token === 17) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } + if (token === 9) { + recordModuleName(); } } } } } } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82) { token = scanner.scan(); + if (token === 15) { + token = scanner.scan(); + while (token !== 16 && token !== 1) { + token = scanner.scan(); + } + if (token === 16) { + token = scanner.scan(); + if (token === 133) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + } + } + else if (token === 37) { + token = scanner.scan(); + if (token === 133) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + } + else if (token === 89) { + token = scanner.scan(); + if (token === 69 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127) { + token = scanner.scan(); + if (token === 17) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17) { + return true; + } + token = scanner.scan(); + if (token === 9) { + token = scanner.scan(); + if (token === 24) { + token = scanner.scan(); + } + else { + return true; + } + } + if (token !== 19) { + return true; + } + token = scanner.scan(); + var i = 0; + while (token !== 20 && token !== 1) { + if (token === 9) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { + scanner.setText(sourceText); + scanner.scan(); + while (true) { + if (scanner.getToken() === 1) { + break; + } + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) { + continue; + } + else { + scanner.scan(); + } } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -36569,7 +37197,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 205 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 207 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -36577,17 +37205,17 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 67 && - (node.parent.kind === 201 || node.parent.kind === 200) && + return node.kind === 69 && + (node.parent.kind === 203 || node.parent.kind === 202) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 67 && - node.parent.kind === 205 && + return node.kind === 69 && + node.parent.kind === 207 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 205; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 207; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -36598,48 +37226,48 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 133 && node.parent.right === node; + return node.parent.kind === 135 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 164 && node.parent.name === node; + return node && node.parent && node.parent.kind === 166 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 168 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 167 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 169 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 216 && node.parent.name === node; + return node.parent.kind === 218 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 67 && + return node.kind === 69 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 67 || node.kind === 9 || node.kind === 8) && - (node.parent.kind === 243 || node.parent.kind === 244) && node.parent.name === node; + return (node.kind === 69 || node.kind === 9 || node.kind === 8) && + (node.parent.kind === 245 || node.parent.kind === 246) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { - case 139: - case 138: - case 243: - case 245: case 141: case 140: + case 245: + case 247: case 143: - case 144: - case 216: + case 142: + case 145: + case 146: + case 218: return node.parent.name === node; - case 165: + case 167: return node.parent.argumentExpression === node; } } @@ -36677,7 +37305,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 68; i <= 132; i++) { + for (var i = 70; i <= 134; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -36692,17 +37320,17 @@ var ts; return undefined; } switch (node.kind) { - case 246: - case 141: - case 140: - case 211: - case 171: + case 248: case 143: - case 144: - case 212: + case 142: case 213: + case 173: + case 145: + case 146: + case 214: case 215: - case 216: + case 217: + case 218: return node; } } @@ -36710,38 +37338,38 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 216: return ScriptElementKind.moduleElement; - case 212: return ScriptElementKind.classElement; - case 213: return ScriptElementKind.interfaceElement; - case 214: return ScriptElementKind.typeElement; - case 215: return ScriptElementKind.enumElement; - case 209: + case 218: return ScriptElementKind.moduleElement; + case 214: return ScriptElementKind.classElement; + case 215: return ScriptElementKind.interfaceElement; + case 216: return ScriptElementKind.typeElement; + case 217: return ScriptElementKind.enumElement; + case 211: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 211: return ScriptElementKind.functionElement; - case 143: return ScriptElementKind.memberGetAccessorElement; - case 144: return ScriptElementKind.memberSetAccessorElement; + case 213: return ScriptElementKind.functionElement; + case 145: return ScriptElementKind.memberGetAccessorElement; + case 146: return ScriptElementKind.memberSetAccessorElement; + case 143: + case 142: + return ScriptElementKind.memberFunctionElement; case 141: case 140: - return ScriptElementKind.memberFunctionElement; - case 139: - case 138: return ScriptElementKind.memberVariableElement; - case 147: return ScriptElementKind.indexSignatureElement; - case 146: return ScriptElementKind.constructSignatureElement; - case 145: return ScriptElementKind.callSignatureElement; - case 142: return ScriptElementKind.constructorImplementationElement; - case 135: return ScriptElementKind.typeParameterElement; - case 245: return ScriptElementKind.variableElement; - case 136: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 219: - case 224: + case 149: return ScriptElementKind.indexSignatureElement; + case 148: return ScriptElementKind.constructSignatureElement; + case 147: return ScriptElementKind.callSignatureElement; + case 144: return ScriptElementKind.constructorImplementationElement; + case 137: return ScriptElementKind.typeParameterElement; + case 247: return ScriptElementKind.variableElement; + case 138: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 221: - case 228: - case 222: + case 226: + case 223: + case 230: + case 224: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -36904,7 +37532,7 @@ var ts; function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); @@ -36923,44 +37551,44 @@ var ts; return false; } switch (node.kind) { - case 219: + case 221: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 225: + case 227: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 212: + case 214: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 241: + case 243: var heritageClause = node; - if (heritageClause.token === 104) { + if (heritageClause.token === 106) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 213: + case 215: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 216: + case 218: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214: + case 216: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 171: - case 211: - case 172: - case 211: + case 145: + case 146: + case 173: + case 213: + case 174: + case 213: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -36968,20 +37596,20 @@ var ts; return true; } break; - case 191: + case 193: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 209: + case 211: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 166: - case 167: + case 168: + case 169: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -36989,7 +37617,7 @@ var ts; return true; } break; - case 136: + case 138: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -37005,17 +37633,17 @@ var ts; return true; } break; - case 139: + case 141: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215: + case 217: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 169: + case 171: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 137: + case 139: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -37041,17 +37669,17 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { + case 112: case 110: - case 108: - case 109: - case 120: + case 111: + case 122: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; - case 111: - case 80: - case 72: - case 75: case 113: + case 82: + case 74: + case 77: + case 115: } } } @@ -37096,7 +37724,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -37115,9 +37743,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { + case 269: case 267: - case 265: - case 266: + case 268: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -37145,6 +37773,7 @@ var ts; var node = currentToken; var isRightOfDot = false; var isRightOfOpenTag = false; + var isStartingCloseTag = false; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { if (isCompletionListBlocker(contextToken)) { @@ -37153,11 +37782,11 @@ var ts; } var parent_9 = contextToken.parent, kind = contextToken.kind; if (kind === 21) { - if (parent_9.kind === 164) { + if (parent_9.kind === 166) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 133) { + else if (parent_9.kind === 135) { node = contextToken.parent.left; isRightOfDot = true; } @@ -37165,9 +37794,14 @@ var ts; return undefined; } } - else if (kind === 25 && sourceFile.languageVariant === 1) { - isRightOfOpenTag = true; - location = contextToken; + else if (sourceFile.languageVariant === 1) { + if (kind === 25) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 39 && contextToken.parent.kind === 237) { + isStartingCloseTag = true; + } } } var semanticStart = new Date().getTime(); @@ -37188,6 +37822,12 @@ var ts; isMemberCompletion = true; isNewIdentifierLocation = false; } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + symbols = [typeChecker.getSymbolAtLocation(tagName)]; + isMemberCompletion = true; + isNewIdentifierLocation = false; + } else { if (!tryGetGlobalSymbols()) { return undefined; @@ -37198,7 +37838,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 67 || node.kind === 133 || node.kind === 164) { + if (node.kind === 69 || node.kind === 135 || node.kind === 166) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -37244,7 +37884,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 232) || (jsxContainer.kind === 233)) { + if ((jsxContainer.kind === 234) || (jsxContainer.kind === 235)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -37278,49 +37918,64 @@ var ts; var start = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || isSolelyIdentifierDefinitionLocation(contextToken) || - isDotOfNumericLiteral(contextToken); + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } + function isInJsxText(contextToken) { + if (contextToken.kind === 236) { + return true; + } + if (contextToken.kind === 27 && contextToken.parent) { + if (contextToken.parent.kind === 235) { + return true; + } + if (contextToken.parent.kind === 237 || contextToken.parent.kind === 234) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 233; + } + } + return false; + } function isNewIdentifierDefinitionLocation(previousToken) { if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24: - return containingNodeKind === 166 - || containingNodeKind === 142 - || containingNodeKind === 167 - || containingNodeKind === 162 - || containingNodeKind === 179 - || containingNodeKind === 150; + return containingNodeKind === 168 + || containingNodeKind === 144 + || containingNodeKind === 169 + || containingNodeKind === 164 + || containingNodeKind === 181 + || containingNodeKind === 152; case 17: - return containingNodeKind === 166 - || containingNodeKind === 142 - || containingNodeKind === 167 - || containingNodeKind === 170 - || containingNodeKind === 158; + return containingNodeKind === 168 + || containingNodeKind === 144 + || containingNodeKind === 169 + || containingNodeKind === 172 + || containingNodeKind === 160; case 19: - return containingNodeKind === 162 - || containingNodeKind === 147 - || containingNodeKind === 134; - case 123: - case 124: + return containingNodeKind === 164 + || containingNodeKind === 149 + || containingNodeKind === 136; + case 125: + case 126: return true; case 21: - return containingNodeKind === 216; + return containingNodeKind === 218; case 15: - return containingNodeKind === 212; - case 55: - return containingNodeKind === 209 - || containingNodeKind === 179; + return containingNodeKind === 214; + case 56: + return containingNodeKind === 211 + || containingNodeKind === 181; case 12: - return containingNodeKind === 181; + return containingNodeKind === 183; case 13: - return containingNodeKind === 188; + return containingNodeKind === 190; + case 112: case 110: - case 108: - case 109: - return containingNodeKind === 139; + case 111: + return containingNodeKind === 141; } switch (previousToken.getText()) { case "public": @@ -37351,12 +38006,12 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 163) { + if (objectLikeContainer.kind === 165) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 159) { + else if (objectLikeContainer.kind === 161) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { @@ -37382,9 +38037,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 223 ? - 220 : - 226; + var declarationKind = namedImportsOrExports.kind === 225 ? + 222 : + 228; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -37406,7 +38061,7 @@ var ts; case 15: case 24: var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 163 || parent_10.kind === 159)) { + if (parent_10 && (parent_10.kind === 165 || parent_10.kind === 161)) { return parent_10; } break; @@ -37420,8 +38075,8 @@ var ts; case 15: case 24: switch (contextToken.parent.kind) { - case 223: - case 227: + case 225: + case 229: return contextToken.parent; } } @@ -37433,27 +38088,30 @@ var ts; var parent_11 = contextToken.parent; switch (contextToken.kind) { case 26: - case 38: - case 67: - case 236: - case 237: - if (parent_11 && (parent_11.kind === 232 || parent_11.kind === 233)) { + case 39: + case 69: + case 238: + case 239: + if (parent_11 && (parent_11.kind === 234 || parent_11.kind === 235)) { return parent_11; } + else if (parent_11.kind === 238) { + return parent_11.parent; + } break; case 9: - if (parent_11 && ((parent_11.kind === 236) || (parent_11.kind === 237))) { + if (parent_11 && ((parent_11.kind === 238) || (parent_11.kind === 239))) { return parent_11.parent; } break; case 16: if (parent_11 && - parent_11.kind === 238 && + parent_11.kind === 240 && parent_11.parent && - (parent_11.parent.kind === 236)) { + (parent_11.parent.kind === 238)) { return parent_11.parent.parent; } - if (parent_11 && parent_11.kind === 237) { + if (parent_11 && parent_11.kind === 239) { return parent_11.parent; } break; @@ -37463,16 +38121,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 171: - case 172: - case 211: - case 141: - case 140: + case 173: + case 174: + case 213: case 143: - case 144: + case 142: case 145: case 146: case 147: + case 148: + case 149: return true; } return false; @@ -37481,77 +38139,83 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24: - return containingNodeKind === 209 || - containingNodeKind === 210 || - containingNodeKind === 191 || - containingNodeKind === 215 || - isFunction(containingNodeKind) || + return containingNodeKind === 211 || containingNodeKind === 212 || - containingNodeKind === 184 || - containingNodeKind === 213 || - containingNodeKind === 160 || - containingNodeKind === 214; + containingNodeKind === 193 || + containingNodeKind === 217 || + isFunction(containingNodeKind) || + containingNodeKind === 214 || + containingNodeKind === 186 || + containingNodeKind === 215 || + containingNodeKind === 162 || + containingNodeKind === 216; case 21: - return containingNodeKind === 160; - case 53: - return containingNodeKind === 161; + return containingNodeKind === 162; + case 54: + return containingNodeKind === 163; case 19: - return containingNodeKind === 160; + return containingNodeKind === 162; case 17: - return containingNodeKind === 242 || + return containingNodeKind === 244 || isFunction(containingNodeKind); case 15: - return containingNodeKind === 215 || - containingNodeKind === 213 || - containingNodeKind === 153; + return containingNodeKind === 217 || + containingNodeKind === 215 || + containingNodeKind === 155; case 23: - return containingNodeKind === 138 && + return containingNodeKind === 140 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 213 || - contextToken.parent.parent.kind === 153); + (contextToken.parent.parent.kind === 215 || + contextToken.parent.parent.kind === 155); case 25: - return containingNodeKind === 212 || - containingNodeKind === 184 || - containingNodeKind === 213 || - containingNodeKind === 214 || + return containingNodeKind === 214 || + containingNodeKind === 186 || + containingNodeKind === 215 || + containingNodeKind === 216 || isFunction(containingNodeKind); - case 111: - return containingNodeKind === 139; + case 113: + return containingNodeKind === 141; case 22: - return containingNodeKind === 136 || + return containingNodeKind === 138 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 160); - case 110: - case 108: - case 109: - return containingNodeKind === 136; - case 114: - containingNodeKind === 224 || - containingNodeKind === 228 || - containingNodeKind === 222; - case 71: - case 79: - case 105: - case 85: - case 100: - case 121: - case 127: - case 87: - case 106: - case 72: + contextToken.parent.parent.kind === 162); case 112: - case 130: + case 110: + case 111: + return containingNodeKind === 138; + case 116: + return containingNodeKind === 226 || + containingNodeKind === 230 || + containingNodeKind === 224; + case 73: + case 81: + case 107: + case 87: + case 102: + case 123: + case 129: + case 89: + case 108: + case 74: + case 114: + case 132: return true; } switch (contextToken.getText()) { + case "abstract": + case "async": case "class": - case "interface": + case "const": + case "declare": case "enum": case "function": - case "var": - case "static": + case "interface": case "let": - case "const": + case "private": + case "protected": + case "public": + case "static": + case "var": case "yield": return true; } @@ -37571,8 +38235,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_31 = element.propertyName || element.name; - exisingImportsOrExports[name_31.text] = true; + var name_32 = element.propertyName || element.name; + exisingImportsOrExports[name_32.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -37586,16 +38250,16 @@ var ts; var existingMemberNames = {}; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; - if (m.kind !== 243 && - m.kind !== 244 && - m.kind !== 161) { + if (m.kind !== 245 && + m.kind !== 246 && + m.kind !== 163) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 161 && m.propertyName) { + if (m.kind === 163 && m.propertyName) { existingName = m.propertyName.text; } else { @@ -37612,7 +38276,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 236) { + if (attr.kind === 238) { seenNames[attr.name.text] = true; } } @@ -37626,44 +38290,41 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_32 in nameTable) { - if (!allNames[name_32]) { - allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_33 in nameTable) { + if (!uniqueNames[name_33]) { + uniqueNames[name_33] = name_33; + var displayName = getCompletionEntryDisplayName(name_33, target, true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -37691,25 +38352,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -37745,7 +38405,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 184) ? + return ts.getDeclarationOfKind(symbol, 186) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384) return ScriptElementKind.enumElement; @@ -37841,14 +38501,14 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 164) { + if (location.parent && location.parent.kind === 166) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 166 || location.kind === 167) { + if (location.kind === 168 || location.kind === 169) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -37860,9 +38520,9 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 167 || callExpression.expression.kind === 93; + var useConstructSignatures = callExpression.kind === 169 || callExpression.expression.kind === 95; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); - if (!ts.contains(allSignatures, signature.target || signature)) { + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -37875,7 +38535,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90)); + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -37890,10 +38550,10 @@ var ts; case ScriptElementKind.letElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(ts.punctuationPart(53)); + displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90)); + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536)) { @@ -37908,21 +38568,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 119 && location.parent.kind === 142)) { + (location.kind === 121 && location.parent.kind === 144)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 142 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 144 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 142) { + if (functionDeclaration.kind === 144) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -37931,11 +38591,11 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 184)) { + if (ts.getDeclarationOfKind(symbol, 186)) { pushTypePart(ScriptElementKind.localClassElement); } else { - displayParts.push(ts.keywordPart(71)); + displayParts.push(ts.keywordPart(73)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -37943,37 +38603,37 @@ var ts; } if ((symbolFlags & 64) && (semanticMeaning & 2)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(105)); + displayParts.push(ts.keywordPart(107)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(130)); + displayParts.push(ts.keywordPart(132)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(72)); + displayParts.push(ts.keywordPart(74)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(79)); + displayParts.push(ts.keywordPart(81)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 216); - var isNamespace = declaration && declaration.name && declaration.name.kind === 67; - displayParts.push(ts.keywordPart(isNamespace ? 124 : 123)); + var declaration = ts.getDeclarationOfKind(symbol, 218); + var isNamespace = declaration && declaration.name && declaration.name.kind === 69; + displayParts.push(ts.keywordPart(isNamespace ? 126 : 125)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -37985,7 +38645,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(88)); + displayParts.push(ts.keywordPart(90)); displayParts.push(ts.spacePart()); if (symbol.parent) { addFullSymbolName(symbol.parent, enclosingDeclaration); @@ -37994,20 +38654,20 @@ var ts; else { var container = ts.getContainingFunction(location); if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 146) { - displayParts.push(ts.keywordPart(90)); + if (signatureDeclaration.kind === 148) { + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 145 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 147 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } else { - var declaration = ts.getDeclarationOfKind(symbol, 135).parent; - displayParts.push(ts.keywordPart(130)); + var declaration = ts.getDeclarationOfKind(symbol, 137).parent; + displayParts.push(ts.keywordPart(132)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -38017,11 +38677,11 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 245) { + if (declaration.kind === 247) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -38029,17 +38689,17 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.keywordPart(89)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 219) { + if (declaration.kind === 221) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(125)); + displayParts.push(ts.keywordPart(127)); displayParts.push(ts.punctuationPart(17)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18)); @@ -38048,7 +38708,7 @@ var ts; var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -38064,7 +38724,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(53)); + displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -38162,11 +38822,11 @@ var ts; var symbol = typeChecker.getSymbolAtLocation(node); if (!symbol) { switch (node.kind) { - case 67: - case 164: - case 133: + case 69: + case 166: + case 135: + case 97: case 95: - case 93: var type = typeChecker.getTypeAtLocation(node); if (type) { return { @@ -38215,7 +38875,7 @@ var ts; } return result; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isNewExpressionTarget(location) || location.kind === 119) { + if (isNewExpressionTarget(location) || location.kind === 121) { if (symbol.flags & 32) { for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { var declaration = _a[_i]; @@ -38238,8 +38898,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 142) || - (!selectConstructors && (d.kind === 211 || d.kind === 141 || d.kind === 140))) { + if ((selectConstructors && d.kind === 144) || + (!selectConstructors && (d.kind === 213 || d.kind === 143 || d.kind === 142))) { declarations.push(d); if (d.body) definition = d; @@ -38290,11 +38950,11 @@ var ts; } if (symbol.flags & 8388608) { var declaration = symbol.declarations[0]; - if (node.kind === 67 && node.parent === declaration) { + if (node.kind === 69 && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 244) { + if (node.parent.kind === 246) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -38365,9 +39025,9 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 67 || + if (node.kind === 69 || + node.kind === 97 || node.kind === 95 || - node.kind === 93 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); @@ -38416,77 +39076,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 86: - case 78: - if (hasKind(node.parent, 194)) { + case 88: + case 80: + if (hasKind(node.parent, 196)) { return getIfElseOccurrences(node.parent); } break; - case 92: - if (hasKind(node.parent, 202)) { - return getReturnOccurrences(node.parent); - } - break; - case 96: - if (hasKind(node.parent, 206)) { - return getThrowOccurrences(node.parent); - } - break; - case 70: - if (hasKind(parent(parent(node)), 207)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 98: - case 83: - if (hasKind(parent(node), 207)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; case 94: if (hasKind(node.parent, 204)) { + return getReturnOccurrences(node.parent); + } + break; + case 98: + if (hasKind(node.parent, 208)) { + return getThrowOccurrences(node.parent); + } + break; + case 72: + if (hasKind(parent(parent(node)), 209)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 100: + case 85: + if (hasKind(parent(node), 209)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; + case 96: + if (hasKind(node.parent, 206)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 69: - case 75: - if (hasKind(parent(parent(parent(node))), 204)) { + case 71: + case 77: + if (hasKind(parent(parent(parent(node))), 206)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 68: - case 73: - if (hasKind(node.parent, 201) || hasKind(node.parent, 200)) { + case 70: + case 75: + if (hasKind(node.parent, 203) || hasKind(node.parent, 202)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 84: - if (hasKind(node.parent, 197) || - hasKind(node.parent, 198) || - hasKind(node.parent, 199)) { + case 86: + if (hasKind(node.parent, 199) || + hasKind(node.parent, 200) || + hasKind(node.parent, 201)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 102: - case 77: - if (hasKind(node.parent, 196) || hasKind(node.parent, 195)) { + case 104: + case 79: + if (hasKind(node.parent, 198) || hasKind(node.parent, 197)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 119: - if (hasKind(node.parent, 142)) { - return getConstructorOccurrences(node.parent); - } - break; case 121: - case 127: - if (hasKind(node.parent, 143) || hasKind(node.parent, 144)) { + if (hasKind(node.parent, 144)) { + return getConstructorOccurrences(node.parent); + } + break; + case 123: + case 129: + if (hasKind(node.parent, 145) || hasKind(node.parent, 146)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 191)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 193)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -38498,10 +39158,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 206) { + if (node.kind === 208) { statementAccumulator.push(node); } - else if (node.kind === 207) { + else if (node.kind === 209) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -38523,10 +39183,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246) { + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248) { return parent_12; } - if (parent_12.kind === 207) { + if (parent_12.kind === 209) { var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -38541,7 +39201,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 201 || node.kind === 200) { + if (node.kind === 203 || node.kind === 202) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -38557,15 +39217,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 204: - if (statement.kind === 200) { + case 206: + if (statement.kind === 202) { continue; } - case 197: - case 198: case 199: - case 196: - case 195: + case 200: + case 201: + case 198: + case 197: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -38582,24 +39242,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 212 || - container.kind === 184 || - (declaration.kind === 136 && hasKind(container, 142)))) { - return undefined; - } - } - else if (modifier === 111) { - if (!(container.kind === 212 || container.kind === 184)) { - return undefined; - } - } - else if (modifier === 80 || modifier === 120) { - if (!(container.kind === 217 || container.kind === 246)) { + if (!(container.kind === 214 || + container.kind === 186 || + (declaration.kind === 138 && hasKind(container, 144)))) { return undefined; } } else if (modifier === 113) { - if (!(container.kind === 212 || declaration.kind === 212)) { + if (!(container.kind === 214 || container.kind === 186)) { + return undefined; + } + } + else if (modifier === 82 || modifier === 122) { + if (!(container.kind === 219 || container.kind === 248)) { + return undefined; + } + } + else if (modifier === 115) { + if (!(container.kind === 214 || declaration.kind === 214)) { return undefined; } } @@ -38610,8 +39270,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 217: - case 246: + case 219: + case 248: if (modifierFlag & 256) { nodes = declaration.members.concat(declaration); } @@ -38619,15 +39279,15 @@ var ts; nodes = container.statements; } break; - case 142: + case 144: nodes = container.parameters.concat(container.parent.members); break; - case 212: - case 184: + case 214: + case 186: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 142 && member; + return member.kind === 144 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -38648,19 +39308,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 110: + case 112: return 16; - case 108: + case 110: return 32; - case 109: - return 64; case 111: - return 128; - case 80: - return 1; - case 120: - return 2; + return 64; case 113: + return 128; + case 82: + return 1; + case 122: + return 2; + case 115: return 256; default: ts.Debug.fail(); @@ -38680,13 +39340,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 143); - tryPushAccessorKeyword(accessorDeclaration.symbol, 144); + tryPushAccessorKeyword(accessorDeclaration.symbol, 145); + tryPushAccessorKeyword(accessorDeclaration.symbol, 146); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121, 127); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 129); }); } } } @@ -38695,18 +39355,18 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 119); + return pushKeywordIf(keywords, token, 121); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84, 102, 77)) { - if (loopNode.kind === 195) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) { + if (loopNode.kind === 197) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 102)) { + if (pushKeywordIf(keywords, loopTokens[i], 104)) { break; } } @@ -38715,7 +39375,7 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68, 73); + pushKeywordIf(keywords, statement.getFirstToken(), 70, 75); } }); return ts.map(keywords, getHighlightSpanForNode); @@ -38724,13 +39384,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { + case 199: + case 200: + case 201: case 197: case 198: - case 199: - case 195: - case 196: return getLoopBreakContinueOccurrences(owner); - case 204: + case 206: return getSwitchCaseDefaultOccurrences(owner); } } @@ -38738,13 +39398,13 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 94); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 96); ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 69, 75); + pushKeywordIf(keywords, clause.getFirstToken(), 71, 77); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68); + pushKeywordIf(keywords, statement.getFirstToken(), 70); } }); }); @@ -38752,13 +39412,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 98); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 100); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 83); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 85); } return ts.map(keywords, getHighlightSpanForNode); } @@ -38769,50 +39429,50 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); }); if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); }); } return ts.map(keywords, getHighlightSpanForNode); } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 190))) { + if (!(func && hasKind(func.body, 192))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); }); ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 194) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 196) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 86); + pushKeywordIf(keywords, children[0], 88); for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 78)) { + if (pushKeywordIf(keywords, children[i], 80)) { break; } } - if (!hasKind(ifStatement.elseStatement, 194)) { + if (!hasKind(ifStatement.elseStatement, 196)) { break; } ifStatement = ifStatement.elseStatement; } var result = []; for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 78 && i < keywords.length - 1) { + if (keywords[i].kind === 80 && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; var shouldCombindElseAndIf = true; @@ -38890,12 +39550,12 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 67 && + if (node.kind !== 69 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 67 || node.kind === 8 || node.kind === 9); + ts.Debug.assert(node.kind === 69 || node.kind === 8 || node.kind === 9); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -38909,10 +39569,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 95) { + if (node.kind === 97) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 93) { + if (node.kind === 95) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -38963,7 +39623,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 224 || declaration.kind === 228; + return declaration.kind === 226 || declaration.kind === 230; }); } function getInternedName(symbol, location, declarations) { @@ -38976,13 +39636,13 @@ var ts; } function getSymbolScope(symbol) { var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 171 || valueDeclaration.kind === 184)) { + if (valueDeclaration && (valueDeclaration.kind === 173 || valueDeclaration.kind === 186)) { return valueDeclaration; } if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 212); + return ts.getAncestor(privateDeclaration, 214); } } if (symbol.flags & 8388608) { @@ -39003,7 +39663,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 246 && !ts.isExternalModule(container)) { + if (container.kind === 248 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -39062,7 +39722,7 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { if (node) { switch (node.kind) { - case 67: + case 69: return node.getWidth() === searchSymbolName.length; case 9: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || @@ -39150,13 +39810,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 139: - case 138: case 141: case 140: - case 142: case 143: + case 142: case 144: + case 145: + case 146: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -39169,7 +39829,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 93) { + if (!node || node.kind !== 95) { return; } var container = ts.getSuperContainer(node, false); @@ -39184,32 +39844,32 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { - case 141: - case 140: + case 143: + case 142: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - case 139: - case 138: - case 142: - case 143: + case 141: + case 140: case 144: + case 145: + case 146: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 246: + case 248: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 211: - case 171: + case 213: + case 173: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 246) { + if (searchSpaceNode.kind === 248) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -39235,31 +39895,31 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 95) { + if (!node || node.kind !== 97) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 171: - case 211: + case 173: + case 213: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 141: - case 140: + case 143: + case 142: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 184: - case 212: + case 186: + case 214: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 246: - if (container.kind === 246 && !ts.isExternalModule(container)) { + case 248: + if (container.kind === 248 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -39294,11 +39954,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 212) { + if (declaration.kind === 214) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 213) { + else if (declaration.kind === 215) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -39348,17 +40008,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_33 = node.text; + var name_34 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_33); + var unionProperty = contextualType.getProperty(name_34); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_33); + var symbol = t.getProperty(name_34); if (symbol) { result_4.push(symbol); } @@ -39367,7 +40027,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_33); + var symbol_1 = contextualType.getProperty(name_34); if (symbol_1) { return [symbol_1]; } @@ -39407,17 +40067,17 @@ var ts; }; } function isWriteAccess(node) { - if (node.kind === 67 && ts.isDeclarationName(node)) { + if (node.kind === 69 && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 178 || parent.kind === 177) { + if (parent.kind === 180 || parent.kind === 179) { return true; } - else if (parent.kind === 179 && parent.left === node) { + else if (parent.kind === 181 && parent.left === node) { var operator = parent.operatorToken.kind; - return 55 <= operator && operator <= 66; + return 56 <= operator && operator <= 68; } } return false; @@ -39448,33 +40108,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 136: - case 209: - case 161: - case 139: case 138: - case 243: - case 244: - case 245: + case 211: + case 163: case 141: case 140: - case 142: + case 245: + case 246: + case 247: case 143: + case 142: case 144: - case 211: - case 171: - case 172: - case 242: - return 1; - case 135: + case 145: + case 146: case 213: - case 214: - case 153: - return 2; - case 212: + case 173: + case 174: + case 244: + return 1; + case 137: case 215: - return 1 | 2; case 216: + case 155: + return 2; + case 214: + case 217: + return 1 | 2; + case 218: if (node.name.kind === 9) { return 4 | 1; } @@ -39484,14 +40144,14 @@ var ts; else { return 4; } - case 223: - case 224: - case 219: - case 220: case 225: case 226: + case 221: + case 222: + case 227: + case 228: return 1 | 2 | 4; - case 246: + case 248: return 4 | 1; } return 1 | 2 | 4; @@ -39501,8 +40161,9 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 149 || - (node.parent.kind === 186 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 151 || + (node.parent.kind === 188 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + node.kind === 97 && !ts.isExpression(node); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -39510,47 +40171,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 164) { - while (root.parent && root.parent.kind === 164) { + if (root.parent.kind === 166) { + while (root.parent && root.parent.kind === 166) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 186 && root.parent.parent.kind === 241) { + if (!isLastClause && root.parent.kind === 188 && root.parent.parent.kind === 243) { var decl = root.parent.parent.parent; - return (decl.kind === 212 && root.parent.parent.token === 104) || - (decl.kind === 213 && root.parent.parent.token === 81); + return (decl.kind === 214 && root.parent.parent.token === 106) || + (decl.kind === 215 && root.parent.parent.token === 83); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 133) { - while (root.parent && root.parent.kind === 133) { + if (root.parent.kind === 135) { + while (root.parent && root.parent.kind === 135) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 149 && !isLastClause; + return root.parent.kind === 151 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 133) { + while (node.parent.kind === 135) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 67); - if (node.parent.kind === 133 && + ts.Debug.assert(node.kind === 69); + if (node.parent.kind === 135 && node.parent.right === node && - node.parent.parent.kind === 219) { + node.parent.parent.kind === 221) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 225) { + if (node.parent.kind === 227) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -39584,15 +40245,15 @@ var ts; return; } switch (node.kind) { - case 164: - case 133: + case 166: + case 135: case 9: - case 82: - case 97: - case 91: + case 84: + case 99: case 93: case 95: - case 67: + case 97: + case 69: break; default: return; @@ -39603,7 +40264,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 216 && + if (nodeForStartPos.parent.parent.kind === 218 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -39630,10 +40291,10 @@ var ts; } function checkForClassificationCancellation(kind) { switch (kind) { - case 216: - case 212: + case 218: + case 214: + case 215: case 213: - case 211: cancellationToken.throwIfCancellationRequested(); } } @@ -39681,7 +40342,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 216 && + return declaration.kind === 218 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -39690,7 +40351,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 67 && !ts.nodeIsMissing(node)) { + if (kind === 69 && !ts.nodeIsMissing(node)) { var identifier = node; if (classifiableNames[identifier.text]) { var symbol = typeChecker.getSymbolAtLocation(node); @@ -39814,16 +40475,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 265: + case 267: processJSDocParameterTag(tag); break; - case 268: + case 270: processJSDocTemplateTag(tag); break; - case 267: + case 269: processElement(tag.typeExpression); break; - case 266: + case 268: processElement(tag.typeExpression); break; } @@ -39903,17 +40564,17 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 55) { - if (token.parent.kind === 209 || - token.parent.kind === 139 || - token.parent.kind === 136) { + if (tokenKind === 56) { + if (token.parent.kind === 211 || + token.parent.kind === 141 || + token.parent.kind === 138) { return 5; } } - if (token.parent.kind === 179 || - token.parent.kind === 177 || - token.parent.kind === 178 || - token.parent.kind === 180) { + if (token.parent.kind === 181 || + token.parent.kind === 179 || + token.parent.kind === 180 || + token.parent.kind === 182) { return 5; } } @@ -39931,35 +40592,35 @@ var ts; else if (ts.isTemplateLiteralKind(tokenKind)) { return 6; } - else if (tokenKind === 67) { + else if (tokenKind === 69) { if (token) { switch (token.parent.kind) { - case 212: + case 214: if (token.parent.name === token) { return 11; } return; - case 135: + case 137: if (token.parent.name === token) { return 15; } return; - case 213: + case 215: if (token.parent.name === token) { return 13; } return; - case 215: + case 217: if (token.parent.name === token) { return 12; } return; - case 216: + case 218: if (token.parent.name === token) { return 14; } return; - case 136: + case 138: if (token.parent.name === token) { return 17; } @@ -40073,19 +40734,40 @@ var ts; if (!tokenAtPos || tokenStart < position) { return undefined; } - var containingFunction = ts.getAncestor(tokenAtPos, 211); - if (!containingFunction || containingFunction.getStart() < position) { + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 213: + case 143: + case 144: + case 214: + case 193: + break findOwner; + case 248: + return undefined; + case 218: + if (commentOwner.parent.kind === 218) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { return undefined; } - var parameters = containingFunction.parameters; + var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; - var docParams = parameters.reduce(function (prev, cur, index) { - return prev + - indentationStr + " * @param " + (cur.name.kind === 67 ? cur.name.text : "param" + index) + newLine; - }, ""); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 69 ? + currentName.text : + "param" + i; + docParams += indentationStr + " * @param " + paramName + newLine; + } var preamble = "/**" + newLine + indentationStr + " * "; var result = preamble + newLine + @@ -40094,6 +40776,38 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 193) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return emptyArray; + } + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 172) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 173: + case 174: + return rightHandSide.parameters; + case 186: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 144) { + return member.parameters; + } + } + break; + } + return emptyArray; + } function getTodoComments(fileName, descriptors) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -40158,7 +40872,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); - if (node && node.kind === 67) { + if (node && node.kind === 69) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var declarations = symbol.getDeclarations(); @@ -40256,13 +40970,13 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 67: + case 69: nameTable[node.text] = node.text; break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 230 || + node.parent.kind === 232 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -40275,31 +40989,31 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 165 && + node.parent.kind === 167 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); var noRegexTable = []; - noRegexTable[67] = true; + noRegexTable[69] = true; noRegexTable[9] = true; noRegexTable[8] = true; noRegexTable[10] = true; - noRegexTable[95] = true; - noRegexTable[40] = true; + noRegexTable[97] = true; noRegexTable[41] = true; + noRegexTable[42] = true; noRegexTable[18] = true; noRegexTable[20] = true; noRegexTable[16] = true; - noRegexTable[97] = true; - noRegexTable[82] = true; + noRegexTable[99] = true; + noRegexTable[84] = true; var templateStack = []; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 121 || - keyword2 === 127 || - keyword2 === 119 || - keyword2 === 111) { + if (keyword2 === 123 || + keyword2 === 129 || + keyword2 === 121 || + keyword2 === 113) { return true; } return false; @@ -40394,31 +41108,31 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 38 || token === 59) && !noRegexTable[lastNonTriviaToken]) { + if ((token === 39 || token === 61) && !noRegexTable[lastNonTriviaToken]) { if (scanner.reScanSlashToken() === 10) { token = 10; } } else if (lastNonTriviaToken === 21 && isKeyword(token)) { - token = 67; + token = 69; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - token = 67; + token = 69; } - else if (lastNonTriviaToken === 67 && + else if (lastNonTriviaToken === 69 && token === 25) { angleBracketStack++; } else if (token === 27 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 115 || + else if (token === 117 || + token === 130 || token === 128 || - token === 126 || - token === 118 || - token === 129) { + token === 120 || + token === 131) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - token = 67; + token = 69; } } else if (token === 12) { @@ -40516,40 +41230,41 @@ var ts; function isBinaryExpressionOperatorToken(token) { switch (token) { case 37: - case 38: case 39: + case 40: case 35: case 36: - case 42: case 43: case 44: + case 45: case 25: case 27: case 28: case 29: - case 89: - case 88: + case 91: + case 90: + case 116: case 30: case 31: case 32: case 33: - case 45: - case 47: case 46: - case 50: + case 48: + case 47: case 51: - case 65: - case 64: + case 52: + case 67: case 66: - case 61: - case 62: + case 68: case 63: - case 56: + case 64: + case 65: case 57: case 58: case 59: - case 60: - case 55: + case 61: + case 62: + case 56: case 24: return true; default: @@ -40560,17 +41275,17 @@ var ts; switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 40: case 41: + case 42: return true; default: return false; } } function isKeyword(token) { - return token >= 68 && token <= 132; + return token >= 70 && token <= 134; } function classFromKind(token) { if (isKeyword(token)) { @@ -40579,7 +41294,7 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5; } - else if (token >= 15 && token <= 66) { + else if (token >= 15 && token <= 68) { return 10; } switch (token) { @@ -40596,7 +41311,7 @@ var ts; case 5: case 4: return 8; - case 67: + case 69: default: if (ts.isTemplateLiteralKind(token)) { return 6; @@ -40622,7 +41337,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 246 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 248 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -40654,6 +41369,22 @@ var ts; return spaceCache[n]; } server.generateSpaces = generateSpaces; + function generateIndentString(n, editorOptions) { + if (editorOptions.ConvertTabsToSpaces) { + return generateSpaces(n); + } + else { + var result = ""; + for (var i = 0; i < Math.floor(n / editorOptions.TabSize); i++) { + result += "\t"; + } + for (var i = 0; i < n % editorOptions.TabSize; i++) { + result += " "; + } + return result; + } + } + server.generateIndentString = generateIndentString; function compareNumber(a, b) { if (a < b) { return -1; @@ -41265,28 +41996,27 @@ var ts; IndentSize: formatOptions.IndentSize, TabSize: formatOptions.TabSize, NewLineCharacter: "\n", - ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces + ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, + IndentStyle: ts.IndentStyle.Smart }; - var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var hasIndent = 0; for (var i = 0, len = lineText.length; i < len; i++) { if (lineText.charAt(i) == " ") { - indentPosition--; + hasIndent++; } else if (lineText.charAt(i) == "\t") { - indentPosition -= editorOptions.IndentSize; + hasIndent += editorOptions.TabSize; } else { break; } } - if (indentPosition > 0) { - var spaces = generateSpaces(indentPosition); - edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); - } - else if (indentPosition < 0) { + if (preferredIndent !== hasIndent) { + var firstNoWhiteSpacePosition = lineInfo.offset + i; edits.push({ - span: ts.createTextSpanFromBounds(position, position - indentPosition), - newText: "" + span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), + newText: generateIndentString(preferredIndent, editorOptions) }); } } @@ -41870,6 +42600,9 @@ var ts; this.filenameToSourceFile = {}; this.updateGraphSeq = 0; this.openRefCount = 0; + if (projectOptions && projectOptions.files) { + projectOptions.compilerOptions.allowNonTsExtensions = true; + } this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions); } Project.prototype.addOpenRef = function () { @@ -41939,6 +42672,7 @@ var ts; Project.prototype.setProjectOptions = function (projectOptions) { this.projectOptions = projectOptions; if (projectOptions.compilerOptions) { + projectOptions.compilerOptions.allowNonTsExtensions = true; this.compilerService.setCompilerOptions(projectOptions.compilerOptions); } }; @@ -42524,7 +43258,9 @@ var ts; this.setCompilerOptions(opt); } else { - this.setCompilerOptions(ts.getDefaultCompilerOptions()); + var defaultOpts = ts.getDefaultCompilerOptions(); + defaultOpts.allowNonTsExtensions = true; + this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); this.classifier = ts.createClassifier(); @@ -42542,6 +43278,7 @@ var ts; TabSize: 4, NewLineCharacter: ts.sys ? ts.sys.newLine : '\n', ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, InsertSpaceAfterCommaDelimiter: true, InsertSpaceAfterSemicolonInForStatements: true, InsertSpaceBeforeAndAfterBinaryOperators: true, @@ -43485,11 +44222,11 @@ var ts; } fs.stat(watchedFile.fileName, function (err, stats) { if (err) { - watchedFile.callback(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, false); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); }; @@ -44135,7 +44872,7 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); var convertResult = { referencedFiles: [], importedFiles: [], diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 2cd3a663fce..abfa9a002b5 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -68,253 +68,255 @@ declare namespace ts { PlusToken = 35, MinusToken = 36, AsteriskToken = 37, - SlashToken = 38, - PercentToken = 39, - PlusPlusToken = 40, - MinusMinusToken = 41, - LessThanLessThanToken = 42, - GreaterThanGreaterThanToken = 43, - GreaterThanGreaterThanGreaterThanToken = 44, - AmpersandToken = 45, - BarToken = 46, - CaretToken = 47, - ExclamationToken = 48, - TildeToken = 49, - AmpersandAmpersandToken = 50, - BarBarToken = 51, - QuestionToken = 52, - ColonToken = 53, - AtToken = 54, - EqualsToken = 55, - PlusEqualsToken = 56, - MinusEqualsToken = 57, - AsteriskEqualsToken = 58, - SlashEqualsToken = 59, - PercentEqualsToken = 60, - LessThanLessThanEqualsToken = 61, - GreaterThanGreaterThanEqualsToken = 62, - GreaterThanGreaterThanGreaterThanEqualsToken = 63, - AmpersandEqualsToken = 64, - BarEqualsToken = 65, - CaretEqualsToken = 66, - Identifier = 67, - BreakKeyword = 68, - CaseKeyword = 69, - CatchKeyword = 70, - ClassKeyword = 71, - ConstKeyword = 72, - ContinueKeyword = 73, - DebuggerKeyword = 74, - DefaultKeyword = 75, - DeleteKeyword = 76, - DoKeyword = 77, - ElseKeyword = 78, - EnumKeyword = 79, - ExportKeyword = 80, - ExtendsKeyword = 81, - FalseKeyword = 82, - FinallyKeyword = 83, - ForKeyword = 84, - FunctionKeyword = 85, - IfKeyword = 86, - ImportKeyword = 87, - InKeyword = 88, - InstanceOfKeyword = 89, - NewKeyword = 90, - NullKeyword = 91, - ReturnKeyword = 92, - SuperKeyword = 93, - SwitchKeyword = 94, - ThisKeyword = 95, - ThrowKeyword = 96, - TrueKeyword = 97, - TryKeyword = 98, - TypeOfKeyword = 99, - VarKeyword = 100, - VoidKeyword = 101, - WhileKeyword = 102, - WithKeyword = 103, - ImplementsKeyword = 104, - InterfaceKeyword = 105, - LetKeyword = 106, - PackageKeyword = 107, - PrivateKeyword = 108, - ProtectedKeyword = 109, - PublicKeyword = 110, - StaticKeyword = 111, - YieldKeyword = 112, - AbstractKeyword = 113, - AsKeyword = 114, - AnyKeyword = 115, - AsyncKeyword = 116, - AwaitKeyword = 117, - BooleanKeyword = 118, - ConstructorKeyword = 119, - DeclareKeyword = 120, - GetKeyword = 121, - IsKeyword = 122, - ModuleKeyword = 123, - NamespaceKeyword = 124, - RequireKeyword = 125, - NumberKeyword = 126, - SetKeyword = 127, - StringKeyword = 128, - SymbolKeyword = 129, - TypeKeyword = 130, - FromKeyword = 131, - OfKeyword = 132, - QualifiedName = 133, - ComputedPropertyName = 134, - TypeParameter = 135, - Parameter = 136, - Decorator = 137, - PropertySignature = 138, - PropertyDeclaration = 139, - MethodSignature = 140, - MethodDeclaration = 141, - Constructor = 142, - GetAccessor = 143, - SetAccessor = 144, - CallSignature = 145, - ConstructSignature = 146, - IndexSignature = 147, - TypePredicate = 148, - TypeReference = 149, - FunctionType = 150, - ConstructorType = 151, - TypeQuery = 152, - TypeLiteral = 153, - ArrayType = 154, - TupleType = 155, - UnionType = 156, - IntersectionType = 157, - ParenthesizedType = 158, - ObjectBindingPattern = 159, - ArrayBindingPattern = 160, - BindingElement = 161, - ArrayLiteralExpression = 162, - ObjectLiteralExpression = 163, - PropertyAccessExpression = 164, - ElementAccessExpression = 165, - CallExpression = 166, - NewExpression = 167, - TaggedTemplateExpression = 168, - TypeAssertionExpression = 169, - ParenthesizedExpression = 170, - FunctionExpression = 171, - ArrowFunction = 172, - DeleteExpression = 173, - TypeOfExpression = 174, - VoidExpression = 175, - AwaitExpression = 176, - PrefixUnaryExpression = 177, - PostfixUnaryExpression = 178, - BinaryExpression = 179, - ConditionalExpression = 180, - TemplateExpression = 181, - YieldExpression = 182, - SpreadElementExpression = 183, - ClassExpression = 184, - OmittedExpression = 185, - ExpressionWithTypeArguments = 186, - AsExpression = 187, - TemplateSpan = 188, - SemicolonClassElement = 189, - Block = 190, - VariableStatement = 191, - EmptyStatement = 192, - ExpressionStatement = 193, - IfStatement = 194, - DoStatement = 195, - WhileStatement = 196, - ForStatement = 197, - ForInStatement = 198, - ForOfStatement = 199, - ContinueStatement = 200, - BreakStatement = 201, - ReturnStatement = 202, - WithStatement = 203, - SwitchStatement = 204, - LabeledStatement = 205, - ThrowStatement = 206, - TryStatement = 207, - DebuggerStatement = 208, - VariableDeclaration = 209, - VariableDeclarationList = 210, - FunctionDeclaration = 211, - ClassDeclaration = 212, - InterfaceDeclaration = 213, - TypeAliasDeclaration = 214, - EnumDeclaration = 215, - ModuleDeclaration = 216, - ModuleBlock = 217, - CaseBlock = 218, - ImportEqualsDeclaration = 219, - ImportDeclaration = 220, - ImportClause = 221, - NamespaceImport = 222, - NamedImports = 223, - ImportSpecifier = 224, - ExportAssignment = 225, - ExportDeclaration = 226, - NamedExports = 227, - ExportSpecifier = 228, - MissingDeclaration = 229, - ExternalModuleReference = 230, - JsxElement = 231, - JsxSelfClosingElement = 232, - JsxOpeningElement = 233, - JsxText = 234, - JsxClosingElement = 235, - JsxAttribute = 236, - JsxSpreadAttribute = 237, - JsxExpression = 238, - CaseClause = 239, - DefaultClause = 240, - HeritageClause = 241, - CatchClause = 242, - PropertyAssignment = 243, - ShorthandPropertyAssignment = 244, - EnumMember = 245, - SourceFile = 246, - JSDocTypeExpression = 247, - JSDocAllType = 248, - JSDocUnknownType = 249, - JSDocArrayType = 250, - JSDocUnionType = 251, - JSDocTupleType = 252, - JSDocNullableType = 253, - JSDocNonNullableType = 254, - JSDocRecordType = 255, - JSDocRecordMember = 256, - JSDocTypeReference = 257, - JSDocOptionalType = 258, - JSDocFunctionType = 259, - JSDocVariadicType = 260, - JSDocConstructorType = 261, - JSDocThisType = 262, - JSDocComment = 263, - JSDocTag = 264, - JSDocParameterTag = 265, - JSDocReturnTag = 266, - JSDocTypeTag = 267, - JSDocTemplateTag = 268, - SyntaxList = 269, - Count = 270, - FirstAssignment = 55, - LastAssignment = 66, - FirstReservedWord = 68, - LastReservedWord = 103, - FirstKeyword = 68, - LastKeyword = 132, - FirstFutureReservedWord = 104, - LastFutureReservedWord = 112, - FirstTypeNode = 149, - LastTypeNode = 158, + AsteriskAsteriskToken = 38, + SlashToken = 39, + PercentToken = 40, + PlusPlusToken = 41, + MinusMinusToken = 42, + LessThanLessThanToken = 43, + GreaterThanGreaterThanToken = 44, + GreaterThanGreaterThanGreaterThanToken = 45, + AmpersandToken = 46, + BarToken = 47, + CaretToken = 48, + ExclamationToken = 49, + TildeToken = 50, + AmpersandAmpersandToken = 51, + BarBarToken = 52, + QuestionToken = 53, + ColonToken = 54, + AtToken = 55, + EqualsToken = 56, + PlusEqualsToken = 57, + MinusEqualsToken = 58, + AsteriskEqualsToken = 59, + AsteriskAsteriskEqualsToken = 60, + SlashEqualsToken = 61, + PercentEqualsToken = 62, + LessThanLessThanEqualsToken = 63, + GreaterThanGreaterThanEqualsToken = 64, + GreaterThanGreaterThanGreaterThanEqualsToken = 65, + AmpersandEqualsToken = 66, + BarEqualsToken = 67, + CaretEqualsToken = 68, + Identifier = 69, + BreakKeyword = 70, + CaseKeyword = 71, + CatchKeyword = 72, + ClassKeyword = 73, + ConstKeyword = 74, + ContinueKeyword = 75, + DebuggerKeyword = 76, + DefaultKeyword = 77, + DeleteKeyword = 78, + DoKeyword = 79, + ElseKeyword = 80, + EnumKeyword = 81, + ExportKeyword = 82, + ExtendsKeyword = 83, + FalseKeyword = 84, + FinallyKeyword = 85, + ForKeyword = 86, + FunctionKeyword = 87, + IfKeyword = 88, + ImportKeyword = 89, + InKeyword = 90, + InstanceOfKeyword = 91, + NewKeyword = 92, + NullKeyword = 93, + ReturnKeyword = 94, + SuperKeyword = 95, + SwitchKeyword = 96, + ThisKeyword = 97, + ThrowKeyword = 98, + TrueKeyword = 99, + TryKeyword = 100, + TypeOfKeyword = 101, + VarKeyword = 102, + VoidKeyword = 103, + WhileKeyword = 104, + WithKeyword = 105, + ImplementsKeyword = 106, + InterfaceKeyword = 107, + LetKeyword = 108, + PackageKeyword = 109, + PrivateKeyword = 110, + ProtectedKeyword = 111, + PublicKeyword = 112, + StaticKeyword = 113, + YieldKeyword = 114, + AbstractKeyword = 115, + AsKeyword = 116, + AnyKeyword = 117, + AsyncKeyword = 118, + AwaitKeyword = 119, + BooleanKeyword = 120, + ConstructorKeyword = 121, + DeclareKeyword = 122, + GetKeyword = 123, + IsKeyword = 124, + ModuleKeyword = 125, + NamespaceKeyword = 126, + RequireKeyword = 127, + NumberKeyword = 128, + SetKeyword = 129, + StringKeyword = 130, + SymbolKeyword = 131, + TypeKeyword = 132, + FromKeyword = 133, + OfKeyword = 134, + QualifiedName = 135, + ComputedPropertyName = 136, + TypeParameter = 137, + Parameter = 138, + Decorator = 139, + PropertySignature = 140, + PropertyDeclaration = 141, + MethodSignature = 142, + MethodDeclaration = 143, + Constructor = 144, + GetAccessor = 145, + SetAccessor = 146, + CallSignature = 147, + ConstructSignature = 148, + IndexSignature = 149, + TypePredicate = 150, + TypeReference = 151, + FunctionType = 152, + ConstructorType = 153, + TypeQuery = 154, + TypeLiteral = 155, + ArrayType = 156, + TupleType = 157, + UnionType = 158, + IntersectionType = 159, + ParenthesizedType = 160, + ObjectBindingPattern = 161, + ArrayBindingPattern = 162, + BindingElement = 163, + ArrayLiteralExpression = 164, + ObjectLiteralExpression = 165, + PropertyAccessExpression = 166, + ElementAccessExpression = 167, + CallExpression = 168, + NewExpression = 169, + TaggedTemplateExpression = 170, + TypeAssertionExpression = 171, + ParenthesizedExpression = 172, + FunctionExpression = 173, + ArrowFunction = 174, + DeleteExpression = 175, + TypeOfExpression = 176, + VoidExpression = 177, + AwaitExpression = 178, + PrefixUnaryExpression = 179, + PostfixUnaryExpression = 180, + BinaryExpression = 181, + ConditionalExpression = 182, + TemplateExpression = 183, + YieldExpression = 184, + SpreadElementExpression = 185, + ClassExpression = 186, + OmittedExpression = 187, + ExpressionWithTypeArguments = 188, + AsExpression = 189, + TemplateSpan = 190, + SemicolonClassElement = 191, + Block = 192, + VariableStatement = 193, + EmptyStatement = 194, + ExpressionStatement = 195, + IfStatement = 196, + DoStatement = 197, + WhileStatement = 198, + ForStatement = 199, + ForInStatement = 200, + ForOfStatement = 201, + ContinueStatement = 202, + BreakStatement = 203, + ReturnStatement = 204, + WithStatement = 205, + SwitchStatement = 206, + LabeledStatement = 207, + ThrowStatement = 208, + TryStatement = 209, + DebuggerStatement = 210, + VariableDeclaration = 211, + VariableDeclarationList = 212, + FunctionDeclaration = 213, + ClassDeclaration = 214, + InterfaceDeclaration = 215, + TypeAliasDeclaration = 216, + EnumDeclaration = 217, + ModuleDeclaration = 218, + ModuleBlock = 219, + CaseBlock = 220, + ImportEqualsDeclaration = 221, + ImportDeclaration = 222, + ImportClause = 223, + NamespaceImport = 224, + NamedImports = 225, + ImportSpecifier = 226, + ExportAssignment = 227, + ExportDeclaration = 228, + NamedExports = 229, + ExportSpecifier = 230, + MissingDeclaration = 231, + ExternalModuleReference = 232, + JsxElement = 233, + JsxSelfClosingElement = 234, + JsxOpeningElement = 235, + JsxText = 236, + JsxClosingElement = 237, + JsxAttribute = 238, + JsxSpreadAttribute = 239, + JsxExpression = 240, + CaseClause = 241, + DefaultClause = 242, + HeritageClause = 243, + CatchClause = 244, + PropertyAssignment = 245, + ShorthandPropertyAssignment = 246, + EnumMember = 247, + SourceFile = 248, + JSDocTypeExpression = 249, + JSDocAllType = 250, + JSDocUnknownType = 251, + JSDocArrayType = 252, + JSDocUnionType = 253, + JSDocTupleType = 254, + JSDocNullableType = 255, + JSDocNonNullableType = 256, + JSDocRecordType = 257, + JSDocRecordMember = 258, + JSDocTypeReference = 259, + JSDocOptionalType = 260, + JSDocFunctionType = 261, + JSDocVariadicType = 262, + JSDocConstructorType = 263, + JSDocThisType = 264, + JSDocComment = 265, + JSDocTag = 266, + JSDocParameterTag = 267, + JSDocReturnTag = 268, + JSDocTypeTag = 269, + JSDocTemplateTag = 270, + SyntaxList = 271, + Count = 272, + FirstAssignment = 56, + LastAssignment = 68, + FirstReservedWord = 70, + LastReservedWord = 105, + FirstKeyword = 70, + LastKeyword = 134, + FirstFutureReservedWord = 106, + LastFutureReservedWord = 114, + FirstTypeNode = 151, + LastTypeNode = 160, FirstPunctuation = 15, - LastPunctuation = 66, + LastPunctuation = 68, FirstToken = 0, - LastToken = 132, + LastToken = 134, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -322,8 +324,8 @@ declare namespace ts { FirstTemplateToken = 11, LastTemplateToken = 14, FirstBinaryOperator = 25, - LastBinaryOperator = 66, - FirstNode = 133, + LastBinaryOperator = 68, + FirstNode = 135, } const enum NodeFlags { Export = 1, @@ -343,6 +345,7 @@ declare namespace ts { OctalLiteral = 65536, Namespace = 131072, ExportContext = 262144, + ContainsThis = 524288, Modifier = 2035, AccessibilityModifier = 112, BlockScoped = 49152, @@ -438,6 +441,8 @@ declare namespace ts { interface ShorthandPropertyAssignment extends ObjectLiteralElement { name: Identifier; questionToken?: Node; + equalsToken?: Node; + objectAssignmentInitializer?: Expression; } interface VariableLikeDeclaration extends Declaration { propertyName?: Identifier; @@ -530,18 +535,21 @@ declare namespace ts { interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } - interface PrefixUnaryExpression extends UnaryExpression { + interface IncrementExpression extends UnaryExpression { + _incrementExpressionBrand: any; + } + interface PrefixUnaryExpression extends IncrementExpression { operator: SyntaxKind; operand: UnaryExpression; } - interface PostfixUnaryExpression extends PostfixExpression { + interface PostfixUnaryExpression extends IncrementExpression { operand: LeftHandSideExpression; operator: SyntaxKind; } interface PostfixExpression extends UnaryExpression { _postfixExpressionBrand: any; } - interface LeftHandSideExpression extends PostfixExpression { + interface LeftHandSideExpression extends IncrementExpression { _leftHandSideExpressionBrand: any; } interface MemberExpression extends LeftHandSideExpression { @@ -566,7 +574,7 @@ declare namespace ts { asteriskToken?: Node; expression?: Expression; } - interface BinaryExpression extends Expression { + interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -610,7 +618,7 @@ declare namespace ts { interface ObjectLiteralExpression extends PrimaryExpression, Declaration { properties: NodeArray; } - interface PropertyAccessExpression extends MemberExpression { + interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; dotToken: Node; name: Identifier; @@ -1082,6 +1090,7 @@ declare namespace ts { decreaseIndent(): void; clear(): void; trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + reportInaccessibleThisError(): void; } const enum TypeFormatFlags { None = 0, @@ -1202,6 +1211,7 @@ declare namespace ts { Instantiated = 131072, ObjectLiteral = 524288, ESSymbol = 16777216, + ThisType = 33554432, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1223,6 +1233,7 @@ declare namespace ts { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; + thisType: TypeParameter; } interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; @@ -1337,7 +1348,6 @@ declare namespace ts { watch?: boolean; isolatedModules?: boolean; experimentalDecorators?: boolean; - experimentalAsyncFunctions?: boolean; emitDecoratorMetadata?: boolean; moduleResolution?: ModuleResolutionKind; [option: string]: string | number | boolean; @@ -1348,6 +1358,7 @@ declare namespace ts { AMD = 2, UMD = 3, System = 4, + ES6 = 5, } const enum JsxEmit { None = 0, @@ -1417,7 +1428,7 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: (path: string) => void): FileWatcher; + watchFile?(path: string, callback: (path: string, removed: boolean) => void): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; directoryExists(path: string): boolean; @@ -1775,6 +1786,12 @@ declare namespace ts { TabSize: number; NewLineCharacter: string; ConvertTabsToSpaces: boolean; + IndentStyle: IndentStyle; + } + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, } interface FormatCodeOptions extends EditorOptions { InsertSpaceAfterCommaDelimiter: boolean; @@ -2132,7 +2149,7 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; /** diff --git a/lib/typescript.js b/lib/typescript.js index a1f9651570e..d261ce125fc 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -62,279 +62,281 @@ var ts; SyntaxKind[SyntaxKind["PlusToken"] = 35] = "PlusToken"; SyntaxKind[SyntaxKind["MinusToken"] = 36] = "MinusToken"; SyntaxKind[SyntaxKind["AsteriskToken"] = 37] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 38] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 39] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 40] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 41] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 42] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 45] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 46] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 47] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 48] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 49] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 50] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 51] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 52] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 53] = "ColonToken"; - SyntaxKind[SyntaxKind["AtToken"] = 54] = "AtToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 38] = "AsteriskAsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 39] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 40] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 41] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 42] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 43] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 46] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 47] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 48] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 49] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 50] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 51] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 52] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 53] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 54] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 55] = "AtToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 55] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 56] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 57] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 58] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 59] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 60] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 61] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 63] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 64] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 65] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 66] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 56] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 57] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 58] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 59] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 60] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 61] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 62] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 63] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 64] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 66] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 67] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 68] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 67] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 69] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 68] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 69] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 70] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 71] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 72] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 73] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 74] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 75] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 76] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 77] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 78] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 79] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 80] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 81] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 82] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 83] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 84] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 85] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 86] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 87] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 88] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 89] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 90] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 91] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 92] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 93] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 94] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 95] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 96] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 97] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 98] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 99] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 100] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 101] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 102] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 103] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 70] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 71] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 72] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 73] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 74] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 75] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 76] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 77] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 78] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 79] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 80] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 81] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 82] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 83] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 84] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 85] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 86] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 87] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 88] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 89] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 90] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 91] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 92] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 93] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 94] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 95] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 96] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 97] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 98] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 99] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 100] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 101] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 102] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 103] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 104] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 105] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 104] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 105] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 106] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 107] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 108] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 109] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 110] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 111] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 112] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 106] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 107] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 108] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 109] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 110] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 111] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 112] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 113] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 114] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 113] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 114] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 115] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 116] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 117] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 118] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 119] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 120] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 121] = "GetKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 122] = "IsKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 123] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 124] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 125] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 126] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 127] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 128] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 129] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 130] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 131] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 132] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 115] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 116] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 117] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 118] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 119] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 120] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 121] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 122] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 123] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 124] = "IsKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 125] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 126] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 127] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 128] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 129] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 130] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 131] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 132] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 133] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 134] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 133] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 134] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 135] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 136] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 135] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 136] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 137] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 137] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 138] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 139] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 138] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 139] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 140] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 141] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 142] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 143] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 144] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 145] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 146] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 147] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 140] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 141] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 142] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 143] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 144] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 145] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 146] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 148] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 149] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 150] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 151] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 152] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 153] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 154] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 155] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 156] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 157] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 158] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 150] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 151] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 152] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 153] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 154] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 155] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 156] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 157] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 158] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 159] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 160] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 159] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 160] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 161] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 161] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 162] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 163] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 162] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 163] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 164] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 165] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 166] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 167] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 168] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 169] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 170] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 171] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 172] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 173] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 174] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 175] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 176] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 177] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 178] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 179] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 180] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 181] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 182] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 183] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 184] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 185] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 186] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 187] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 164] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 165] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 166] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 167] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 168] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 169] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 170] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 171] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 172] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 173] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 174] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 175] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 176] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 177] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 178] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 179] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 180] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 181] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 182] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 183] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 184] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 185] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 186] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 188] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 189] = "AsExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 188] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 189] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 190] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 191] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 190] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 191] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 192] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 193] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 194] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 195] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 196] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 197] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 198] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 199] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 200] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 201] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 202] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 203] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 204] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 205] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 206] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 207] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 208] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 209] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 210] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 211] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 212] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 213] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 214] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 215] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 216] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 217] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 218] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 219] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 220] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 221] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 222] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 223] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 224] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 225] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 226] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 227] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 228] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 229] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 192] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 193] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 194] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 195] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 196] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 197] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 198] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 199] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 200] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 201] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 202] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 203] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 204] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 205] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 206] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 207] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 208] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 209] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 210] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 211] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 212] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 213] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 214] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 215] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 216] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 217] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 218] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 219] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 220] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 221] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 222] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 223] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 224] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 225] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 226] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 227] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 228] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 229] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 230] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 231] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 230] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 232] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 231] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 232] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 233] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 234] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 235] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 236] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 237] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 238] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 233] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 234] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 235] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 236] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 237] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 238] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 239] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 240] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 239] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 240] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 241] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 242] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 241] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 242] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 243] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 244] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 243] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 244] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 245] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 246] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 245] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 247] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 246] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 248] = "SourceFile"; // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 247] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 249] = "JSDocTypeExpression"; // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 248] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 250] = "JSDocAllType"; // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 249] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 250] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 251] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 252] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 253] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 254] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 255] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 256] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 257] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 258] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 259] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 260] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 261] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 262] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 263] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 264] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 265] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 266] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 267] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 268] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 251] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 252] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 253] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 254] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 255] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 256] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 257] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 258] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 259] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 260] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 261] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 262] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 263] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 264] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 265] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 266] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 267] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 268] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 269] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 270] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 269] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 271] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 270] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 272] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 55] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 66] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 68] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 103] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 68] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 132] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 104] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 112] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 149] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 158] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 56] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 68] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 70] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 105] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 70] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 134] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 151] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 160] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 66] = "LastPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 132] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 134] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -342,8 +344,8 @@ var ts; SyntaxKind[SyntaxKind["FirstTemplateToken"] = 11] = "FirstTemplateToken"; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; - SyntaxKind[SyntaxKind["LastBinaryOperator"] = 66] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 133] = "FirstNode"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 135] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -364,6 +366,7 @@ var ts; NodeFlags[NodeFlags["OctalLiteral"] = 65536] = "OctalLiteral"; NodeFlags[NodeFlags["Namespace"] = 131072] = "Namespace"; NodeFlags[NodeFlags["ExportContext"] = 262144] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 524288] = "ContainsThis"; NodeFlags[NodeFlags["Modifier"] = 2035] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 49152] = "BlockScoped"; @@ -613,6 +616,7 @@ var ts; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; + TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ @@ -655,6 +659,7 @@ var ts; ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; ModuleKind[ModuleKind["System"] = 4] = "System"; + ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; })(ts.ModuleKind || (ts.ModuleKind = {})); var ModuleKind = ts.ModuleKind; (function (JsxEmit) { @@ -1221,8 +1226,11 @@ var ts; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { - Debug.assert(!headChain.next); - headChain.next = tailChain; + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; @@ -1496,6 +1504,7 @@ var ts; * List of supported extensions in order of file resolution precedence. */ ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -1819,10 +1828,15 @@ var ts; close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { + // mtime.getTime() equals 0 if file was removed + if (curr.mtime.getTime() === 0) { + callback(fileName, /* removed */ true); + return; + } if (+curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, /* removed */ false); } }, resolvePath: function (path) { @@ -1925,7 +1939,7 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, @@ -2013,7 +2027,7 @@ var ts; Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -2031,10 +2045,9 @@ var ts; An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, @@ -2063,10 +2076,6 @@ var ts; An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -2077,6 +2086,10 @@ var ts; _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "'=' can only be used in an object literal property inside a destructuring assignment." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -2201,7 +2214,7 @@ var ts; In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, @@ -2289,6 +2302,9 @@ var ts; yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A module cannot have multiple default exports." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2389,7 +2405,7 @@ var ts; Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2401,7 +2417,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -2422,7 +2438,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -2443,7 +2459,6 @@ var ts; Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, @@ -2490,7 +2505,9 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } }; })(ts || (ts = {})); /// @@ -2499,75 +2516,75 @@ var ts; (function (ts) { /* @internal */ function tokenIsIdentifierOrKeyword(token) { - return token >= 67 /* Identifier */; + return token >= 69 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { - "abstract": 113 /* AbstractKeyword */, - "any": 115 /* AnyKeyword */, - "as": 114 /* AsKeyword */, - "boolean": 118 /* BooleanKeyword */, - "break": 68 /* BreakKeyword */, - "case": 69 /* CaseKeyword */, - "catch": 70 /* CatchKeyword */, - "class": 71 /* ClassKeyword */, - "continue": 73 /* ContinueKeyword */, - "const": 72 /* ConstKeyword */, - "constructor": 119 /* ConstructorKeyword */, - "debugger": 74 /* DebuggerKeyword */, - "declare": 120 /* DeclareKeyword */, - "default": 75 /* DefaultKeyword */, - "delete": 76 /* DeleteKeyword */, - "do": 77 /* DoKeyword */, - "else": 78 /* ElseKeyword */, - "enum": 79 /* EnumKeyword */, - "export": 80 /* ExportKeyword */, - "extends": 81 /* ExtendsKeyword */, - "false": 82 /* FalseKeyword */, - "finally": 83 /* FinallyKeyword */, - "for": 84 /* ForKeyword */, - "from": 131 /* FromKeyword */, - "function": 85 /* FunctionKeyword */, - "get": 121 /* GetKeyword */, - "if": 86 /* IfKeyword */, - "implements": 104 /* ImplementsKeyword */, - "import": 87 /* ImportKeyword */, - "in": 88 /* InKeyword */, - "instanceof": 89 /* InstanceOfKeyword */, - "interface": 105 /* InterfaceKeyword */, - "is": 122 /* IsKeyword */, - "let": 106 /* LetKeyword */, - "module": 123 /* ModuleKeyword */, - "namespace": 124 /* NamespaceKeyword */, - "new": 90 /* NewKeyword */, - "null": 91 /* NullKeyword */, - "number": 126 /* NumberKeyword */, - "package": 107 /* PackageKeyword */, - "private": 108 /* PrivateKeyword */, - "protected": 109 /* ProtectedKeyword */, - "public": 110 /* PublicKeyword */, - "require": 125 /* RequireKeyword */, - "return": 92 /* ReturnKeyword */, - "set": 127 /* SetKeyword */, - "static": 111 /* StaticKeyword */, - "string": 128 /* StringKeyword */, - "super": 93 /* SuperKeyword */, - "switch": 94 /* SwitchKeyword */, - "symbol": 129 /* SymbolKeyword */, - "this": 95 /* ThisKeyword */, - "throw": 96 /* ThrowKeyword */, - "true": 97 /* TrueKeyword */, - "try": 98 /* TryKeyword */, - "type": 130 /* TypeKeyword */, - "typeof": 99 /* TypeOfKeyword */, - "var": 100 /* VarKeyword */, - "void": 101 /* VoidKeyword */, - "while": 102 /* WhileKeyword */, - "with": 103 /* WithKeyword */, - "yield": 112 /* YieldKeyword */, - "async": 116 /* AsyncKeyword */, - "await": 117 /* AwaitKeyword */, - "of": 132 /* OfKeyword */, + "abstract": 115 /* AbstractKeyword */, + "any": 117 /* AnyKeyword */, + "as": 116 /* AsKeyword */, + "boolean": 120 /* BooleanKeyword */, + "break": 70 /* BreakKeyword */, + "case": 71 /* CaseKeyword */, + "catch": 72 /* CatchKeyword */, + "class": 73 /* ClassKeyword */, + "continue": 75 /* ContinueKeyword */, + "const": 74 /* ConstKeyword */, + "constructor": 121 /* ConstructorKeyword */, + "debugger": 76 /* DebuggerKeyword */, + "declare": 122 /* DeclareKeyword */, + "default": 77 /* DefaultKeyword */, + "delete": 78 /* DeleteKeyword */, + "do": 79 /* DoKeyword */, + "else": 80 /* ElseKeyword */, + "enum": 81 /* EnumKeyword */, + "export": 82 /* ExportKeyword */, + "extends": 83 /* ExtendsKeyword */, + "false": 84 /* FalseKeyword */, + "finally": 85 /* FinallyKeyword */, + "for": 86 /* ForKeyword */, + "from": 133 /* FromKeyword */, + "function": 87 /* FunctionKeyword */, + "get": 123 /* GetKeyword */, + "if": 88 /* IfKeyword */, + "implements": 106 /* ImplementsKeyword */, + "import": 89 /* ImportKeyword */, + "in": 90 /* InKeyword */, + "instanceof": 91 /* InstanceOfKeyword */, + "interface": 107 /* InterfaceKeyword */, + "is": 124 /* IsKeyword */, + "let": 108 /* LetKeyword */, + "module": 125 /* ModuleKeyword */, + "namespace": 126 /* NamespaceKeyword */, + "new": 92 /* NewKeyword */, + "null": 93 /* NullKeyword */, + "number": 128 /* NumberKeyword */, + "package": 109 /* PackageKeyword */, + "private": 110 /* PrivateKeyword */, + "protected": 111 /* ProtectedKeyword */, + "public": 112 /* PublicKeyword */, + "require": 127 /* RequireKeyword */, + "return": 94 /* ReturnKeyword */, + "set": 129 /* SetKeyword */, + "static": 113 /* StaticKeyword */, + "string": 130 /* StringKeyword */, + "super": 95 /* SuperKeyword */, + "switch": 96 /* SwitchKeyword */, + "symbol": 131 /* SymbolKeyword */, + "this": 97 /* ThisKeyword */, + "throw": 98 /* ThrowKeyword */, + "true": 99 /* TrueKeyword */, + "try": 100 /* TryKeyword */, + "type": 132 /* TypeKeyword */, + "typeof": 101 /* TypeOfKeyword */, + "var": 102 /* VarKeyword */, + "void": 103 /* VoidKeyword */, + "while": 104 /* WhileKeyword */, + "with": 105 /* WithKeyword */, + "yield": 114 /* YieldKeyword */, + "async": 118 /* AsyncKeyword */, + "await": 119 /* AwaitKeyword */, + "of": 134 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -2589,37 +2606,39 @@ var ts; "=>": 34 /* EqualsGreaterThanToken */, "+": 35 /* PlusToken */, "-": 36 /* MinusToken */, + "**": 38 /* AsteriskAsteriskToken */, "*": 37 /* AsteriskToken */, - "/": 38 /* SlashToken */, - "%": 39 /* PercentToken */, - "++": 40 /* PlusPlusToken */, - "--": 41 /* MinusMinusToken */, - "<<": 42 /* LessThanLessThanToken */, + "/": 39 /* SlashToken */, + "%": 40 /* PercentToken */, + "++": 41 /* PlusPlusToken */, + "--": 42 /* MinusMinusToken */, + "<<": 43 /* LessThanLessThanToken */, ">": 43 /* GreaterThanGreaterThanToken */, - ">>>": 44 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 45 /* AmpersandToken */, - "|": 46 /* BarToken */, - "^": 47 /* CaretToken */, - "!": 48 /* ExclamationToken */, - "~": 49 /* TildeToken */, - "&&": 50 /* AmpersandAmpersandToken */, - "||": 51 /* BarBarToken */, - "?": 52 /* QuestionToken */, - ":": 53 /* ColonToken */, - "=": 55 /* EqualsToken */, - "+=": 56 /* PlusEqualsToken */, - "-=": 57 /* MinusEqualsToken */, - "*=": 58 /* AsteriskEqualsToken */, - "/=": 59 /* SlashEqualsToken */, - "%=": 60 /* PercentEqualsToken */, - "<<=": 61 /* LessThanLessThanEqualsToken */, - ">>=": 62 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 64 /* AmpersandEqualsToken */, - "|=": 65 /* BarEqualsToken */, - "^=": 66 /* CaretEqualsToken */, - "@": 54 /* AtToken */ + ">>": 44 /* GreaterThanGreaterThanToken */, + ">>>": 45 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 46 /* AmpersandToken */, + "|": 47 /* BarToken */, + "^": 48 /* CaretToken */, + "!": 49 /* ExclamationToken */, + "~": 50 /* TildeToken */, + "&&": 51 /* AmpersandAmpersandToken */, + "||": 52 /* BarBarToken */, + "?": 53 /* QuestionToken */, + ":": 54 /* ColonToken */, + "=": 56 /* EqualsToken */, + "+=": 57 /* PlusEqualsToken */, + "-=": 58 /* MinusEqualsToken */, + "*=": 59 /* AsteriskEqualsToken */, + "**=": 60 /* AsteriskAsteriskEqualsToken */, + "/=": 61 /* SlashEqualsToken */, + "%=": 62 /* PercentEqualsToken */, + "<<=": 63 /* LessThanLessThanEqualsToken */, + ">>=": 64 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 66 /* AmpersandEqualsToken */, + "|=": 67 /* BarEqualsToken */, + "^=": 68 /* CaretEqualsToken */, + "@": 55 /* AtToken */ }; /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers @@ -3123,8 +3142,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 67 /* Identifier */ || token > 103 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 68 /* FirstReservedWord */ && token <= 103 /* LastReservedWord */; }, + isIdentifier: function () { return token === 69 /* Identifier */ || token > 105 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 70 /* FirstReservedWord */ && token <= 105 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -3146,16 +3165,6 @@ var ts; onError(message, length || 0); } } - function isIdentifierStart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || - ch === 36 /* $ */ || ch === 95 /* _ */ || - ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || - ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || - ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } function scanNumber() { var start = pos; while (isDigit(text.charCodeAt(pos))) @@ -3438,12 +3447,12 @@ var ts; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { + if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92 /* backslash */) { ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); @@ -3468,7 +3477,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 67 /* Identifier */; + return token = 69 /* Identifier */; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -3552,7 +3561,7 @@ var ts; } return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 48 /* ExclamationToken */; + return pos++, token = 49 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); @@ -3561,42 +3570,48 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 60 /* PercentEqualsToken */; + return pos += 2, token = 62 /* PercentEqualsToken */; } - return pos++, token = 39 /* PercentToken */; + return pos++, token = 40 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 50 /* AmpersandAmpersandToken */; + return pos += 2, token = 51 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* AmpersandEqualsToken */; + return pos += 2, token = 66 /* AmpersandEqualsToken */; } - return pos++, token = 45 /* AmpersandToken */; + return pos++, token = 46 /* AmpersandToken */; case 40 /* openParen */: return pos++, token = 17 /* OpenParenToken */; case 41 /* closeParen */: return pos++, token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* AsteriskEqualsToken */; + return pos += 2, token = 59 /* AsteriskEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 60 /* AsteriskAsteriskEqualsToken */; + } + return pos += 2, token = 38 /* AsteriskAsteriskToken */; } return pos++, token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 40 /* PlusPlusToken */; + return pos += 2, token = 41 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* PlusEqualsToken */; + return pos += 2, token = 57 /* PlusEqualsToken */; } return pos++, token = 35 /* PlusToken */; case 44 /* comma */: return pos++, token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 41 /* MinusMinusToken */; + return pos += 2, token = 42 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* MinusEqualsToken */; + return pos += 2, token = 58 /* MinusEqualsToken */; } return pos++, token = 36 /* MinusToken */; case 46 /* dot */: @@ -3653,9 +3668,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* SlashEqualsToken */; + return pos += 2, token = 61 /* SlashEqualsToken */; } - return pos++, token = 38 /* SlashToken */; + return pos++, token = 39 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3707,7 +3722,7 @@ var ts; tokenValue = "" + scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 53 /* ColonToken */; + return pos++, token = 54 /* ColonToken */; case 59 /* semicolon */: return pos++, token = 23 /* SemicolonToken */; case 60 /* lessThan */: @@ -3722,14 +3737,16 @@ var ts; } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 61 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 63 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 42 /* LessThanLessThanToken */; + return pos += 2, token = 43 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 28 /* LessThanEqualsToken */; } - if (text.charCodeAt(pos + 1) === 47 /* slash */ && languageVariant === 1 /* JSX */) { + if (languageVariant === 1 /* JSX */ && + text.charCodeAt(pos + 1) === 47 /* slash */ && + text.charCodeAt(pos + 2) !== 42 /* asterisk */) { return pos += 2, token = 26 /* LessThanSlashToken */; } return pos++, token = 25 /* LessThanToken */; @@ -3752,7 +3769,7 @@ var ts; if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 55 /* EqualsToken */; + return pos++, token = 56 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3765,35 +3782,35 @@ var ts; } return pos++, token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 52 /* QuestionToken */; + return pos++, token = 53 /* QuestionToken */; case 91 /* openBracket */: return pos++, token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: return pos++, token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 66 /* CaretEqualsToken */; + return pos += 2, token = 68 /* CaretEqualsToken */; } - return pos++, token = 47 /* CaretToken */; + return pos++, token = 48 /* CaretToken */; case 123 /* openBrace */: return pos++, token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 51 /* BarBarToken */; + return pos += 2, token = 52 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* BarEqualsToken */; + return pos += 2, token = 67 /* BarEqualsToken */; } - return pos++, token = 46 /* BarToken */; + return pos++, token = 47 /* BarToken */; case 125 /* closeBrace */: return pos++, token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 49 /* TildeToken */; + return pos++, token = 50 /* TildeToken */; case 64 /* at */: - return pos++, token = 54 /* AtToken */; + return pos++, token = 55 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); @@ -3801,9 +3818,9 @@ var ts; error(ts.Diagnostics.Invalid_character); return pos++, token = 0 /* Unknown */; default: - if (isIdentifierStart(ch)) { + if (isIdentifierStart(ch, languageVersion)) { pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92 /* backslash */) { @@ -3830,14 +3847,14 @@ var ts; if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 44 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 45 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 43 /* GreaterThanGreaterThanToken */; + return pos++, token = 44 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { return pos++, token = 29 /* GreaterThanEqualsToken */; @@ -3846,7 +3863,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) { + if (token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -3886,7 +3903,7 @@ var ts; } p++; } - while (p < end && isIdentifierPart(text.charCodeAt(p))) { + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; @@ -3932,7 +3949,7 @@ var ts; break; } } - return token = 234 /* JsxText */; + return token = 236 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -3941,7 +3958,7 @@ var ts; var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) { + if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { pos++; } else { @@ -4020,16 +4037,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 217 /* ModuleBlock */) { + else if (node.kind === 219 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -4048,7 +4065,7 @@ var ts; }); return state; } - else if (node.kind === 216 /* ModuleDeclaration */) { + else if (node.kind === 218 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -4088,6 +4105,8 @@ var ts; var container; var blockScopeContainer; var lastContainer; + var seenThisKeyword; + var isJavaScriptFile = ts.isSourceFileJavaScript(file); // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). @@ -4126,10 +4145,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 216 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return "\"" + node.name.text + "\""; } - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -4137,22 +4156,25 @@ var ts; return node.name.text; } switch (node.kind) { - case 142 /* Constructor */: + case 144 /* Constructor */: return "__constructor"; - case 150 /* FunctionType */: - case 145 /* CallSignature */: + case 152 /* FunctionType */: + case 147 /* CallSignature */: return "__call"; - case 151 /* ConstructorType */: - case 146 /* ConstructSignature */: + case 153 /* ConstructorType */: + case 148 /* ConstructSignature */: return "__new"; - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return "__index"; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return "__export"; - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 211 /* FunctionDeclaration */: - case 212 /* ClassDeclaration */: + case 181 /* BinaryExpression */: + // Binary expression case is for JS module 'module.exports = expr' + return "export="; + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: return node.flags & 1024 /* Default */ ? "default" : undefined; } } @@ -4169,8 +4191,9 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 1024 /* Default */; // The exported symbol for an export default function/class node is always named "default" - var name = node.flags & 1024 /* Default */ && parent ? "default" : getDeclarationName(node); + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { // Check and see if the symbol table already has a symbol with this name. If not, @@ -4206,6 +4229,11 @@ var ts; var message = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 1024 /* Default */) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -4223,7 +4251,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 228 /* ExportSpecifier */ || (node.kind === 219 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -4297,44 +4325,51 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - ts.forEachChild(node, bind); + if (node.kind === 215 /* InterfaceDeclaration */) { + seenThisKeyword = false; + ts.forEachChild(node, bind); + node.flags = seenThisKeyword ? node.flags | 524288 /* ContainsThis */ : node.flags & ~524288 /* ContainsThis */; + } + else { + ts.forEachChild(node, bind); + } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function getContainerFlags(node) { switch (node.kind) { - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 153 /* TypeLiteral */: - case 163 /* ObjectLiteralExpression */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: return 1 /* IsContainer */; - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 211 /* FunctionDeclaration */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 216 /* ModuleDeclaration */: - case 246 /* SourceFile */: - case 214 /* TypeAliasDeclaration */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 218 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 216 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 242 /* CatchClause */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 218 /* CaseBlock */: + case 244 /* CatchClause */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 220 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 190 /* Block */: + case 192 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Othewise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -4371,38 +4406,38 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 153 /* TypeLiteral */: - case 163 /* ObjectLiteralExpression */: - case 213 /* InterfaceDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + case 215 /* InterfaceDeclaration */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 214 /* TypeAliasDeclaration */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 216 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -4432,11 +4467,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 246 /* SourceFile */ ? node : node.body; - if (body.kind === 246 /* SourceFile */ || body.kind === 217 /* ModuleBlock */) { + var body = node.kind === 248 /* SourceFile */ ? node : node.body; + if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 226 /* ExportDeclaration */ || stat.kind === 225 /* ExportAssignment */) { + if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { return true; } } @@ -4508,7 +4543,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 67 /* Identifier */) { + if (prop.name.kind !== 69 /* Identifier */) { continue; } var identifier = prop.name; @@ -4520,7 +4555,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */ || prop.kind === 141 /* MethodDeclaration */ + var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -4542,10 +4577,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 246 /* SourceFile */: + case 248 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -4566,8 +4601,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 104 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 112 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && !ts.isIdentifierName(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { @@ -4602,7 +4637,7 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 67 /* Identifier */) { + if (inStrictMode && node.expression.kind === 69 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name var span = ts.getErrorSpanForNode(file, node.expression); @@ -4610,11 +4645,11 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 67 /* Identifier */) { + if (name && name.kind === 69 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -4658,7 +4693,7 @@ var ts; function checkStrictModePrefixUnaryExpression(node) { // Grammar checking if (inStrictMode) { - if (node.operator === 40 /* PlusPlusToken */ || node.operator === 41 /* MinusMinusToken */) { + if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -4702,17 +4737,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 246 /* SourceFile */: - case 217 /* ModuleBlock */: + case 248 /* SourceFile */: + case 219 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -4739,107 +4774,130 @@ var ts; } function bindWorker(node) { switch (node.kind) { - case 67 /* Identifier */: + /* Strict mode checks */ + case 69 /* Identifier */: return checkStrictModeIdentifier(node); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: + if (isJavaScriptFile) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return checkStrictModeCatchClause(node); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return checkStrictModeWithStatement(node); - case 135 /* TypeParameter */: + case 97 /* ThisKeyword */: + seenThisKeyword = true; + return; + case 137 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 136 /* Parameter */: + case 138 /* Parameter */: return bindParameter(node); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 142 /* Constructor */: + case 144 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 168 /* CallExpression */: + if (isJavaScriptFile) { + bindCallExpression(node); + } + break; + // Members of classes, interfaces, and modules + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 219 /* ImportEqualsDeclaration */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + // Imports and exports + case 221 /* ImportEqualsDeclaration */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return bindImportClause(node); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return bindExportDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return bindExportAssignment(node); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } function bindExportAssignment(node) { + var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (node.expression.kind === 67 /* Identifier */) { + else if (boundExpression.kind === 69 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -4863,8 +4921,32 @@ var ts; declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); } } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + // When we create a property via 'exports.foo = bar', the 'exports.foo' property access + // expression is the declaration + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); + } + function bindModuleExportsAssignment(node) { + // 'module.exports = expr' assignment + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } function bindClassLikeDeclaration(node) { - if (node.kind === 212 /* ClassDeclaration */) { + if (node.kind === 214 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -4940,7 +5022,7 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 142 /* Constructor */ && + node.parent.kind === 144 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); @@ -4992,7 +5074,8 @@ var ts; increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); @@ -5062,7 +5145,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 246 /* SourceFile */) { + while (node && node.kind !== 248 /* SourceFile */) { node = node.parent; } return node; @@ -5174,15 +5257,15 @@ var ts; return current; } switch (current.kind) { - case 246 /* SourceFile */: - case 218 /* CaseBlock */: - case 242 /* CatchClause */: - case 216 /* ModuleDeclaration */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 248 /* SourceFile */: + case 220 /* CaseBlock */: + case 244 /* CatchClause */: + case 218 /* ModuleDeclaration */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return current; - case 190 /* Block */: + case 192 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -5195,9 +5278,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 209 /* VariableDeclaration */ && + declaration.kind === 211 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 242 /* CatchClause */; + declaration.parent.kind === 244 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -5236,7 +5319,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 246 /* SourceFile */: + case 248 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -5245,16 +5328,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: errorNode = node.name; break; } @@ -5273,16 +5356,20 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 8192 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 215 /* EnumDeclaration */ && isConst(node); + return node.kind === 217 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 161 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 163 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -5297,14 +5384,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 209 /* VariableDeclaration */) { + if (node.kind === 211 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 210 /* VariableDeclarationList */) { + if (node && node.kind === 212 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 191 /* VariableStatement */) { + if (node && node.kind === 193 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -5319,7 +5406,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 193 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 195 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -5327,7 +5414,7 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 136 /* Parameter */ || node.kind === 135 /* TypeParameter */) ? + var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode); return ts.filter(commentRanges, isJsDocComment); @@ -5342,40 +5429,40 @@ var ts; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { + if (151 /* FirstTypeNode */ <= node.kind && node.kind <= 160 /* LastTypeNode */) { return true; } switch (node.kind) { - case 115 /* AnyKeyword */: - case 126 /* NumberKeyword */: - case 128 /* StringKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: + case 117 /* AnyKeyword */: + case 128 /* NumberKeyword */: + case 130 /* StringKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: return true; - case 101 /* VoidKeyword */: - return node.parent.kind !== 175 /* VoidExpression */; + case 103 /* VoidKeyword */: + return node.parent.kind !== 177 /* VoidExpression */; case 9 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 136 /* Parameter */; - case 186 /* ExpressionWithTypeArguments */: + return node.parent.kind === 138 /* Parameter */; + case 188 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 67 /* Identifier */: + case 69 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } - // fall through - case 133 /* QualifiedName */: - case 164 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 135 /* QualifiedName */: + case 166 /* PropertyAccessExpression */: + case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 152 /* TypeQuery */) { + if (parent_1.kind === 154 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5384,38 +5471,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (149 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 158 /* LastTypeNode */) { + if (151 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 160 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return node === parent_1.constraint; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 136 /* Parameter */: - case 209 /* VariableDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 138 /* Parameter */: + case 211 /* VariableDeclaration */: return node === parent_1.type; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 142 /* Constructor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 144 /* Constructor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return node === parent_1.type; - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return node === parent_1.type; - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: return node === parent_1.type; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5429,23 +5516,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return visitor(node); - case 218 /* CaseBlock */: - case 190 /* Block */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: + case 220 /* CaseBlock */: + case 192 /* Block */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5455,18 +5542,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -5474,7 +5561,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 134 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 136 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(name_5.expression); @@ -5493,14 +5580,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 161 /* BindingElement */: - case 245 /* EnumMember */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 244 /* ShorthandPropertyAssignment */: - case 209 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 247 /* EnumMember */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 246 /* ShorthandPropertyAssignment */: + case 211 /* VariableDeclaration */: return true; } } @@ -5508,29 +5595,29 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */); + return node && (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */); + return node && (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 142 /* Constructor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return true; } } @@ -5539,24 +5626,24 @@ var ts; ts.isFunctionLike = isFunctionLike; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: return true; } return false; } ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 190 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 192 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 141 /* MethodDeclaration */ && node.parent.kind === 163 /* ObjectLiteralExpression */; + return node && node.kind === 143 /* MethodDeclaration */ && node.parent.kind === 165 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -5584,7 +5671,7 @@ var ts; return undefined; } switch (node.kind) { - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -5599,9 +5686,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5612,23 +5699,26 @@ var ts; node = node.parent; } break; - case 172 /* ArrowFunction */: + case 174 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 216 /* ModuleDeclaration */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 215 /* EnumDeclaration */: - case 246 /* SourceFile */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 218 /* ModuleDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 217 /* EnumDeclaration */: + case 248 /* SourceFile */: return node; } } @@ -5640,7 +5730,7 @@ var ts; if (!node) return node; switch (node.kind) { - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container @@ -5655,9 +5745,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5668,19 +5758,19 @@ var ts; node = node.parent; } break; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return node; } } @@ -5689,12 +5779,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 149 /* TypeReference */: + case 151 /* TypeReference */: return node.typeName; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return node.expression; - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: return node; } } @@ -5702,7 +5792,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5711,44 +5801,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: // classes are valid targets return true; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 212 /* ClassDeclaration */; - case 136 /* Parameter */: + return node.parent.kind === 214 /* ClassDeclaration */; + case 138 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 212 /* ClassDeclaration */; - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 141 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 214 /* ClassDeclaration */; + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 143 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 212 /* ClassDeclaration */; + return node.body && node.parent.kind === 214 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: if (node.decorators) { return true; } return false; - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -5759,10 +5849,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -5772,96 +5862,106 @@ var ts; return nodeIsDecorated(node) || childIsDecorated(node); } ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 166 /* PropertyAccessExpression */; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 167 /* ElementAccessExpression */; + } + ts.isElementAccessExpression = isElementAccessExpression; function isExpression(node) { switch (node.kind) { - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 168 /* TaggedTemplateExpression */: - case 187 /* AsExpression */: - case 169 /* TypeAssertionExpression */: - case 170 /* ParenthesizedExpression */: - case 171 /* FunctionExpression */: - case 184 /* ClassExpression */: - case 172 /* ArrowFunction */: - case 175 /* VoidExpression */: - case 173 /* DeleteExpression */: - case 174 /* TypeOfExpression */: - case 177 /* PrefixUnaryExpression */: - case 178 /* PostfixUnaryExpression */: - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 181 /* TemplateExpression */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 170 /* TaggedTemplateExpression */: + case 189 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 172 /* ParenthesizedExpression */: + case 173 /* FunctionExpression */: + case 186 /* ClassExpression */: + case 174 /* ArrowFunction */: + case 177 /* VoidExpression */: + case 175 /* DeleteExpression */: + case 176 /* TypeOfExpression */: + case 179 /* PrefixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 183 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 185 /* OmittedExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 182 /* YieldExpression */: + case 187 /* OmittedExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 184 /* YieldExpression */: + case 178 /* AwaitExpression */: return true; - case 133 /* QualifiedName */: - while (node.parent.kind === 133 /* QualifiedName */) { + case 135 /* QualifiedName */: + while (node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 152 /* TypeQuery */; - case 67 /* Identifier */: - if (node.parent.kind === 152 /* TypeQuery */) { + return node.parent.kind === 154 /* TypeQuery */; + case 69 /* Identifier */: + if (node.parent.kind === 154 /* TypeQuery */) { return true; } // fall through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: + case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 209 /* VariableDeclaration */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 245 /* EnumMember */: - case 243 /* PropertyAssignment */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 247 /* EnumMember */: + case 245 /* PropertyAssignment */: + case 163 /* BindingElement */: return parent_2.initializer === node; - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 202 /* ReturnStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 206 /* ThrowStatement */: - case 204 /* SwitchStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 204 /* ReturnStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 208 /* ThrowStatement */: + case 206 /* SwitchStatement */: return parent_2.expression === node; - case 197 /* ForStatement */: + case 199 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 210 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 212 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212 /* VariableDeclarationList */) || forInStatement.expression === node; - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return node === parent_2.expression; - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return node === parent_2.expression; - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: return node === parent_2.expression; - case 137 /* Decorator */: - case 238 /* JsxExpression */: + case 139 /* Decorator */: + case 240 /* JsxExpression */: + case 239 /* JsxSpreadAttribute */: return true; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5872,6 +5972,12 @@ var ts; return false; } ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + // TypeScript 1.0 spec (April 2014): 11.2.1 + // An external module name is "relative" if the first term is "." or "..". + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 /* Instantiated */ || @@ -5879,7 +5985,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */; + return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5888,20 +5994,70 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 230 /* ExternalModuleReference */; + return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + /** + * Returns true if the node is a CallExpression to the identifier 'require' with + * exactly one argument. + * This function does not test if the node is in a JavaScript file or not. + */ + function isRequireCall(expression) { + // of the form 'require("name")' + return expression.kind === 168 /* CallExpression */ && + expression.expression.kind === 69 /* Identifier */ && + expression.expression.text === "require" && + expression.arguments.length === 1; + } + ts.isRequireCall = isRequireCall; + /** + * Returns true if the node is an assignment to a property on the identifier 'exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isExportsPropertyAssignment(expression) { + // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + /** + * Returns true if the node is an assignment to the property access expression 'module.exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isModuleExportsAssignment(expression) { + // of the form 'module.exports = expr' where 'expr' is arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { - if (node.kind === 220 /* ImportDeclaration */) { + if (node.kind === 222 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 219 /* ImportEqualsDeclaration */) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 230 /* ExternalModuleReference */) { + if (reference.kind === 232 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 226 /* ExportDeclaration */) { + if (node.kind === 228 /* ExportDeclaration */) { return node.moduleSpecifier; } } @@ -5909,13 +6065,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 136 /* Parameter */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 244 /* ShorthandPropertyAssignment */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 138 /* Parameter */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 246 /* ShorthandPropertyAssignment */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5923,9 +6079,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 259 /* JSDocFunctionType */ && + return node.kind === 261 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 261 /* JSDocConstructorType */; + node.parameters[0].type.kind === 263 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -5939,26 +6095,26 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 267 /* JSDocTypeTag */); + return getJSDocTag(node, 269 /* JSDocTypeTag */); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 266 /* JSDocReturnTag */); + return getJSDocTag(node, 268 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 268 /* JSDocTemplateTag */); + return getJSDocTag(node, 270 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 67 /* Identifier */) { + if (parameter.name && parameter.name.kind === 69 /* Identifier */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 265 /* JSDocParameterTag */) { + if (t.kind === 267 /* JSDocParameterTag */) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5977,12 +6133,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 260 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 262 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 260 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 262 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -6003,7 +6159,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 160 /* ArrayBindingPattern */ || node.kind === 159 /* ObjectBindingPattern */); + return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -6018,34 +6174,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 172 /* ArrowFunction */: - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 142 /* Constructor */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 228 /* ExportSpecifier */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 143 /* GetAccessor */: - case 221 /* ImportClause */: - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 213 /* InterfaceDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 216 /* ModuleDeclaration */: - case 222 /* NamespaceImport */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 144 /* SetAccessor */: - case 244 /* ShorthandPropertyAssignment */: - case 214 /* TypeAliasDeclaration */: - case 135 /* TypeParameter */: - case 209 /* VariableDeclaration */: + case 174 /* ArrowFunction */: + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 144 /* Constructor */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 230 /* ExportSpecifier */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 145 /* GetAccessor */: + case 223 /* ImportClause */: + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 215 /* InterfaceDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 218 /* ModuleDeclaration */: + case 224 /* NamespaceImport */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 146 /* SetAccessor */: + case 246 /* ShorthandPropertyAssignment */: + case 216 /* TypeAliasDeclaration */: + case 137 /* TypeParameter */: + case 211 /* VariableDeclaration */: return true; } return false; @@ -6053,25 +6209,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: - case 208 /* DebuggerStatement */: - case 195 /* DoStatement */: - case 193 /* ExpressionStatement */: - case 192 /* EmptyStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 194 /* IfStatement */: - case 205 /* LabeledStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 96 /* ThrowKeyword */: - case 207 /* TryStatement */: - case 191 /* VariableStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 225 /* ExportAssignment */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 210 /* DebuggerStatement */: + case 197 /* DoStatement */: + case 195 /* ExpressionStatement */: + case 194 /* EmptyStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 196 /* IfStatement */: + case 207 /* LabeledStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 98 /* ThrowKeyword */: + case 209 /* TryStatement */: + case 193 /* VariableStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 227 /* ExportAssignment */: return true; default: return false; @@ -6080,13 +6236,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 142 /* Constructor */: - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: + case 144 /* Constructor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: return true; default: return false; @@ -6095,11 +6251,11 @@ var ts; ts.isClassElement = isClassElement; // True if the given identifier, string literal, or number literal is the name of a declaration node function isDeclarationName(name) { - if (name.kind !== 67 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { + if (name.kind !== 69 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { return false; } var parent = name.parent; - if (parent.kind === 224 /* ImportSpecifier */ || parent.kind === 228 /* ExportSpecifier */) { + if (parent.kind === 226 /* ImportSpecifier */ || parent.kind === 230 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -6114,31 +6270,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 245 /* EnumMember */: - case 243 /* PropertyAssignment */: - case 164 /* PropertyAccessExpression */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 247 /* EnumMember */: + case 245 /* PropertyAssignment */: + case 166 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 133 /* QualifiedName */) { + while (parent.kind === 135 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 152 /* TypeQuery */; + return parent.kind === 154 /* TypeQuery */; } return false; - case 161 /* BindingElement */: - case 224 /* ImportSpecifier */: + case 163 /* BindingElement */: + case 226 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 228 /* ExportSpecifier */: + case 230 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -6154,26 +6310,26 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ || - node.kind === 221 /* ImportClause */ && !!node.name || - node.kind === 222 /* NamespaceImport */ || - node.kind === 224 /* ImportSpecifier */ || - node.kind === 228 /* ExportSpecifier */ || - node.kind === 225 /* ExportAssignment */ && node.expression.kind === 67 /* Identifier */; + return node.kind === 221 /* ImportEqualsDeclaration */ || + node.kind === 223 /* ImportClause */ && !!node.name || + node.kind === 224 /* NamespaceImport */ || + node.kind === 226 /* ImportSpecifier */ || + node.kind === 230 /* ExportSpecifier */ || + node.kind === 227 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 104 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 106 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -6242,7 +6398,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 68 /* FirstKeyword */ <= token && token <= 132 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 134 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -6262,7 +6418,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 134 /* ComputedPropertyName */ && + declaration.name.kind === 136 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -6272,14 +6428,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 164 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 67 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { + if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 134 /* ComputedPropertyName */) { + if (name.kind === 136 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6297,21 +6453,21 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 67 /* Identifier */ && node.text === "Symbol"; + return node.kind === 69 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 113 /* AbstractKeyword */: - case 116 /* AsyncKeyword */: - case 72 /* ConstKeyword */: - case 120 /* DeclareKeyword */: - case 75 /* DefaultKeyword */: - case 80 /* ExportKeyword */: - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 115 /* AbstractKeyword */: + case 118 /* AsyncKeyword */: + case 74 /* ConstKeyword */: + case 122 /* DeclareKeyword */: + case 77 /* DefaultKeyword */: + case 82 /* ExportKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: return true; } return false; @@ -6319,28 +6475,28 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 136 /* Parameter */; + return root.kind === 138 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 161 /* BindingElement */) { + while (node.kind === 163 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 216 /* ModuleDeclaration */ || n.kind === 246 /* SourceFile */; + return isFunctionLike(n) || n.kind === 218 /* ModuleDeclaration */ || n.kind === 248 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneEntityName(node) { - if (node.kind === 67 /* Identifier */) { - var clone_1 = createSynthesizedNode(67 /* Identifier */); + if (node.kind === 69 /* Identifier */) { + var clone_1 = createSynthesizedNode(69 /* Identifier */); clone_1.text = node.text; return clone_1; } else { - var clone_2 = createSynthesizedNode(133 /* QualifiedName */); + var clone_2 = createSynthesizedNode(135 /* QualifiedName */); clone_2.left = cloneEntityName(node.left); clone_2.left.parent = clone_2; clone_2.right = cloneEntityName(node.right); @@ -6595,7 +6751,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 142 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6624,10 +6780,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 143 /* GetAccessor */) { + if (accessor.kind === 145 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 144 /* SetAccessor */) { + else if (accessor.kind === 146 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6636,7 +6792,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) + if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6647,10 +6803,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 143 /* GetAccessor */ && !getAccessor) { + if (member.kind === 145 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 144 /* SetAccessor */ && !setAccessor) { + if (member.kind === 146 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6783,16 +6939,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 111 /* StaticKeyword */: return 128 /* Static */; - case 110 /* PublicKeyword */: return 16 /* Public */; - case 109 /* ProtectedKeyword */: return 64 /* Protected */; - case 108 /* PrivateKeyword */: return 32 /* Private */; - case 113 /* AbstractKeyword */: return 256 /* Abstract */; - case 80 /* ExportKeyword */: return 1 /* Export */; - case 120 /* DeclareKeyword */: return 2 /* Ambient */; - case 72 /* ConstKeyword */: return 32768 /* Const */; - case 75 /* DefaultKeyword */: return 1024 /* Default */; - case 116 /* AsyncKeyword */: return 512 /* Async */; + case 113 /* StaticKeyword */: return 128 /* Static */; + case 112 /* PublicKeyword */: return 16 /* Public */; + case 111 /* ProtectedKeyword */: return 64 /* Protected */; + case 110 /* PrivateKeyword */: return 32 /* Private */; + case 115 /* AbstractKeyword */: return 256 /* Abstract */; + case 82 /* ExportKeyword */: return 1 /* Export */; + case 122 /* DeclareKeyword */: return 2 /* Ambient */; + case 74 /* ConstKeyword */: return 32768 /* Const */; + case 77 /* DefaultKeyword */: return 1024 /* Default */; + case 118 /* AsyncKeyword */: return 512 /* Async */; } return 0; } @@ -6800,29 +6956,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 167 /* NewExpression */: - case 166 /* CallExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 168 /* TaggedTemplateExpression */: - case 162 /* ArrayLiteralExpression */: - case 170 /* ParenthesizedExpression */: - case 163 /* ObjectLiteralExpression */: - case 184 /* ClassExpression */: - case 171 /* FunctionExpression */: - case 67 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 169 /* NewExpression */: + case 168 /* CallExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 170 /* TaggedTemplateExpression */: + case 164 /* ArrayLiteralExpression */: + case 172 /* ParenthesizedExpression */: + case 165 /* ObjectLiteralExpression */: + case 186 /* ClassExpression */: + case 173 /* FunctionExpression */: + case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 181 /* TemplateExpression */: - case 82 /* FalseKeyword */: - case 91 /* NullKeyword */: - case 95 /* ThisKeyword */: - case 97 /* TrueKeyword */: - case 93 /* SuperKeyword */: + case 183 /* TemplateExpression */: + case 84 /* FalseKeyword */: + case 93 /* NullKeyword */: + case 97 /* ThisKeyword */: + case 99 /* TrueKeyword */: + case 95 /* SuperKeyword */: return true; } } @@ -6830,12 +6986,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 55 /* FirstAssignment */ && token <= 66 /* LastAssignment */; + return token >= 56 /* FirstAssignment */ && token <= 68 /* LastAssignment */; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 186 /* ExpressionWithTypeArguments */ && - node.parent.token === 81 /* ExtendsKeyword */ && + return node.kind === 188 /* ExpressionWithTypeArguments */ && + node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -6846,10 +7002,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 67 /* Identifier */) { + if (node.kind === 69 /* Identifier */) { return true; } - else if (node.kind === 164 /* PropertyAccessExpression */) { + else if (isPropertyAccessExpression(node)) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -6857,16 +7013,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 163 /* ObjectLiteralExpression */) { + if (kind === 165 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 162 /* ArrayLiteralExpression */) { + if (kind === 164 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6876,12 +7032,12 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } ts.isTsx = isTsx; /** @@ -7178,9 +7334,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 135 /* TypeParameter */) { + if (d && d.kind === 137 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215 /* InterfaceDeclaration */) { return current; } } @@ -7192,7 +7348,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(270 /* Count */); + var nodeConstructors = new Array(272 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -7237,20 +7393,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 246 /* ShorthandPropertyAssignment */: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7259,24 +7421,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7287,290 +7449,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 155 /* TupleType */: + case 157 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 164 /* PropertyAccessExpression */: + case 166 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 174 /* TypeOfExpression */: + case 176 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 175 /* VoidExpression */: + case 177 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 176 /* AwaitExpression */: + case 178 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 187 /* AsExpression */: + case 189 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 183 /* SpreadElementExpression */: + case 185 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 210 /* VariableDeclarationList */: + case 212 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 194 /* IfStatement */: + case 196 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 195 /* DoStatement */: + case 197 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 198 /* ForInStatement */: + case 200 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ForOfStatement */: + case 201 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: return visitNode(cbNode, node.label); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 239 /* CaseClause */: + case 241 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 240 /* DefaultClause */: + case 242 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 207 /* TryStatement */: + case 209 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 137 /* Decorator */: + case 139 /* Decorator */: return visitNode(cbNode, node.expression); - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 222 /* NamespaceImport */: + case 224 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 223 /* NamedImports */: - case 227 /* NamedExports */: + case 225 /* NamedImports */: + case 229 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 241 /* HeritageClause */: + case 243 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 230 /* ExternalModuleReference */: + case 232 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 229 /* MissingDeclaration */: + case 231 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 231 /* JsxElement */: + case 233 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 232 /* JsxSelfClosingElement */: - case 233 /* JsxOpeningElement */: + case 234 /* JsxSelfClosingElement */: + case 235 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 236 /* JsxAttribute */: + case 238 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 237 /* JsxSpreadAttribute */: + case 239 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 235 /* JsxClosingElement */: + case 237 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 247 /* JSDocTypeExpression */: + case 249 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 251 /* JSDocUnionType */: + case 253 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 252 /* JSDocTupleType */: + case 254 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 250 /* JSDocArrayType */: + case 252 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 254 /* JSDocNonNullableType */: + case 256 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 253 /* JSDocNullableType */: + case 255 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 255 /* JSDocRecordType */: + case 257 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 257 /* JSDocTypeReference */: + case 259 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 258 /* JSDocOptionalType */: + case 260 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 259 /* JSDocFunctionType */: + case 261 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 260 /* JSDocVariadicType */: + case 262 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 261 /* JSDocConstructorType */: + case 263 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 262 /* JSDocThisType */: + case 264 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 256 /* JSDocRecordMember */: + case 258 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 263 /* JSDocComment */: + case 265 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 265 /* JSDocParameterTag */: + case 267 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 266 /* JSDocReturnTag */: + case 268 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 267 /* JSDocTypeTag */: + case 269 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 268 /* JSDocTemplateTag */: + case 270 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7701,13 +7863,14 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -7715,7 +7878,7 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -7736,6 +7899,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32 /* JavaScriptFile */) { + sourceFile.parserContextFlags = 32 /* JavaScriptFile */; + } // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -7753,7 +7919,7 @@ var ts; // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -7765,9 +7931,9 @@ var ts; // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { - case 191 /* VariableStatement */: - case 211 /* FunctionDeclaration */: - case 136 /* Parameter */: + case 193 /* VariableStatement */: + case 213 /* FunctionDeclaration */: + case 138 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); @@ -7808,7 +7974,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(246 /* SourceFile */, /*pos*/ 0); + var sourceFile = createNode(248 /* SourceFile */, /*pos*/ 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -7972,7 +8138,7 @@ var ts; var saveParseDiagnosticsLength = parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; // Note: it is not actually necessary to save/restore the context flags here. That's - // because the saving/restorating of these flags happens naturally through the recursive + // because the saving/restoring of these flags happens naturally through the recursive // descent nature of our parser. However, we still store this here just so we can // assert that that invariant holds. var saveContextFlags = contextFlags; @@ -8007,20 +8173,20 @@ var ts; } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token === 67 /* Identifier */) { + if (token === 69 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token === 112 /* YieldKeyword */ && inYieldContext()) { + if (token === 114 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token === 117 /* AwaitKeyword */ && inAwaitContext()) { + if (token === 119 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token > 103 /* LastReservedWord */; + return token > 105 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -8126,16 +8292,16 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(67 /* Identifier */); + var node = createNode(69 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token !== 67 /* Identifier */) { + if (token !== 69 /* Identifier */) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -8170,7 +8336,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(134 /* ComputedPropertyName */); + var node = createNode(136 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -8183,21 +8349,28 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 72 /* ConstKeyword */) { + if (token === 74 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 79 /* EnumKeyword */; + return nextToken() === 81 /* EnumKeyword */; } - if (token === 80 /* ExportKeyword */) { + if (token === 82 /* ExportKeyword */) { nextToken(); - if (token === 75 /* DefaultKeyword */) { + if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } - if (token === 75 /* DefaultKeyword */) { + if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); } + if (token === 113 /* StaticKeyword */) { + nextToken(); + return canFollowModifier(); + } nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } return canFollowModifier(); } function parseAnyContextualModifier() { @@ -8211,7 +8384,7 @@ var ts; } function nextTokenIsClassOrFunction() { nextToken(); - return token === 71 /* ClassKeyword */ || token === 85 /* FunctionKeyword */; + return token === 73 /* ClassKeyword */ || token === 87 /* FunctionKeyword */; } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -8231,7 +8404,7 @@ var ts; // outer module. We just want to consume and move on. return !(token === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; + return token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 4 /* TypeMembers */: return isStartOfTypeMember(); case 5 /* ClassMembers */: @@ -8305,7 +8478,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 81 /* ExtendsKeyword */ || next === 104 /* ImplementsKeyword */; + return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 83 /* ExtendsKeyword */ || next === 106 /* ImplementsKeyword */; } return true; } @@ -8318,8 +8491,8 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 104 /* ImplementsKeyword */ || - token === 81 /* ExtendsKeyword */) { + if (token === 106 /* ImplementsKeyword */ || + token === 83 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -8345,14 +8518,14 @@ var ts; case 21 /* ImportOrExportSpecifiers */: return token === 16 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token === 16 /* CloseBraceToken */ || token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; + return token === 16 /* CloseBraceToken */ || token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 15 /* OpenBraceToken */ || token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 17 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery return token === 18 /* CloseParenToken */ || token === 23 /* SemicolonToken */; @@ -8369,11 +8542,11 @@ var ts; case 20 /* HeritageClauses */: return token === 15 /* OpenBraceToken */ || token === 16 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token === 27 /* GreaterThanToken */ || token === 38 /* SlashToken */; + return token === 27 /* GreaterThanToken */ || token === 39 /* SlashToken */; case 14 /* JsxChildren */: return token === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash); case 22 /* JSDocFunctionParameters */: - return token === 18 /* CloseParenToken */ || token === 53 /* ColonToken */ || token === 16 /* CloseBraceToken */; + return token === 18 /* CloseParenToken */ || token === 54 /* ColonToken */ || token === 16 /* CloseBraceToken */; case 23 /* JSDocTypeArguments */: return token === 27 /* GreaterThanToken */ || token === 16 /* CloseBraceToken */; case 25 /* JSDocTupleTypes */: @@ -8561,20 +8734,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 142 /* Constructor */: - case 147 /* IndexSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 139 /* PropertyDeclaration */: - case 189 /* SemicolonClassElement */: + case 144 /* Constructor */: + case 149 /* IndexSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 191 /* SemicolonClassElement */: return true; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 67 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 119 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 69 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 121 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -8583,8 +8756,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: return true; } } @@ -8593,58 +8766,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 191 /* VariableStatement */: - case 190 /* Block */: - case 194 /* IfStatement */: - case 193 /* ExpressionStatement */: - case 206 /* ThrowStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 192 /* EmptyStatement */: - case 207 /* TryStatement */: - case 205 /* LabeledStatement */: - case 195 /* DoStatement */: - case 208 /* DebuggerStatement */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: - case 225 /* ExportAssignment */: - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 214 /* TypeAliasDeclaration */: + case 213 /* FunctionDeclaration */: + case 193 /* VariableStatement */: + case 192 /* Block */: + case 196 /* IfStatement */: + case 195 /* ExpressionStatement */: + case 208 /* ThrowStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 194 /* EmptyStatement */: + case 209 /* TryStatement */: + case 207 /* LabeledStatement */: + case 197 /* DoStatement */: + case 210 /* DebuggerStatement */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + case 227 /* ExportAssignment */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 216 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 245 /* EnumMember */; + return node.kind === 247 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 146 /* ConstructSignature */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: - case 138 /* PropertySignature */: - case 145 /* CallSignature */: + case 148 /* ConstructSignature */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: + case 140 /* PropertySignature */: + case 147 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 209 /* VariableDeclaration */) { + if (node.kind !== 211 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8665,7 +8838,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 136 /* Parameter */) { + if (node.kind !== 138 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8782,7 +8955,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(133 /* QualifiedName */, entity.pos); + var node = createNode(135 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8815,13 +8988,13 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(67 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(181 /* TemplateExpression */); + var template = createNode(183 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -8834,7 +9007,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(188 /* TemplateSpan */); + var span = createNode(190 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { @@ -8876,14 +9049,14 @@ var ts; // TYPES function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - if (typeName.kind === 67 /* Identifier */ && token === 122 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 69 /* Identifier */ && token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(148 /* TypePredicate */, typeName.pos); + var node_1 = createNode(150 /* TypePredicate */, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(149 /* TypeReference */, typeName.pos); + var node = createNode(151 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -8891,15 +9064,15 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(152 /* TypeQuery */); - parseExpected(99 /* TypeOfKeyword */); + var node = createNode(154 /* TypeQuery */); + parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(135 /* TypeParameter */); + var node = createNode(137 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(81 /* ExtendsKeyword */)) { + if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -8926,7 +9099,7 @@ var ts; } } function parseParameterType() { - if (parseOptional(53 /* ColonToken */)) { + if (parseOptional(54 /* ColonToken */)) { return token === 9 /* StringLiteral */ ? parseLiteralNode(/*internName*/ true) : parseType(); @@ -8934,7 +9107,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 54 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 55 /* AtToken */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8943,7 +9116,7 @@ var ts; } } function parseParameter() { - var node = createNode(136 /* Parameter */); + var node = createNode(138 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); @@ -8961,7 +9134,7 @@ var ts; // to avoid this we'll advance cursor to the next token. nextToken(); } - node.questionToken = parseOptionalToken(52 /* QuestionToken */); + node.questionToken = parseOptionalToken(53 /* QuestionToken */); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(/*inParameter*/ true); // Do not check for initializers in an ambient context for parameters. This is not @@ -9037,10 +9210,10 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 146 /* ConstructSignature */) { - parseExpected(90 /* NewKeyword */); + if (kind === 148 /* ConstructSignature */) { + parseExpected(92 /* NewKeyword */); } - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); parseTypeMemberSemicolon(); return finishNode(node); } @@ -9087,21 +9260,21 @@ var ts; // A colon signifies a well formed indexer // A comma should be a badly formed indexer because comma expressions are not allowed // in computed properties. - if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */) { + if (token === 54 /* ColonToken */ || token === 24 /* CommaToken */) { return true; } // Question mark could be an indexer with an optional property, // or it could be a conditional expression in a computed property. - if (token !== 52 /* QuestionToken */) { + if (token !== 53 /* QuestionToken */) { return false; } // If any of the following tokens are after the question mark, it cannot // be a conditional expression, so treat it as an indexer. nextToken(); - return token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; + return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(147 /* IndexSignature */, fullStart); + var node = createNode(149 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -9112,19 +9285,19 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(140 /* MethodSignature */, fullStart); + var method = createNode(142 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [Await] - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(138 /* PropertySignature */, fullStart); + var property = createNode(140 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -9158,23 +9331,23 @@ var ts; nextToken(); return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || - token === 52 /* QuestionToken */ || - token === 53 /* ColonToken */ || + token === 53 /* QuestionToken */ || + token === 54 /* ColonToken */ || canParseSemicolon(); } function parseTypeMember() { switch (token) { case 17 /* OpenParenToken */: case 25 /* LessThanToken */: - return parseSignatureMember(145 /* CallSignature */); + return parseSignatureMember(147 /* CallSignature */); case 19 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) : parsePropertyOrMethodSignature(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(146 /* ConstructSignature */); + return parseSignatureMember(148 /* ConstructSignature */); } // fall through. case 9 /* StringLiteral */: @@ -9211,7 +9384,7 @@ var ts; return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(153 /* TypeLiteral */); + var node = createNode(155 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -9227,12 +9400,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(155 /* TupleType */); + var node = createNode(157 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(158 /* ParenthesizedType */); + var node = createNode(160 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -9240,8 +9413,8 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 151 /* ConstructorType */) { - parseExpected(90 /* NewKeyword */); + if (kind === 153 /* ConstructorType */) { + parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); return finishNode(node); @@ -9252,17 +9425,18 @@ var ts; } function parseNonArrayType() { switch (token) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: return parseTokenNode(); - case 99 /* TypeOfKeyword */: + case 101 /* TypeOfKeyword */: return parseTypeQuery(); case 15 /* OpenBraceToken */: return parseTypeLiteral(); @@ -9276,17 +9450,18 @@ var ts; } function isStartOfType() { switch (token) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: - case 99 /* TypeOfKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: + case 101 /* TypeOfKeyword */: case 15 /* OpenBraceToken */: case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return true; case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, @@ -9304,7 +9479,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(154 /* ArrayType */, type.pos); + var node = createNode(156 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9326,10 +9501,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(157 /* IntersectionType */, parseArrayTypeOrHigher, 45 /* AmpersandToken */); + return parseUnionOrIntersectionType(159 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(156 /* UnionType */, parseIntersectionTypeOrHigher, 46 /* BarToken */); + return parseUnionOrIntersectionType(158 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -9346,8 +9521,8 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || - token === 52 /* QuestionToken */ || token === 55 /* EqualsToken */ || + if (token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || + token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { // ( id : // ( id , @@ -9373,24 +9548,24 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(150 /* FunctionType */); + return parseFunctionOrConstructorType(152 /* FunctionType */); } - if (token === 90 /* NewKeyword */) { - return parseFunctionOrConstructorType(151 /* ConstructorType */); + if (token === 92 /* NewKeyword */) { + return parseFunctionOrConstructorType(153 /* ConstructorType */); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(53 /* ColonToken */) ? parseType() : undefined; + return parseOptional(54 /* ColonToken */) ? parseType() : undefined; } // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token) { - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: @@ -9398,12 +9573,12 @@ var ts; case 17 /* OpenParenToken */: case 19 /* OpenBracketToken */: case 15 /* OpenBraceToken */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 90 /* NewKeyword */: - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: - case 67 /* Identifier */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 92 /* NewKeyword */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: + case 69 /* Identifier */: return true; default: return isIdentifier(); @@ -9416,16 +9591,16 @@ var ts; switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 76 /* DeleteKeyword */: - case 99 /* TypeOfKeyword */: - case 101 /* VoidKeyword */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 78 /* DeleteKeyword */: + case 101 /* TypeOfKeyword */: + case 103 /* VoidKeyword */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: case 25 /* LessThanToken */: - case 117 /* AwaitKeyword */: - case 112 /* YieldKeyword */: + case 119 /* AwaitKeyword */: + case 114 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -9444,9 +9619,9 @@ var ts; function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. return token !== 15 /* OpenBraceToken */ && - token !== 85 /* FunctionKeyword */ && - token !== 71 /* ClassKeyword */ && - token !== 54 /* AtToken */ && + token !== 87 /* FunctionKeyword */ && + token !== 73 /* ClassKeyword */ && + token !== 55 /* AtToken */ && isStartOfExpression(); } function allowInAndParseExpression() { @@ -9472,7 +9647,7 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 55 /* EqualsToken */) { + if (token !== 56 /* EqualsToken */) { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. @@ -9489,7 +9664,7 @@ var ts; } // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -9527,7 +9702,7 @@ var ts; // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 67 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { + if (expr.kind === 69 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -9543,7 +9718,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 112 /* YieldKeyword */) { + if (token === 114 /* YieldKeyword */) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -9572,7 +9747,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(182 /* YieldExpression */); + var node = createNode(184 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9592,8 +9767,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(172 /* ArrowFunction */, identifier.pos); - var parameter = createNode(136 /* Parameter */, identifier.pos); + var node = createNode(174 /* ArrowFunction */, identifier.pos); + var parameter = createNode(138 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -9635,7 +9810,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 116 /* AsyncKeyword */) { + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 118 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token === 34 /* EqualsGreaterThanToken */) { @@ -9648,7 +9823,7 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 116 /* AsyncKeyword */) { + if (token === 118 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; @@ -9668,7 +9843,7 @@ var ts; var third = nextToken(); switch (third) { case 34 /* EqualsGreaterThanToken */: - case 53 /* ColonToken */: + case 54 /* ColonToken */: case 15 /* OpenBraceToken */: return 1 /* True */; default: @@ -9699,7 +9874,7 @@ var ts; } // If we have something like "(a:", then we must have a // type-annotated parameter in an arrow function expression. - if (nextToken() === 53 /* ColonToken */) { + if (nextToken() === 54 /* ColonToken */) { return 1 /* True */; } // This *could* be a parenthesized arrow function. @@ -9717,10 +9892,10 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 81 /* ExtendsKeyword */) { + if (third === 83 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 55 /* EqualsToken */: + case 56 /* EqualsToken */: case 27 /* GreaterThanToken */: return false; default: @@ -9745,7 +9920,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(172 /* ArrowFunction */); + var node = createNode(174 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512 /* Async */); // Arrow functions are never generators. @@ -9755,7 +9930,7 @@ var ts; // a => (b => c) // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); // If we couldn't get parameters, we definitely could not parse out an arrow function. if (!node.parameters) { return undefined; @@ -9779,8 +9954,8 @@ var ts; return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); } if (token !== 23 /* SemicolonToken */ && - token !== 85 /* FunctionKeyword */ && - token !== 71 /* ClassKeyword */ && + token !== 87 /* FunctionKeyword */ && + token !== 73 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -9805,17 +9980,17 @@ var ts; } function parseConditionalExpressionRest(leftOperand) { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(180 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(182 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(53 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(53 /* ColonToken */)); + node.colonToken = parseExpectedToken(54 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(54 /* ColonToken */)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9824,7 +9999,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 88 /* InKeyword */ || t === 132 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 134 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9833,13 +10008,36 @@ var ts; reScanGreaterToken(); var newPrecedence = getBinaryOperatorPrecedence(); // Check the precedence to see if we should "take" this operator - if (newPrecedence <= precedence) { + // - For left associative operator (all operator but **), consume the operator, + // recursively call the function below, and parse binaryExpression as a rightOperand + // of the caller if the new precendence of the operator is greater then or equal to the current precendence. + // For example: + // a - b - c; + // ^token; leftOperand = b. Return b to the caller as a rightOperand + // a * b - c + // ^token; leftOperand = b. Return b to the caller as a rightOperand + // a - b * c; + // ^token; leftOperand = b. Return b * c to the caller as a rightOperand + // - For right associative operator (**), consume the operator, recursively call the function + // and parse binaryExpression as a rightOperand of the caller if the new precendence of + // the operator is strictly grater than the current precendence + // For example: + // a ** b ** c; + // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand + // a - b ** c; + // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand + // a ** b - c + // ^token; leftOperand = b. Return b to the caller as a rightOperand + var consumeCurrentOperator = token === 38 /* AsteriskAsteriskToken */ ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { break; } - if (token === 88 /* InKeyword */ && inDisallowInContext()) { + if (token === 90 /* InKeyword */ && inDisallowInContext()) { break; } - if (token === 114 /* AsKeyword */) { + if (token === 116 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -9860,22 +10058,22 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 88 /* InKeyword */) { + if (inDisallowInContext() && token === 90 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 51 /* BarBarToken */: + case 52 /* BarBarToken */: return 1; - case 50 /* AmpersandAmpersandToken */: + case 51 /* AmpersandAmpersandToken */: return 2; - case 46 /* BarToken */: + case 47 /* BarToken */: return 3; - case 47 /* CaretToken */: + case 48 /* CaretToken */: return 4; - case 45 /* AmpersandToken */: + case 46 /* AmpersandToken */: return 5; case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: @@ -9886,66 +10084,68 @@ var ts; case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - case 89 /* InstanceOfKeyword */: - case 88 /* InKeyword */: - case 114 /* AsKeyword */: + case 91 /* InstanceOfKeyword */: + case 90 /* InKeyword */: + case 116 /* AsKeyword */: return 7; - case 42 /* LessThanLessThanToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* LessThanLessThanToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: return 8; case 35 /* PlusToken */: case 36 /* MinusToken */: return 9; case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: return 10; + case 38 /* AsteriskAsteriskToken */: + return 11; } // -1 is lower than all other precedences. Returning it will cause binary expression // parsing to stop. return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(179 /* BinaryExpression */, left.pos); + var node = createNode(181 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(187 /* AsExpression */, left.pos); + var node = createNode(189 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(177 /* PrefixUnaryExpression */); + var node = createNode(179 /* PrefixUnaryExpression */); node.operator = token; nextToken(); - node.operand = parseUnaryExpressionOrHigher(); + node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(173 /* DeleteExpression */); + var node = createNode(175 /* DeleteExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(174 /* TypeOfExpression */); + var node = createNode(176 /* TypeOfExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(175 /* VoidExpression */); + var node = createNode(177 /* VoidExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token === 117 /* AwaitKeyword */) { + if (token === 119 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -9955,46 +10155,137 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(176 /* AwaitExpression */); + var node = createNode(178 /* AwaitExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + /** + * Parse ES7 unary expression and await expression + * + * ES7 UnaryExpression: + * 1) SimpleUnaryExpression[?yield] + * 2) IncrementExpression[?yield] ** UnaryExpression[?yield] + */ function parseUnaryExpressionOrHigher() { if (isAwaitExpression()) { return parseAwaitExpression(); } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 /* AsteriskAsteriskToken */ ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38 /* AsteriskAsteriskToken */) { + var diagnostic; + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } + else { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + /** + * Parse ES7 simple-unary expression or higher: + * + * ES7 SimpleUnaryExpression: + * 1) IncrementExpression[?yield] + * 2) delete UnaryExpression[?yield] + * 3) void UnaryExpression[?yield] + * 4) typeof UnaryExpression[?yield] + * 5) + UnaryExpression[?yield] + * 6) - UnaryExpression[?yield] + * 7) ~ UnaryExpression[?yield] + * 8) ! UnaryExpression[?yield] + */ + function parseSimpleUnaryExpression() { switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: return parsePrefixUnaryExpression(); - case 76 /* DeleteKeyword */: + case 78 /* DeleteKeyword */: return parseDeleteExpression(); - case 99 /* TypeOfKeyword */: + case 101 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: return parseVoidExpression(); case 25 /* LessThanToken */: - if (sourceFile.languageVariant !== 1 /* JSX */) { - return parseTypeAssertion(); - } - if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); - } - // Fall through + // This is modified UnaryExpression grammar in TypeScript + // UnaryExpression (modified): + // < type > UnaryExpression + return parseTypeAssertion(); default: - return parsePostfixExpressionOrHigher(); + return parseIncrementExpression(); } } - function parsePostfixExpressionOrHigher() { + /** + * Check if the current token can possibly be an ES7 increment expression. + * + * ES7 IncrementExpression: + * LeftHandSideExpression[?Yield] + * LeftHandSideExpression[?Yield][no LineTerminator here]++ + * LeftHandSideExpression[?Yield][no LineTerminator here]-- + * ++LeftHandSideExpression[?Yield] + * --LeftHandSideExpression[?Yield] + */ + function isIncrementExpression() { + // This function is called inside parseUnaryExpression to decide + // whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly + switch (token) { + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 78 /* DeleteKeyword */: + case 101 /* TypeOfKeyword */: + case 103 /* VoidKeyword */: + return false; + case 25 /* LessThanToken */: + // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression + if (sourceFile.languageVariant !== 1 /* JSX */) { + return false; + } + // We are in JSX context and the token is part of JSXElement. + // Fall through + default: + return true; + } + } + /** + * Parse ES7 IncrementExpression. IncrementExpression is used instead of ES6's PostFixExpression. + * + * ES7 IncrementExpression[yield]: + * 1) LeftHandSideExpression[?yield] + * 2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++ + * 3) LeftHandSideExpression[?yield] [[no LineTerminator here]]-- + * 4) ++LeftHandSideExpression[?yield] + * 5) --LeftHandSideExpression[?yield] + * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression + */ + function parseIncrementExpression() { + if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { + var node = createNode(179 /* PrefixUnaryExpression */); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 /* JSX */ && token === 25 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + // JSXElement is part of primaryExpression + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); + } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 40 /* PlusPlusToken */ || token === 41 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(178 /* PostfixUnaryExpression */, expression.pos); + if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(180 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -10033,7 +10324,7 @@ var ts; // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token === 93 /* SuperKeyword */ + var expression = token === 95 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); // Now, we *may* be complete. However, we might have consumed the start of a @@ -10098,7 +10389,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(164 /* PropertyAccessExpression */, expression.pos); + var node = createNode(166 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10106,27 +10397,27 @@ var ts; } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); - if (opening.kind === 233 /* JsxOpeningElement */) { - var node = createNode(231 /* JsxElement */, opening.pos); + if (opening.kind === 235 /* JsxOpeningElement */) { + var node = createNode(233 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 232 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 234 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements return opening; } } function parseJsxText() { - var node = createNode(234 /* JsxText */, scanner.getStartPos()); + var node = createNode(236 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 234 /* JsxText */: + case 236 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -10165,11 +10456,11 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(233 /* JsxOpeningElement */, fullStart); + node = createNode(235 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { - parseExpected(38 /* SlashToken */); + parseExpected(39 /* SlashToken */); if (inExpressionContext) { parseExpected(27 /* GreaterThanToken */); } @@ -10177,7 +10468,7 @@ var ts; parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); scanJsxText(); } - node = createNode(232 /* JsxSelfClosingElement */, fullStart); + node = createNode(234 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10188,7 +10479,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(133 /* QualifiedName */, elementName.pos); + var node = createNode(135 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -10196,7 +10487,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(238 /* JsxExpression */); + var node = createNode(240 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { node.expression = parseExpression(); @@ -10215,9 +10506,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(236 /* JsxAttribute */); + var node = createNode(238 /* JsxAttribute */); node.name = parseIdentifierName(); - if (parseOptional(55 /* EqualsToken */)) { + if (parseOptional(56 /* EqualsToken */)) { switch (token) { case 9 /* StringLiteral */: node.initializer = parseLiteralNode(); @@ -10230,7 +10521,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(237 /* JsxSpreadAttribute */); + var node = createNode(239 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -10238,7 +10529,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(235 /* JsxClosingElement */); + var node = createNode(237 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -10251,18 +10542,18 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(169 /* TypeAssertionExpression */); + var node = createNode(171 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(164 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(166 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10271,7 +10562,7 @@ var ts; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(19 /* OpenBracketToken */)) { - var indexedAccess = createNode(165 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(167 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -10287,7 +10578,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(168 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(170 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -10310,7 +10601,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(166 /* CallExpression */, expression.pos); + var callExpr = createNode(168 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -10318,7 +10609,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(166 /* CallExpression */, expression.pos); + var callExpr = createNode(168 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10356,18 +10647,18 @@ var ts; case 21 /* DotToken */: // foo. case 18 /* CloseParenToken */: // foo) case 20 /* CloseBracketToken */: // foo] - case 53 /* ColonToken */: // foo: + case 54 /* ColonToken */: // foo: case 23 /* SemicolonToken */: // foo; - case 52 /* QuestionToken */: // foo? + case 53 /* QuestionToken */: // foo? case 30 /* EqualsEqualsToken */: // foo == case 32 /* EqualsEqualsEqualsToken */: // foo === case 31 /* ExclamationEqualsToken */: // foo != case 33 /* ExclamationEqualsEqualsToken */: // foo !== - case 50 /* AmpersandAmpersandToken */: // foo && - case 51 /* BarBarToken */: // foo || - case 47 /* CaretToken */: // foo ^ - case 45 /* AmpersandToken */: // foo & - case 46 /* BarToken */: // foo | + case 51 /* AmpersandAmpersandToken */: // foo && + case 52 /* BarBarToken */: // foo || + case 48 /* CaretToken */: // foo ^ + case 46 /* AmpersandToken */: // foo & + case 47 /* BarToken */: // foo | case 16 /* CloseBraceToken */: // foo } case 1 /* EndOfFileToken */: // these cases can't legally follow a type arg list. However, they're not legal @@ -10390,11 +10681,11 @@ var ts; case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: return parseTokenNode(); case 17 /* OpenParenToken */: return parseParenthesizedExpression(); @@ -10402,7 +10693,7 @@ var ts; return parseArrayLiteralExpression(); case 15 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 116 /* AsyncKeyword */: + case 118 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -10410,14 +10701,14 @@ var ts; break; } return parseFunctionExpression(); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassExpression(); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionExpression(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return parseNewExpression(); - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: if (reScanSlashToken() === 10 /* RegularExpressionLiteral */) { return parseLiteralNode(); } @@ -10428,28 +10719,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(170 /* ParenthesizedExpression */); + var node = createNode(172 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(183 /* SpreadElementExpression */); + var node = createNode(185 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(185 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(187 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(162 /* ArrayLiteralExpression */); + var node = createNode(164 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048 /* MultiLine */; @@ -10458,11 +10749,11 @@ var ts; return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(121 /* GetKeyword */)) { - return parseAccessorDeclaration(143 /* GetAccessor */, fullStart, decorators, modifiers); + if (parseContextualModifier(123 /* GetKeyword */)) { + return parseAccessorDeclaration(145 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(127 /* SetKeyword */)) { - return parseAccessorDeclaration(144 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(129 /* SetKeyword */)) { + return parseAccessorDeclaration(146 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10479,28 +10770,38 @@ var ts; var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - // Parse to check if it is short-hand property assignment or normal property assignment - if ((token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(244 /* ShorthandPropertyAssignment */, fullStart); + // check if it is short-hand property assignment or normal property assignment + // NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production + // CoverInitializedName[Yield] : + // IdentifierReference[?Yield] Initializer[In, ?Yield] + // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */ || token === 56 /* EqualsToken */); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(246 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56 /* EqualsToken */); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(243 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(245 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(163 /* ObjectLiteralExpression */); + var node = createNode(165 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048 /* MultiLine */; @@ -10519,9 +10820,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(171 /* FunctionExpression */); + var node = createNode(173 /* FunctionExpression */); setModifiers(node, parseModifiers()); - parseExpected(85 /* FunctionKeyword */); + parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); @@ -10530,7 +10831,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -10541,8 +10842,8 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(167 /* NewExpression */); - parseExpected(90 /* NewKeyword */); + var node = createNode(169 /* NewExpression */); + parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token === 17 /* OpenParenToken */) { @@ -10552,7 +10853,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(190 /* Block */); + var node = createNode(192 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10582,25 +10883,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(192 /* EmptyStatement */); + var node = createNode(194 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(194 /* IfStatement */); - parseExpected(86 /* IfKeyword */); + var node = createNode(196 /* IfStatement */); + parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(78 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(80 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(195 /* DoStatement */); - parseExpected(77 /* DoKeyword */); + var node = createNode(197 /* DoStatement */); + parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(102 /* WhileKeyword */); + parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10612,8 +10913,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(196 /* WhileStatement */); - parseExpected(102 /* WhileKeyword */); + var node = createNode(198 /* WhileStatement */); + parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10622,11 +10923,11 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(84 /* ForKeyword */); + parseExpected(86 /* ForKeyword */); parseExpected(17 /* OpenParenToken */); var initializer = undefined; if (token !== 23 /* SemicolonToken */) { - if (token === 100 /* VarKeyword */ || token === 106 /* LetKeyword */ || token === 72 /* ConstKeyword */) { + if (token === 102 /* VarKeyword */ || token === 108 /* LetKeyword */ || token === 74 /* ConstKeyword */) { initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { @@ -10634,22 +10935,22 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(88 /* InKeyword */)) { - var forInStatement = createNode(198 /* ForInStatement */, pos); + if (parseOptional(90 /* InKeyword */)) { + var forInStatement = createNode(200 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(132 /* OfKeyword */)) { - var forOfStatement = createNode(199 /* ForOfStatement */, pos); + else if (parseOptional(134 /* OfKeyword */)) { + var forOfStatement = createNode(201 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(197 /* ForStatement */, pos); + var forStatement = createNode(199 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10667,7 +10968,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */); + parseExpected(kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10675,8 +10976,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(202 /* ReturnStatement */); - parseExpected(92 /* ReturnKeyword */); + var node = createNode(204 /* ReturnStatement */); + parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -10684,8 +10985,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(203 /* WithStatement */); - parseExpected(103 /* WithKeyword */); + var node = createNode(205 /* WithStatement */); + parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10693,30 +10994,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(239 /* CaseClause */); - parseExpected(69 /* CaseKeyword */); + var node = createNode(241 /* CaseClause */); + parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(240 /* DefaultClause */); - parseExpected(75 /* DefaultKeyword */); - parseExpected(53 /* ColonToken */); + var node = createNode(242 /* DefaultClause */); + parseExpected(77 /* DefaultKeyword */); + parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 69 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(204 /* SwitchStatement */); - parseExpected(94 /* SwitchKeyword */); + var node = createNode(206 /* SwitchStatement */); + parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(218 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(220 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10731,29 +11032,29 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(206 /* ThrowStatement */); - parseExpected(96 /* ThrowKeyword */); + var node = createNode(208 /* ThrowStatement */); + parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(207 /* TryStatement */); - parseExpected(98 /* TryKeyword */); + var node = createNode(209 /* TryStatement */); + parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); - node.catchClause = token === 70 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token === 83 /* FinallyKeyword */) { - parseExpected(83 /* FinallyKeyword */); + if (!node.catchClause || token === 85 /* FinallyKeyword */) { + parseExpected(85 /* FinallyKeyword */); node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(242 /* CatchClause */); - parseExpected(70 /* CatchKeyword */); + var result = createNode(244 /* CatchClause */); + parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); } @@ -10762,8 +11063,8 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(208 /* DebuggerStatement */); - parseExpected(74 /* DebuggerKeyword */); + var node = createNode(210 /* DebuggerStatement */); + parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -10773,14 +11074,14 @@ var ts; // a colon. var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 67 /* Identifier */ && parseOptional(53 /* ColonToken */)) { - var labeledStatement = createNode(205 /* LabeledStatement */, fullStart); + if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { + var labeledStatement = createNode(207 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(193 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(195 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -10792,7 +11093,7 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 85 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token === 87 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); @@ -10801,12 +11102,12 @@ var ts; function isDeclaration() { while (true) { switch (token) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -10829,36 +11130,36 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 105 /* InterfaceKeyword */: - case 130 /* TypeKeyword */: + case 107 /* InterfaceKeyword */: + case 132 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 116 /* AsyncKeyword */: - case 120 /* DeclareKeyword */: + case 115 /* AbstractKeyword */: + case 118 /* AsyncKeyword */: + case 122 /* DeclareKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 87 /* ImportKeyword */: + case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token); - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: nextToken(); - if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 75 /* DefaultKeyword */) { + if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { return true; } continue; - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: - case 113 /* AbstractKeyword */: + case 113 /* StaticKeyword */: nextToken(); continue; default: @@ -10871,47 +11172,47 @@ var ts; } function isStartOfStatement() { switch (token) { - case 54 /* AtToken */: + case 55 /* AtToken */: case 23 /* SemicolonToken */: case 15 /* OpenBraceToken */: - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: - case 86 /* IfKeyword */: - case 77 /* DoKeyword */: - case 102 /* WhileKeyword */: - case 84 /* ForKeyword */: - case 73 /* ContinueKeyword */: - case 68 /* BreakKeyword */: - case 92 /* ReturnKeyword */: - case 103 /* WithKeyword */: - case 94 /* SwitchKeyword */: - case 96 /* ThrowKeyword */: - case 98 /* TryKeyword */: - case 74 /* DebuggerKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: + case 88 /* IfKeyword */: + case 79 /* DoKeyword */: + case 104 /* WhileKeyword */: + case 86 /* ForKeyword */: + case 75 /* ContinueKeyword */: + case 70 /* BreakKeyword */: + case 94 /* ReturnKeyword */: + case 105 /* WithKeyword */: + case 96 /* SwitchKeyword */: + case 98 /* ThrowKeyword */: + case 100 /* TryKeyword */: + case 76 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return true; - case 72 /* ConstKeyword */: - case 80 /* ExportKeyword */: - case 87 /* ImportKeyword */: + case 74 /* ConstKeyword */: + case 82 /* ExportKeyword */: + case 89 /* ImportKeyword */: return isStartOfDeclaration(); - case 116 /* AsyncKeyword */: - case 120 /* DeclareKeyword */: - case 105 /* InterfaceKeyword */: - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: - case 130 /* TypeKeyword */: + case 118 /* AsyncKeyword */: + case 122 /* DeclareKeyword */: + case 107 /* InterfaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: + case 132 /* TypeKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10934,61 +11235,61 @@ var ts; return parseEmptyStatement(); case 15 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); - case 100 /* VarKeyword */: + case 102 /* VarKeyword */: return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 106 /* LetKeyword */: + case 108 /* LetKeyword */: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); } break; - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 86 /* IfKeyword */: + case 88 /* IfKeyword */: return parseIfStatement(); - case 77 /* DoKeyword */: + case 79 /* DoKeyword */: return parseDoStatement(); - case 102 /* WhileKeyword */: + case 104 /* WhileKeyword */: return parseWhileStatement(); - case 84 /* ForKeyword */: + case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 73 /* ContinueKeyword */: - return parseBreakOrContinueStatement(200 /* ContinueStatement */); - case 68 /* BreakKeyword */: - return parseBreakOrContinueStatement(201 /* BreakStatement */); - case 92 /* ReturnKeyword */: + case 75 /* ContinueKeyword */: + return parseBreakOrContinueStatement(202 /* ContinueStatement */); + case 70 /* BreakKeyword */: + return parseBreakOrContinueStatement(203 /* BreakStatement */); + case 94 /* ReturnKeyword */: return parseReturnStatement(); - case 103 /* WithKeyword */: + case 105 /* WithKeyword */: return parseWithStatement(); - case 94 /* SwitchKeyword */: + case 96 /* SwitchKeyword */: return parseSwitchStatement(); - case 96 /* ThrowKeyword */: + case 98 /* ThrowKeyword */: return parseThrowStatement(); - case 98 /* TryKeyword */: + case 100 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return parseTryStatement(); - case 74 /* DebuggerKeyword */: + case 76 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 54 /* AtToken */: + case 55 /* AtToken */: return parseDeclaration(); - case 116 /* AsyncKeyword */: - case 105 /* InterfaceKeyword */: - case 130 /* TypeKeyword */: - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: - case 120 /* DeclareKeyword */: - case 72 /* ConstKeyword */: - case 79 /* EnumKeyword */: - case 80 /* ExportKeyword */: - case 87 /* ImportKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 110 /* PublicKeyword */: - case 113 /* AbstractKeyword */: - case 111 /* StaticKeyword */: + case 118 /* AsyncKeyword */: + case 107 /* InterfaceKeyword */: + case 132 /* TypeKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: + case 122 /* DeclareKeyword */: + case 74 /* ConstKeyword */: + case 81 /* EnumKeyword */: + case 82 /* ExportKeyword */: + case 89 /* ImportKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: + case 115 /* AbstractKeyword */: + case 113 /* StaticKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -11001,35 +11302,35 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: return parseVariableStatement(fullStart, decorators, modifiers); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassDeclaration(fullStart, decorators, modifiers); - case 105 /* InterfaceKeyword */: + case 107 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 130 /* TypeKeyword */: + case 132 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 79 /* EnumKeyword */: + case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 87 /* ImportKeyword */: + case 89 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: nextToken(); - return token === 75 /* DefaultKeyword */ || token === 55 /* EqualsToken */ ? + return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(229 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(231 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -11051,24 +11352,24 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(185 /* OmittedExpression */); + return createNode(187 /* OmittedExpression */); } - var node = createNode(161 /* BindingElement */); + var node = createNode(163 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(161 /* BindingElement */); + var node = createNode(163 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 53 /* ColonToken */) { + if (tokenIsIdentifier && token !== 54 /* ColonToken */) { node.name = propertyName; } else { - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -11076,14 +11377,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(159 /* ObjectBindingPattern */); + var node = createNode(161 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(160 /* ArrayBindingPattern */); + var node = createNode(162 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -11102,7 +11403,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(209 /* VariableDeclaration */); + var node = createNode(211 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -11111,14 +11412,14 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(210 /* VariableDeclarationList */); + var node = createNode(212 /* VariableDeclarationList */); switch (token) { - case 100 /* VarKeyword */: + case 102 /* VarKeyword */: break; - case 106 /* LetKeyword */: + case 108 /* LetKeyword */: node.flags |= 16384 /* Let */; break; - case 72 /* ConstKeyword */: + case 74 /* ConstKeyword */: node.flags |= 32768 /* Const */; break; default: @@ -11134,7 +11435,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 132 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 134 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -11149,7 +11450,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(191 /* VariableStatement */, fullStart); + var node = createNode(193 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -11157,29 +11458,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(211 /* FunctionDeclaration */, fullStart); + var node = createNode(213 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(85 /* FunctionKeyword */); + parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(142 /* Constructor */, pos); + var node = createNode(144 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(119 /* ConstructorKeyword */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + parseExpected(121 /* ConstructorKeyword */); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(141 /* MethodDeclaration */, fullStart); + var method = createNode(143 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -11187,12 +11488,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512 /* Async */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(139 /* PropertyDeclaration */, fullStart); + var property = createNode(141 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11218,7 +11519,7 @@ var ts; var name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } @@ -11234,16 +11535,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: return true; default: return false; @@ -11251,7 +11552,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 54 /* AtToken */) { + if (token === 55 /* AtToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. @@ -11284,7 +11585,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 127 /* SetKeyword */ || idToken === 121 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 129 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -11292,9 +11593,9 @@ var ts; switch (token) { case 17 /* OpenParenToken */: // Method declaration case 25 /* LessThanToken */: // Generic Method declaration - case 53 /* ColonToken */: // Type Annotation for declaration - case 55 /* EqualsToken */: // Initializer for declaration - case 52 /* QuestionToken */: + case 54 /* ColonToken */: // Type Annotation for declaration + case 56 /* EqualsToken */: // Initializer for declaration + case 53 /* QuestionToken */: return true; default: // Covers @@ -11311,14 +11612,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(54 /* AtToken */)) { + if (!parseOptional(55 /* AtToken */)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(137 /* Decorator */, decoratorStart); + var decorator = createNode(139 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11352,7 +11653,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 116 /* AsyncKeyword */) { + if (token === 118 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -11367,7 +11668,7 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(189 /* SemicolonClassElement */); + var result = createNode(191 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11378,7 +11679,7 @@ var ts; if (accessor) { return accessor; } - if (token === 119 /* ConstructorKeyword */) { + if (token === 121 /* ConstructorKeyword */) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -11395,7 +11696,7 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_7 = createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var name_7 = createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. @@ -11405,17 +11706,17 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 184 /* ClassExpression */); + /*modifiers*/ undefined, 186 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(71 /* ClassKeyword */); - node.name = parseOptionalIdentifier(); + parseExpected(73 /* ClassKeyword */); + node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true); if (parseExpected(15 /* OpenBraceToken */)) { @@ -11429,6 +11730,19 @@ var ts; } return finishNode(node); } + function parseNameOfClassDeclarationOrExpression() { + // implements is a future reserved word so + // 'class implements' might mean either + // - class expression with omitted name, 'implements' starts heritage clause + // - class with name 'implements' + // 'isImplementsClause' helps to disambiguate between these two cases + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); + } function parseHeritageClauses(isClassHeritageClause) { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } @@ -11441,8 +11755,8 @@ var ts; return parseList(20 /* HeritageClauses */, parseHeritageClause); } function parseHeritageClause() { - if (token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */) { - var node = createNode(241 /* HeritageClause */); + if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { + var node = createNode(243 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11451,7 +11765,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(186 /* ExpressionWithTypeArguments */); + var node = createNode(188 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11459,16 +11773,16 @@ var ts; return finishNode(node); } function isHeritageClause() { - return token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* InterfaceDeclaration */, fullStart); + var node = createNode(215 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(105 /* InterfaceKeyword */); + parseExpected(107 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false); @@ -11476,13 +11790,13 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214 /* TypeAliasDeclaration */, fullStart); + var node = createNode(216 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(130 /* TypeKeyword */); + parseExpected(132 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); node.type = parseType(); parseSemicolon(); return finishNode(node); @@ -11492,16 +11806,16 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(245 /* EnumMember */, scanner.getStartPos()); + var node = createNode(247 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* EnumDeclaration */, fullStart); + var node = createNode(217 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(79 /* EnumKeyword */); + parseExpected(81 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(15 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); @@ -11513,7 +11827,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(217 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(219 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11524,7 +11838,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(216 /* ModuleDeclaration */, fullStart); + var node = createNode(218 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 131072 /* Namespace */; @@ -11538,7 +11852,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216 /* ModuleDeclaration */, fullStart); + var node = createNode(218 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(/*internName*/ true); @@ -11547,11 +11861,11 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(124 /* NamespaceKeyword */)) { + if (parseOptional(126 /* NamespaceKeyword */)) { flags |= 131072 /* Namespace */; } else { - parseExpected(123 /* ModuleKeyword */); + parseExpected(125 /* ModuleKeyword */); if (token === 9 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -11559,42 +11873,42 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 125 /* RequireKeyword */ && + return token === 127 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 17 /* OpenParenToken */; } function nextTokenIsSlash() { - return nextToken() === 38 /* SlashToken */; + return nextToken() === 39 /* SlashToken */; } function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 24 /* CommaToken */ || - token === 131 /* FromKeyword */; + token === 133 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(87 /* ImportKeyword */); + parseExpected(89 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 131 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 133 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(219 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(221 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } // Import statement - var importDeclaration = createNode(220 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(222 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11604,7 +11918,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(131 /* FromKeyword */); + parseExpected(133 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11617,7 +11931,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(221 /* ImportClause */, fullStart); + var importClause = createNode(223 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11627,7 +11941,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(223 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(225 /* NamedImports */); } return finishNode(importClause); } @@ -11637,8 +11951,8 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(230 /* ExternalModuleReference */); - parseExpected(125 /* RequireKeyword */); + var node = createNode(232 /* ExternalModuleReference */); + parseExpected(127 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(18 /* CloseParenToken */); @@ -11659,9 +11973,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(222 /* NamespaceImport */); + var namespaceImport = createNode(224 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); - parseExpected(114 /* AsKeyword */); + parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -11674,14 +11988,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 223 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 225 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(228 /* ExportSpecifier */); + return parseImportOrExportSpecifier(230 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(224 /* ImportSpecifier */); + return parseImportOrExportSpecifier(226 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11695,9 +12009,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 114 /* AsKeyword */) { + if (token === 116 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(114 /* AsKeyword */); + parseExpected(116 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -11706,27 +12020,27 @@ var ts; else { node.name = identifierName; } - if (kind === 224 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 226 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226 /* ExportDeclaration */, fullStart); + var node = createNode(228 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(131 /* FromKeyword */); + parseExpected(133 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(227 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(229 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 131 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(131 /* FromKeyword */); + if (token === 133 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(133 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11734,14 +12048,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(225 /* ExportAssignment */, fullStart); + var node = createNode(227 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(55 /* EqualsToken */)) { + if (parseOptional(56 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(75 /* DefaultKeyword */); + parseExpected(77 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -11807,10 +12121,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */ - || node.kind === 220 /* ImportDeclaration */ - || node.kind === 225 /* ExportAssignment */ - || node.kind === 226 /* ExportDeclaration */ + || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ + || node.kind === 222 /* ImportDeclaration */ + || node.kind === 227 /* ExportAssignment */ + || node.kind === 228 /* ExportDeclaration */ ? node : undefined; }); @@ -11856,22 +12170,22 @@ var ts; function isJSDocType() { switch (token) { case 37 /* AsteriskToken */: - case 52 /* QuestionToken */: + case 53 /* QuestionToken */: case 17 /* OpenParenToken */: case 19 /* OpenBracketToken */: - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: case 15 /* OpenBraceToken */: - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: case 22 /* DotDotDotToken */: - case 90 /* NewKeyword */: - case 95 /* ThisKeyword */: + case 92 /* NewKeyword */: + case 97 /* ThisKeyword */: return true; } return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -11885,7 +12199,7 @@ var ts; scanner.setText(sourceText, start, length); // Prime the first token for us to start processing. token = nextToken(); - var result = createNode(247 /* JSDocTypeExpression */); + var result = createNode(249 /* JSDocTypeExpression */); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -11895,13 +12209,13 @@ var ts; JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 46 /* BarToken */) { - var unionType = createNode(251 /* JSDocUnionType */, type.pos); + if (token === 47 /* BarToken */) { + var unionType = createNode(253 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 55 /* EqualsToken */) { - var optionalType = createNode(258 /* JSDocOptionalType */, type.pos); + if (token === 56 /* EqualsToken */) { + var optionalType = createNode(260 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11912,20 +12226,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(250 /* JSDocArrayType */, type.pos); + var arrayType = createNode(252 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } - else if (token === 52 /* QuestionToken */) { - var nullableType = createNode(253 /* JSDocNullableType */, type.pos); + else if (token === 53 /* QuestionToken */) { + var nullableType = createNode(255 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 48 /* ExclamationToken */) { - var nonNullableType = createNode(254 /* JSDocNonNullableType */, type.pos); + else if (token === 49 /* ExclamationToken */) { + var nonNullableType = createNode(256 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11940,80 +12254,80 @@ var ts; switch (token) { case 37 /* AsteriskToken */: return parseJSDocAllType(); - case 52 /* QuestionToken */: + case 53 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); case 17 /* OpenParenToken */: return parseJSDocUnionType(); case 19 /* OpenBracketToken */: return parseJSDocTupleType(); - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: return parseJSDocNonNullableType(); case 15 /* OpenBraceToken */: return parseJSDocRecordType(); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseJSDocFunctionType(); case 22 /* DotDotDotToken */: return parseJSDocVariadicType(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return parseJSDocConstructorType(); - case 95 /* ThisKeyword */: + case 97 /* ThisKeyword */: return parseJSDocThisType(); - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(262 /* JSDocThisType */); + var result = createNode(264 /* JSDocThisType */); nextToken(); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(261 /* JSDocConstructorType */); + var result = createNode(263 /* JSDocConstructorType */); nextToken(); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(260 /* JSDocVariadicType */); + var result = createNode(262 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(259 /* JSDocFunctionType */); + var result = createNode(261 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); checkForTrailingComma(result.parameters); parseExpected(18 /* CloseParenToken */); - if (token === 53 /* ColonToken */) { + if (token === 54 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(136 /* Parameter */); + var parameter = createNode(138 /* Parameter */); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(258 /* JSDocOptionalType */, type.pos); + var result = createNode(260 /* JSDocOptionalType */, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(257 /* JSDocTypeReference */); + var result = createNode(259 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); while (parseOptional(21 /* DotToken */)) { if (token === 25 /* LessThanToken */) { @@ -12043,13 +12357,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(133 /* QualifiedName */, left.pos); + var result = createNode(135 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(255 /* JSDocRecordType */); + var result = createNode(257 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -12057,22 +12371,22 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(256 /* JSDocRecordMember */); + var result = createNode(258 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); - if (token === 53 /* ColonToken */) { + if (token === 54 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(254 /* JSDocNonNullableType */); + var result = createNode(256 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(252 /* JSDocTupleType */); + var result = createNode(254 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -12086,7 +12400,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(251 /* JSDocUnionType */); + var result = createNode(253 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -12097,14 +12411,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(46 /* BarToken */)) { + while (parseOptional(47 /* BarToken */)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(248 /* JSDocAllType */); + var result = createNode(250 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -12125,19 +12439,19 @@ var ts; token === 16 /* CloseBraceToken */ || token === 18 /* CloseParenToken */ || token === 27 /* GreaterThanToken */ || - token === 55 /* EqualsToken */ || - token === 46 /* BarToken */) { - var result = createNode(249 /* JSDocUnknownType */, pos); + token === 56 /* EqualsToken */ || + token === 47 /* BarToken */) { + var result = createNode(251 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(253 /* JSDocNullableType */, pos); + var result = createNode(255 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -12219,7 +12533,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(263 /* JSDocComment */, start); + var result = createNode(265 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12230,7 +12544,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(54 /* AtToken */, pos - 1); + var atToken = createNode(55 /* AtToken */, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -12256,7 +12570,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(264 /* JSDocTag */, atToken.pos); + var result = createNode(266 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -12307,7 +12621,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(265 /* JSDocParameterTag */, atToken.pos); + var result = createNode(267 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12317,27 +12631,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266 /* JSDocReturnTag */, atToken.pos); + var result = createNode(268 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 269 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(267 /* JSDocTypeTag */, atToken.pos); + var result = createNode(269 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 270 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -12350,7 +12664,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(135 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(137 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -12361,7 +12675,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(268 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(270 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -12382,7 +12696,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(67 /* Identifier */, startPos); + var result = createNode(69 /* Identifier */, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -12505,7 +12819,7 @@ var ts; switch (node.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 67 /* Identifier */: + case 69 /* Identifier */: return true; } return false; @@ -12898,17 +13212,19 @@ var ts; var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; + var symbolCount = 0; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, @@ -12999,6 +13315,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var cjsRequireType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -13069,6 +13386,7 @@ var ts; diagnostics.add(diagnostic); } function createSymbol(flags, name) { + symbolCount++; return new Symbol(flags, name); } function getExcludedSymbolFlags(flags) { @@ -13198,10 +13516,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 246 /* SourceFile */); + return ts.getAncestor(node, 248 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 246 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -13220,18 +13538,62 @@ var ts; } // return undefined if we can't find a symbol. } - /** Returns true if node1 is defined before node 2**/ - function isDefinedBefore(node1, node2) { - var file1 = ts.getSourceFileOfNode(node1); - var file2 = ts.getSourceFileOfNode(node2); - if (file1 === file2) { - return node1.pos <= node2.pos; + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + // nodes are in different files and order cannot be determines + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } - if (!compilerOptions.outFile && !compilerOptions.out) { - return true; + if (declaration.pos <= usage.pos) { + // declaration is before usage + // still might be illegal if usage is in the initializer of the variable declaration + return declaration.kind !== 211 /* VariableDeclaration */ || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + // declaration is after usage + // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + if (declaration.parent.parent.kind === 193 /* VariableStatement */ || + declaration.parent.parent.kind === 199 /* ForStatement */) { + // variable statement/for statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + return isSameScopeDescendentOf(usage, declaration, container); + } + else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ || + declaration.parent.parent.kind === 200 /* ForInStatement */) { + // ForIn/ForOf case - use site should not be used in expression part + var expression = declaration.parent.parent.expression; + return isSameScopeDescendentOf(usage, expression, container); + } + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 141 /* PropertyDeclaration */ && + (current.parent.flags & 128 /* Static */) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; } - var sourceFiles = host.getSourceFiles(); - return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with @@ -13258,13 +13620,13 @@ var ts; } } switch (location.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location)) + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) break; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 246 /* SourceFile */ || - (location.kind === 216 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { + if (location.kind === 248 /* SourceFile */ || + (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { // It's an external module. Because of module/namespace merging, a module's exports are in scope, // yet we never want to treat an export specifier as putting a member in scope. Therefore, // if the name we find is purely an export specifier, it is not actually considered in scope. @@ -13278,7 +13640,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 228 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { break; } result = moduleExports["default"]; @@ -13292,13 +13654,13 @@ var ts; break loop; } break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -13315,9 +13677,9 @@ var ts; } } break; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -13328,7 +13690,7 @@ var ts; } break loop; } - if (location.kind === 184 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 186 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -13344,9 +13706,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 213 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 215 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -13354,19 +13716,19 @@ var ts; } } break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 171 /* FunctionExpression */: + case 173 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -13379,7 +13741,7 @@ var ts; } } break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -13388,7 +13750,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 136 /* Parameter */) { + if (location.parent && location.parent.kind === 138 /* Parameter */) { location = location.parent; } // @@ -13434,8 +13796,11 @@ var ts; // block - scope variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, // we want to check for block- scoped - if (meaning & 2 /* BlockScopedVariable */ && result.flags & 2 /* BlockScopedVariable */) { - checkResolvedBlockScopedVariable(result, errorLocation); + if (meaning & 2 /* BlockScopedVariable */) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } } } return result; @@ -13445,32 +13810,7 @@ var ts; // Block-scoped variables cannot be used before their definition var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - // first check if usage is lexically located after the declaration - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - // lexical check succeeded however code still can be illegal. - // - block scoped variables cannot be used in its initializers - // let x = x; // illegal but usage is lexically after definition - // - in ForIn/ForOf statements variable cannot be contained in expression part - // for (let x in x) - // for (let x of x) - // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 209 /* VariableDeclaration */); - var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 191 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 197 /* ForStatement */) { - // variable statement/for statement case, - // use site should not be inside variable declaration (initializer of declaration or binding element) - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); - } - else if (variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 198 /* ForInStatement */) { - // ForIn/ForOf case - use site should not be used in expression part - var expression = variableDeclaration.parent.parent.expression; - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); - } - } - if (isUsedBeforeDeclaration) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -13491,10 +13831,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 219 /* ImportEqualsDeclaration */) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 220 /* ImportDeclaration */) { + while (node && node.kind !== 222 /* ImportDeclaration */) { node = node.parent; } return node; @@ -13504,7 +13844,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 230 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 232 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -13611,17 +13951,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return getTargetOfImportClause(node); - case 222 /* NamespaceImport */: + case 224 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 224 /* ImportSpecifier */: + case 226 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 228 /* ExportSpecifier */: + case 230 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -13666,11 +14006,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 225 /* ExportAssignment */) { + if (node.kind === 227 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 228 /* ExportSpecifier */) { + else if (node.kind === 230 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -13683,7 +14023,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 219 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 221 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -13692,17 +14032,17 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 67 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 69 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 67 /* Identifier */ || entityName.parent.kind === 133 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 135 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 219 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 221 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -13715,16 +14055,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 67 /* Identifier */) { + if (name.kind === 69 /* Identifier */) { var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 133 /* QualifiedName */ || name.kind === 164 /* PropertyAccessExpression */) { - var left = name.kind === 133 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 133 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 135 /* QualifiedName */ || name.kind === 166 /* PropertyAccessExpression */) { + var left = name.kind === 135 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 135 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -13743,11 +14083,6 @@ var ts; ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } - function isExternalModuleNameRelative(moduleName) { - // TypeScript 1.0 spec (April 2014): 11.2.1 - // An external module name is "relative" if the first term is "." or "..". - return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; - } function resolveExternalModuleName(location, moduleReferenceExpression) { if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { return; @@ -13760,7 +14095,10 @@ var ts; if (moduleName === undefined) { return; } - var isRelative = isExternalModuleNameRelative(moduleName); + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } + var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); if (symbol) { @@ -13876,7 +14214,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 142 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -13946,17 +14284,17 @@ var ts; } } switch (location_1.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location_1)) { + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -13997,7 +14335,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -14034,7 +14372,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -14107,8 +14445,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 216 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 246 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || + (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -14144,12 +14482,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 152 /* TypeQuery */) { + if (entityName.parent.kind === 154 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 133 /* QualifiedName */ || entityName.kind === 164 /* PropertyAccessExpression */ || - entityName.parent.kind === 219 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 135 /* QualifiedName */ || entityName.kind === 166 /* PropertyAccessExpression */ || + entityName.parent.kind === 221 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -14204,10 +14542,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 158 /* ParenthesizedType */) { + while (node.kind === 160 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 216 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -14221,10 +14559,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: return "(Anonymous class)"; - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -14307,6 +14645,7 @@ var ts; } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; + var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any @@ -14316,6 +14655,12 @@ var ts; ? "any" : type.intrinsicName); } + else if (type.flags & 33554432 /* ThisType */) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } else if (type.flags & 4096 /* Reference */) { writeTypeReference(type, flags); } @@ -14357,11 +14702,10 @@ var ts; writeType(types[i], delimiter === 24 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); } } - function writeSymbolTypeReference(symbol, typeArguments, pos, end) { - // Unnamed function expressions, arrow functions, and unnamed class expressions have reserved names that - // we don't want to display - if (!isReservedMemberName(symbol.name)) { - buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */); + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + // Unnamed function expressions and arrow functions have reserved names that we don't want to display + if (symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */, 0 /* None */, flags); } if (pos < end) { writePunctuation(writer, 25 /* LessThanToken */); @@ -14375,7 +14719,7 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments; + var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(typeArguments[0], 64 /* InElementType */); writePunctuation(writer, 19 /* OpenBracketToken */); @@ -14399,12 +14743,13 @@ var ts; // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i); + writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } } - writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length); + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } function writeTupleType(type) { @@ -14416,7 +14761,7 @@ var ts; if (flags & 64 /* InElementType */) { writePunctuation(writer, 17 /* OpenParenToken */); } - writeTypeList(type.types, type.flags & 16384 /* Union */ ? 46 /* BarToken */ : 45 /* AmpersandToken */); + writeTypeList(type.types, type.flags & 16384 /* Union */ ? 47 /* BarToken */ : 46 /* AmpersandToken */); if (flags & 64 /* InElementType */) { writePunctuation(writer, 18 /* CloseParenToken */); } @@ -14440,7 +14785,7 @@ var ts; } else { // Recursive usage, use any - writeKeyword(writer, 115 /* AnyKeyword */); + writeKeyword(writer, 117 /* AnyKeyword */); } } else { @@ -14464,7 +14809,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 246 /* SourceFile */ || declaration.parent.kind === 217 /* ModuleBlock */; + return declaration.parent.kind === 248 /* SourceFile */ || declaration.parent.kind === 219 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -14474,7 +14819,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 99 /* TypeOfKeyword */); + writeKeyword(writer, 101 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } @@ -14510,7 +14855,7 @@ var ts; if (flags & 64 /* InElementType */) { writePunctuation(writer, 17 /* OpenParenToken */); } - writeKeyword(writer, 90 /* NewKeyword */); + writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { @@ -14519,6 +14864,8 @@ var ts; return; } } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; writePunctuation(writer, 15 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); @@ -14530,7 +14877,7 @@ var ts; } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 90 /* NewKeyword */); + writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14540,11 +14887,11 @@ var ts; // [x: string]: writePunctuation(writer, 19 /* OpenBracketToken */); writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 128 /* StringKeyword */); + writeKeyword(writer, 130 /* StringKeyword */); writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14554,11 +14901,11 @@ var ts; // [x: number]: writePunctuation(writer, 19 /* OpenBracketToken */); writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 126 /* NumberKeyword */); + writeKeyword(writer, 128 /* NumberKeyword */); writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14573,7 +14920,7 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14583,9 +14930,9 @@ var ts; else { buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14594,6 +14941,7 @@ var ts; } writer.decreaseIndent(); writePunctuation(writer, 16 /* CloseBraceToken */); + inObjectTypeLiteral = saveInObjectTypeLiteral; } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -14607,7 +14955,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 81 /* ExtendsKeyword */); + writeKeyword(writer, 83 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -14619,9 +14967,9 @@ var ts; } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } @@ -14668,14 +15016,14 @@ var ts; writePunctuation(writer, 34 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 122 /* IsKeyword */); + writeKeyword(writer, 124 /* IsKeyword */); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -14711,13 +15059,13 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 216 /* ModuleDeclaration */) { + if (node.kind === 218 /* ModuleDeclaration */) { if (node.name.kind === 9 /* StringLiteral */) { return node; } } - else if (node.kind === 246 /* SourceFile */) { - return ts.isExternalModule(node) ? node : undefined; + else if (node.kind === 248 /* SourceFile */) { + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -14765,70 +15113,70 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 161 /* BindingElement */: + case 163 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 211 /* FunctionDeclaration */: - case 215 /* EnumDeclaration */: - case 219 /* ImportEqualsDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 213 /* FunctionDeclaration */: + case 217 /* EnumDeclaration */: + case 221 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 219 /* ImportEqualsDeclaration */ && parent_4.kind !== 246 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_4); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 142 /* Constructor */: - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 147 /* IndexSignature */: - case 136 /* Parameter */: - case 217 /* ModuleBlock */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 153 /* TypeLiteral */: - case 149 /* TypeReference */: - case 154 /* ArrayType */: - case 155 /* TupleType */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 158 /* ParenthesizedType */: + case 144 /* Constructor */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 149 /* IndexSignature */: + case 138 /* Parameter */: + case 219 /* ModuleBlock */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 155 /* TypeLiteral */: + case 151 /* TypeReference */: + case 156 /* ArrayType */: + case 157 /* TupleType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: + case 160 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: return false; // Type parameters are always visible - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: // Source file is always visible - case 246 /* SourceFile */: + case 248 /* SourceFile */: return true; - // Export assignements do not create name bindings outside the module - case 225 /* ExportAssignment */: + // Export assignments do not create name bindings outside the module + case 227 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -14844,10 +15192,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 225 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 227 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 228 /* ExportSpecifier */) { + else if (node.parent.kind === 230 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -14939,7 +15287,7 @@ var ts; node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 209 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 211 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -14957,10 +15305,16 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } + // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been + // assigned by contextual typing. + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } // Return the inferred type for a binding element function getTypeForBindingElement(declaration) { var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + var parentType = getTypeForBindingElementParent(pattern.parent); // If parent has the unknown (error) type, then so does this binding element if (parentType === unknownType) { return unknownType; @@ -14975,7 +15329,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 159 /* ObjectBindingPattern */) { + if (pattern.kind === 161 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -15019,10 +15373,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 198 /* ForInStatement */) { + if (declaration.parent.parent.kind === 200 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 199 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 201 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -15036,11 +15390,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136 /* Parameter */) { + if (declaration.kind === 138 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 144 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143 /* GetAccessor */); + if (func.kind === 146 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -15056,7 +15410,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 244 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 246 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -15102,7 +15456,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. - var elementTypes = ts.map(elements, function (e) { return e.kind === 185 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 187 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -15118,7 +15472,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 159 /* ObjectBindingPattern */ + return pattern.kind === 161 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -15140,14 +15494,14 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 243 /* PropertyAssignment */ ? getWidenedType(type) : type; + return declaration.kind !== 245 /* PropertyAssignment */ ? getWidenedType(type) : type; } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 136 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 138 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -15162,13 +15516,21 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 242 /* CatchClause */) { + if (declaration.parent.kind === 244 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 225 /* ExportAssignment */) { + if (declaration.kind === 227 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } + // Handle module.exports = expr + if (declaration.kind === 181 /* BinaryExpression */) { + return links.type = checkExpression(declaration.right); + } + // Handle exports.p = expr + if (declaration.kind === 166 /* PropertyAccessExpression */) { + return checkExpressionCached(declaration.parent.right); + } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; @@ -15194,7 +15556,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 143 /* GetAccessor */) { + if (accessor.kind === 145 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -15210,8 +15572,8 @@ var ts; if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 144 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 146 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -15240,7 +15602,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -15340,9 +15702,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */ || - node.kind === 211 /* FunctionDeclaration */ || node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */ || node.kind === 172 /* ArrowFunction */) { + if (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */ || + node.kind === 213 /* FunctionDeclaration */ || node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */ || node.kind === 174 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -15352,7 +15714,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -15361,8 +15723,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 212 /* ClassDeclaration */ || - node.kind === 184 /* ClassExpression */ || node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 214 /* ClassDeclaration */ || + node.kind === 186 /* ClassExpression */ || node.kind === 216 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -15482,7 +15844,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 213 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 215 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -15503,6 +15865,32 @@ var ts; } } } + // Returns true if the interface given by the symbol is free of "this" references. Specifically, the result is + // true if the interface itself contains no references to "this" in its body, if all base types are interfaces, + // and if none of the base interfaces have a "this" type. + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 215 /* InterfaceDeclaration */) { + if (declaration.flags & 524288 /* ContainsThis */) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0; _b < baseTypeNodes.length; _b++) { + var node = baseTypeNodes[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056 /* Type */, /*ignoreErrors*/ true); + if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -15510,7 +15898,12 @@ var ts; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - if (outerTypeParameters || localTypeParameters) { + // A class or interface is generic if it has type parameters or a "this" type. We always give classes a "this" type + // because it is not feasible to analyze all members to determine if the "this" type escapes the class (in particular, + // property types inferred from initializers and method return types inferred from return statements are very hard + // to exhaustively analyze). We give interfaces a "this" type if we can't definitely determine that they are free of + // "this" references. + if (outerTypeParameters || localTypeParameters || kind === 1024 /* Class */ || !isIndependentInterface(symbol)) { type.flags |= 4096 /* Reference */; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; @@ -15519,6 +15912,9 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; + type.thisType = createType(512 /* TypeParameter */ | 33554432 /* ThisType */); + type.thisType.symbol = symbol; + type.thisType.constraint = getTypeWithThisArgument(type); } } return links.declaredType; @@ -15531,7 +15927,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 214 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 216 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -15564,7 +15960,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -15597,6 +15993,79 @@ var ts; } return unknownType; } + // A type reference is considered independent if each type argument is considered independent. + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + // A type is considered independent if it the any, string, number, boolean, symbol, or void keyword, a string + // literal type, an array with an element type that is considered independent, or a type reference that is + // considered independent. + function isIndependentType(node) { + switch (node.kind) { + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 9 /* StringLiteral */: + return true; + case 156 /* ArrayType */: + return isIndependentType(node.elementType); + case 151 /* TypeReference */: + return isIndependentTypeReference(node); + } + return false; + } + // A variable-like declaration is considered independent (free of this references) if it has a type annotation + // that specifies an independent type, or if it has no type annotation and no initializer (and thus of type any). + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + // A function-like declaration is considered independent (free of this references) if it has a return type + // annotation that is considered independent and if each parameter is considered independent. + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 144 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + // Returns true if the class or interface member given by the symbol is free of "this" references. The + // function may return false for symbols that are actually free of "this" references because it is not + // feasible to perform a complete analysis in all cases. In particular, property members with types + // inferred from their initializers and function members with inferred return types are convervatively + // assumed not to be free of "this" references. + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return isIndependentVariableLikeDeclaration(declaration); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } function createSymbolTable(symbols) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { @@ -15605,11 +16074,13 @@ var ts; } return result; } - function createInstantiatedSymbolTable(symbols, mapper) { + // The mappingThisOnly flag indicates that the only type parameter being mapped is "this". When the flag is true, + // we check symbols to see if we can quickly conclude they are free of "this" references, thus needing no instantiation. + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; - result[symbol.name] = instantiateSymbol(symbol, mapper); + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } @@ -15640,44 +16111,54 @@ var ts; } return type; } - function resolveClassOrInterfaceMembers(type) { - var target = resolveDeclaredMembers(type); - var members = target.symbol.members; - var callSignatures = target.declaredCallSignatures; - var constructSignatures = target.declaredConstructSignatures; - var stringIndexType = target.declaredStringIndexType; - var numberIndexType = target.declaredNumberIndexType; - var baseTypes = getBaseTypes(target); + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096 /* Reference */) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexType = source.declaredStringIndexType; + var numberIndexType = source.declaredNumberIndexType; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexType = instantiateType(source.declaredStringIndexType, mapper); + numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + } + var baseTypes = getBaseTypes(source); if (baseTypes.length) { - members = createSymbolTable(target.declaredProperties); + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0; _i < baseTypes.length; _i++) { var baseType = baseTypes[_i]; - addInheritedMembers(members, getPropertiesOfObjectType(baseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1 /* Number */); + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); } } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } function resolveTypeReferenceMembers(type) { - var target = resolveDeclaredMembers(type.target); - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; - ts.forEach(getBaseTypes(target), function (baseType) { - var instantiatedBaseType = instantiateType(baseType, mapper); - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); - }); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); @@ -15726,7 +16207,9 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true))); + var arrayElementType = getUnionType(type.elementTypes, /*noSubtypeReduction*/ true); + // Make the tuple type itself the 'this' type by including an extra type argument + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -15842,7 +16325,14 @@ var ts; var constructSignatures; var stringIndexType; var numberIndexType; - if (symbol.flags & 2048 /* TypeLiteral */) { + if (type.target) { + members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); + callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); + constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); + stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0 /* String */), type.mapper); + numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1 /* Number */), type.mapper); + } + else if (symbol.flags & 2048 /* TypeLiteral */) { members = symbol.members; callSignatures = getSignaturesOfSymbol(members["__call"]); constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -15879,7 +16369,10 @@ var ts; } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (type.flags & 4096 /* Reference */) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { resolveClassOrInterfaceMembers(type); } else if (type.flags & 65536 /* Anonymous */) { @@ -15894,9 +16387,6 @@ var ts; else if (type.flags & 32768 /* Intersection */) { resolveIntersectionTypeMembers(type); } - else { - resolveTypeReferenceMembers(type); - } } return type; } @@ -16125,7 +16615,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 142 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 144 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -16157,7 +16647,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 148 /* TypePredicate */) { + if (declaration.type.kind === 150 /* TypePredicate */) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -16169,8 +16659,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 143 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 144 /* SetAccessor */); + if (declaration.kind === 145 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 146 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -16188,19 +16678,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -16215,6 +16705,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { @@ -16277,7 +16777,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 142 /* Constructor */ || signature.declaration.kind === 146 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 144 /* Constructor */ || signature.declaration.kind === 148 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -16291,7 +16791,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 126 /* NumberKeyword */ : 128 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 128 /* NumberKeyword */ : 130 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -16320,30 +16820,33 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137 /* TypeParameter */).parent); } function getTypeListId(types) { - switch (types.length) { - case 1: - return "" + types[0].id; - case 2: - return types[0].id + "," + types[1].id; - default: - var result = ""; - for (var i = 0; i < types.length; i++) { - if (i > 0) { - result += ","; + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; } - result += types[i].id; - } - return result; + return result; + } } + return ""; } // This function is used to propagate certain flags when creating new object type references and union types. // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type @@ -16361,7 +16864,7 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getPropagatingFlagsOfTypes(typeArguments); + var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -16380,13 +16883,13 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 149 /* TypeReference */ && n.typeName.kind === 67 /* Identifier */) { + if (n.kind === 151 /* TypeReference */ && n.typeName.kind === 69 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -16473,7 +16976,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 149 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 151 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -16505,9 +17008,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: return declaration; } } @@ -16548,10 +17051,13 @@ var ts; * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); - var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); + var typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace, name) { + var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */ | 107455 /* Value */); + } function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -16567,17 +17073,17 @@ var ts; /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ - function createTypeFromGenericGlobalType(genericGlobalType, elementType) { - return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType; + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, elementType); + return createTypeFromGenericGlobalType(globalIterableType, [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType); + return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); } function createArrayType(elementType) { - return createTypeFromGenericGlobalType(globalArrayType, elementType); + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -16749,48 +17255,68 @@ var ts; } return links.resolvedType; } + function getThisType(node) { + var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { + if (!(container.flags & 128 /* Static */)) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } function getTypeFromTypeNode(node) { switch (node.kind) { - case 115 /* AnyKeyword */: + case 117 /* AnyKeyword */: return anyType; - case 128 /* StringKeyword */: + case 130 /* StringKeyword */: return stringType; - case 126 /* NumberKeyword */: + case 128 /* NumberKeyword */: return numberType; - case 118 /* BooleanKeyword */: + case 120 /* BooleanKeyword */: return booleanType; - case 129 /* SymbolKeyword */: + case 131 /* SymbolKeyword */: return esSymbolType; - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: return voidType; + case 97 /* ThisKeyword */: + return getTypeFromThisTypeNode(node); case 9 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return getTypeFromTypeReference(node); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return booleanType; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 155 /* TupleType */: + case 157 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 156 /* UnionType */: + case 158 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 157 /* IntersectionType */: + case 159 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 153 /* TypeLiteral */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 155 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -16894,7 +17420,7 @@ var ts; type: instantiateType(signature.typePredicate.type, mapper) }; } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -16932,21 +17458,13 @@ var ts; } // Mark the anonymous type as instantiated such that our infinite instantiation detection logic can recognize it var result = createObjectType(65536 /* Anonymous */ | 131072 /* Instantiated */, type.symbol); - result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); - result.members = createSymbolTable(result.properties); - result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); - result.constructSignatures = instantiateList(getSignaturesOfType(type, 1 /* Construct */), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); - if (stringIndexType) - result.stringIndexType = instantiateType(stringIndexType, mapper); - if (numberIndexType) - result.numberIndexType = instantiateType(numberIndexType, mapper); + result.target = type; + result.mapper = mapper; mapper.instantiations[type.id] = result; return result; } function instantiateType(type, mapper) { - if (mapper !== identityMapper) { + if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } @@ -16972,27 +17490,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 179 /* BinaryExpression */: - return node.operatorToken.kind === 51 /* BarBarToken */ && + case 181 /* BinaryExpression */: + return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 243 /* PropertyAssignment */: + case 245 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -17176,7 +17694,7 @@ var ts; else { if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if relationship holds for all type arguments - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; } } @@ -17205,7 +17723,7 @@ var ts; if (source.flags & 80896 /* ObjectType */ && target.flags & 80896 /* ObjectType */) { if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if all type arguments are identical - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, /*reportErrors*/ false)) { + if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) { return result; } } @@ -17322,9 +17840,14 @@ var ts; } return result; } - function typesRelatedTo(sources, targets, reportErrors) { + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0 /* False */; + } var result = -1 /* True */; - for (var i = 0, len = sources.length; i < len; i++) { + for (var i = 0; i < targets.length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0 /* False */; @@ -17542,7 +18065,7 @@ var ts; if (kind === 1 /* Construct */) { // Only want to compare the construct signatures for abstractness guarantees. // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform + // (internally we are checking the corresponding declaration), it is enough to perform // the check and report an error once over all pairs of source and target construct signatures. // // sourceSig and targetSig are (possibly) undefined. @@ -18042,22 +18565,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 136 /* Parameter */: + case 138 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -18167,9 +18690,10 @@ var ts; } else if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // If source and target are references to the same generic type, infer from type arguments - var sourceTypes = source.typeArguments; - var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } @@ -18347,10 +18871,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return true; - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: node = node.parent; continue; default: @@ -18396,12 +18920,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 55 /* FirstAssignment */ && node.operatorToken.kind <= 66 /* LastAssignment */) { + if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { var n = node.left; - while (n.kind === 170 /* ParenthesizedExpression */) { + while (n.kind === 172 /* ParenthesizedExpression */) { n = n.expression; } - if (n.kind === 67 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -18415,55 +18939,55 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: - case 170 /* ParenthesizedExpression */: - case 177 /* PrefixUnaryExpression */: - case 173 /* DeleteExpression */: - case 176 /* AwaitExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 178 /* PostfixUnaryExpression */: - case 182 /* YieldExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 190 /* Block */: - case 191 /* VariableStatement */: - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 202 /* ReturnStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 206 /* ThrowStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - case 233 /* JsxOpeningElement */: - case 238 /* JsxExpression */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: + case 172 /* ParenthesizedExpression */: + case 179 /* PrefixUnaryExpression */: + case 175 /* DeleteExpression */: + case 178 /* AwaitExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 180 /* PostfixUnaryExpression */: + case 184 /* YieldExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 192 /* Block */: + case 193 /* VariableStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 204 /* ReturnStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 208 /* ThrowStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + case 235 /* JsxOpeningElement */: + case 240 /* JsxExpression */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -18480,37 +19004,37 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 194 /* IfStatement */: + case 196 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); } break; - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); } break; - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { - if (node.operatorToken.kind === 50 /* AmpersandAmpersandToken */) { + if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); } - else if (node.operatorToken.kind === 51 /* BarBarToken */) { + else if (node.operatorToken.kind === 52 /* BarBarToken */) { narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); } } break; - case 246 /* SourceFile */: - case 216 /* ModuleDeclaration */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: + case 248 /* SourceFile */: + case 218 /* ModuleDeclaration */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -18527,12 +19051,12 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 174 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + if (expr.left.kind !== 176 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 67 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; @@ -18592,7 +19116,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -18664,27 +19188,27 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 166 /* CallExpression */: + case 168 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: var operator = expr.operatorToken.kind; if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 50 /* AmpersandAmpersandToken */) { + else if (operator === 51 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 51 /* BarBarToken */) { + else if (operator === 52 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 89 /* InstanceOfKeyword */) { + else if (operator === 91 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 177 /* PrefixUnaryExpression */: - if (expr.operator === 48 /* ExclamationToken */) { + case 179 /* PrefixUnaryExpression */: + if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -18702,7 +19226,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 172 /* ArrowFunction */) { + if (container.kind === 174 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -18733,7 +19257,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 242 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { return; } // - check if binding is used in some function @@ -18742,12 +19266,12 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 210 /* VariableDeclarationList */) { + while (container.kind !== 212 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 191 /* VariableStatement */) { + if (container.kind === 193 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } @@ -18767,7 +19291,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 139 /* PropertyDeclaration */ || container.kind === 142 /* Constructor */) { + if (container.kind === 141 /* PropertyDeclaration */ || container.kind === 144 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -18781,32 +19305,32 @@ var ts; var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 172 /* ArrowFunction */) { + if (container.kind === 174 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 142 /* Constructor */: + case 144 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -18815,35 +19339,35 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 136 /* Parameter */) { + if (n.kind === 138 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; var container = ts.getSuperContainer(node, /*includeFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 172 /* ArrowFunction */) { + // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting + while (container && container.kind === 174 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*includeFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - // always set NodeCheckFlags for 'super' expression node + // always set NodeCheckFlags for 'super' expression node if (canUseSuperExpression) { if ((container.flags & 128 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; @@ -18866,7 +19390,7 @@ var ts; return unknownType; } if (!canUseSuperExpression) { - if (container && container.kind === 134 /* ComputedPropertyName */) { + if (container && container.kind === 136 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -18877,7 +19401,7 @@ var ts; } return unknownType; } - if (container.kind === 142 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 144 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -18892,7 +19416,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 142 /* Constructor */; + return container.kind === 144 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -18902,19 +19426,19 @@ var ts; // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { if (container.flags & 128 /* Static */) { - return container.kind === 141 /* MethodDeclaration */ || - container.kind === 140 /* MethodSignature */ || - container.kind === 143 /* GetAccessor */ || - container.kind === 144 /* SetAccessor */; + return container.kind === 143 /* MethodDeclaration */ || + container.kind === 142 /* MethodSignature */ || + container.kind === 145 /* GetAccessor */ || + container.kind === 146 /* SetAccessor */; } else { - return container.kind === 141 /* MethodDeclaration */ || - container.kind === 140 /* MethodSignature */ || - container.kind === 143 /* GetAccessor */ || - container.kind === 144 /* SetAccessor */ || - container.kind === 139 /* PropertyDeclaration */ || - container.kind === 138 /* PropertySignature */ || - container.kind === 142 /* Constructor */; + return container.kind === 143 /* MethodDeclaration */ || + container.kind === 142 /* MethodSignature */ || + container.kind === 145 /* GetAccessor */ || + container.kind === 146 /* SetAccessor */ || + container.kind === 141 /* PropertyDeclaration */ || + container.kind === 140 /* PropertySignature */ || + container.kind === 144 /* Constructor */; } } } @@ -18955,7 +19479,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136 /* Parameter */) { + if (declaration.kind === 138 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -18988,7 +19512,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 136 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 138 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -18999,8 +19523,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 142 /* Constructor */ || - functionDecl.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144 /* SetAccessor */))) { + functionDecl.kind === 144 /* Constructor */ || + functionDecl.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -19022,7 +19546,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 168 /* TaggedTemplateExpression */) { + if (template.parent.kind === 170 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -19030,13 +19554,13 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { + if (operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 51 /* BarBarToken */) { + else if (operator === 52 /* BarBarToken */) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); @@ -19143,7 +19667,7 @@ var ts; } function getContextualTypeForJsxExpression(expr) { // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 236 /* JsxAttribute */) { + if (expr.parent.kind === 238 /* JsxAttribute */) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -19153,7 +19677,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 237 /* JsxSpreadAttribute */) { + if (expr.kind === 239 /* JsxSpreadAttribute */) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -19174,38 +19698,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 209 /* VariableDeclaration */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 163 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 172 /* ArrowFunction */: - case 202 /* ReturnStatement */: + case 174 /* ArrowFunction */: + case 204 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 243 /* PropertyAssignment */: + case 245 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 188 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 181 /* TemplateExpression */); + case 190 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 183 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return getContextualType(parent); - case 238 /* JsxExpression */: - case 237 /* JsxSpreadAttribute */: + case 240 /* JsxExpression */: + case 239 /* JsxSpreadAttribute */: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -19222,7 +19746,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 171 /* FunctionExpression */ || node.kind === 172 /* ArrowFunction */; + return node.kind === 173 /* FunctionExpression */ || node.kind === 174 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -19236,7 +19760,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -19299,13 +19823,13 @@ var ts; // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 179 /* BinaryExpression */ && parent.operatorToken.kind === 55 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 181 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 243 /* PropertyAssignment */) { + if (parent.kind === 245 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 162 /* ArrayLiteralExpression */) { + if (parent.kind === 164 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -19321,8 +19845,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 161 /* BindingElement */ && !!node.initializer) || - (node.kind === 179 /* BinaryExpression */ && node.operatorToken.kind === 55 /* EqualsToken */); + return (node.kind === 163 /* BindingElement */ && !!node.initializer) || + (node.kind === 181 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -19331,7 +19855,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 183 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -19355,7 +19879,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 185 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -19370,7 +19894,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 160 /* ArrayBindingPattern */ || pattern.kind === 162 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 162 /* ArrayBindingPattern */ || pattern.kind === 164 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -19378,7 +19902,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 185 /* OmittedExpression */) { + if (patternElement.kind !== 187 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -19393,7 +19917,7 @@ var ts; return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { - return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 136 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -19443,30 +19967,30 @@ var ts; return links.resolvedType; } function checkObjectLiteral(node, contextualMapper) { + var inDestructuringPattern = isAssignmentTarget(node); // Grammar checking - checkGrammarObjectLiteralExpression(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 159 /* ObjectBindingPattern */ || contextualType.pattern.kind === 163 /* ObjectLiteralExpression */); - var inDestructuringPattern = isAssignmentTarget(node); + (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 243 /* PropertyAssignment */ || - memberDecl.kind === 244 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 245 /* PropertyAssignment */ || + memberDecl.kind === 246 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 243 /* PropertyAssignment */) { + if (memberDecl.kind === 245 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 141 /* MethodDeclaration */) { + else if (memberDecl.kind === 143 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 244 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 246 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -19474,7 +19998,9 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - if (memberDecl.kind === 243 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) { + var isOptional = (memberDecl.kind === 245 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 246 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + if (isOptional) { prop.flags |= 536870912 /* Optional */; } } @@ -19504,7 +20030,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 143 /* GetAccessor */ || memberDecl.kind === 144 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 145 /* GetAccessor */ || memberDecl.kind === 146 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -19566,7 +20092,7 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 67 /* Identifier */) { + if (lhs.kind === 69 /* Identifier */) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && @@ -19587,18 +20113,18 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: checkJsxExpression(child); break; - case 231 /* JsxElement */: + case 233 /* JsxElement */: checkJsxElement(child); break; - case 232 /* JsxSelfClosingElement */: + case 234 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; default: // No checks for JSX Text - ts.Debug.assert(child.kind === 234 /* JsxText */); + ts.Debug.assert(child.kind === 236 /* JsxText */); } } return jsxElementType || anyType; @@ -19614,7 +20140,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 133 /* QualifiedName */) { + if (tagName.kind === 135 /* QualifiedName */) { return false; } else { @@ -19733,12 +20259,14 @@ var ts; // Look up the value in the current scope if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4 /* ClassElement */; - getSymbolLinks(valueSymbol).referenced = true; + if (valueSymbol.flags & 8388608 /* Alias */) { + markAliasSymbolAsReferenced(valueSymbol); + } } return valueSymbol || unknownSymbol; } function resolveJsxTagName(node) { - if (node.tagName.kind === 67 /* Identifier */) { + if (node.tagName.kind === 69 /* Identifier */) { var tag = node.tagName; var sym = getResolvedSymbol(tag); return sym.exportSymbol || sym; @@ -19923,11 +20451,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 236 /* JsxAttribute */) { + if (node.attributes[i].kind === 238 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 237 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 239 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -19957,7 +20485,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 139 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -19973,8 +20501,8 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 93 /* SuperKeyword */) { - var errorNode = node.kind === 164 /* PropertyAccessExpression */ ? + if (left.kind === 95 /* SuperKeyword */) { + var errorNode = node.kind === 166 /* PropertyAccessExpression */ ? node.name : node.right; // TS 1.0 spec (April 2014): 4.8.2 @@ -19984,7 +20512,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 141 /* MethodDeclaration */) { + if (getDeclarationKindFromSymbol(prop) !== 143 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -20017,7 +20545,7 @@ var ts; } // Property is known to be protected at this point // All protected properties of a supertype are accessible in a super access - if (left.kind === 93 /* SuperKeyword */) { + if (left.kind === 95 /* SuperKeyword */) { return true; } // A protected property is accessible in the declaring class and classes derived from it @@ -20030,6 +20558,10 @@ var ts; return true; } // An instance property must be accessed through an instance of the enclosing class + if (type.flags & 33554432 /* ThisType */) { + // get the original type -- represented as the type constraint of the 'this' type + type = getConstraintOfTypeParameter(type); + } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); @@ -20056,18 +20588,18 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 /* ThisType */ ? apparentType : type)); } return unknownType; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32 /* Class */) { - checkClassPropertyAccess(node, left, type, prop); + checkClassPropertyAccess(node, left, apparentType, prop); } return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 164 /* PropertyAccessExpression */ + var left = node.kind === 166 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -20083,7 +20615,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -20155,6 +20687,7 @@ var ts; } /** * If indexArgumentExpression is a string literal or number literal, returns its text. + * If indexArgumentExpression is a constant value, returns its string value. * If indexArgumentExpression is a well known symbol, returns the property name corresponding * to this symbol, as long as it is a proper symbol reference. * Otherwise, returns undefined. @@ -20163,6 +20696,12 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } + if (indexArgumentExpression.kind === 167 /* ElementAccessExpression */ || indexArgumentExpression.kind === 166 /* PropertyAccessExpression */) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); @@ -20212,10 +20751,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 137 /* Decorator */) { + else if (node.kind !== 139 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -20281,7 +20820,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 183 /* SpreadElementExpression */) { + if (arg && arg.kind === 185 /* SpreadElementExpression */) { return i; } } @@ -20293,13 +20832,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 181 /* TemplateExpression */) { + if (tagExpression.template.kind === 183 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -20316,7 +20855,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -20325,7 +20864,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 167 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 169 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -20404,7 +20943,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -20463,7 +21002,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); @@ -20495,16 +21034,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 181 /* TemplateExpression */) { + if (template.kind === 183 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -20529,25 +21068,29 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { switch (node.parent.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) + // If we are emitting decorators for ES3, we will only pass two arguments. + if (languageVersion === 0 /* ES3 */) { + return 2; + } // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 136 /* Parameter */: + case 138 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -20572,25 +21115,25 @@ var ts; function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. switch (node.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 136 /* Parameter */: + case 138 /* Parameter */: // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } // fall-through - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -20619,33 +21162,33 @@ var ts; function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 136 /* Parameter */: + case 138 /* Parameter */: node = node.parent; - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } // For a non-constructor parameter decorator, the `propertyKey` will be either // a string or a symbol, based on the name of the parameter's containing method. // fall-through - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will // be either string or symbol. var element = node; switch (element.name.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getStringLiteralType(element.name); - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { return nameType; @@ -20673,18 +21216,18 @@ var ts; // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a paramter decorator switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 136 /* Parameter */: + case 138 /* Parameter */: // The `parameterIndex` for a parameter decorator is always a number return numberType; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -20717,10 +21260,10 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { return globalTemplateStringsArrayType; } // This is not a synthetic argument, so we return 'undefined' @@ -20732,8 +21275,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 137 /* Decorator */ || - (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */)) { + if (node.kind === 139 /* Decorator */ || + (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -20742,11 +21285,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -20755,13 +21298,13 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 168 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 137 /* Decorator */; + var isTaggedTemplate = node.kind === 170 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 139 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (node.expression.kind !== 93 /* SuperKeyword */) { + if (node.expression.kind !== 95 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -20968,7 +21511,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 93 /* SuperKeyword */) { + if (node.expression.kind === 95 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated @@ -21101,16 +21644,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 136 /* Parameter */: + case 138 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -21147,16 +21690,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 166 /* CallExpression */) { + if (node.kind === 168 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 167 /* NewExpression */) { + else if (node.kind === 169 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 170 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -21174,15 +21717,15 @@ var ts; // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 93 /* SuperKeyword */) { + if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 167 /* NewExpression */) { + if (node.kind === 169 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 142 /* Constructor */ && - declaration.kind !== 146 /* ConstructSignature */ && - declaration.kind !== 151 /* ConstructorType */) { + declaration.kind !== 144 /* Constructor */ && + declaration.kind !== 148 /* ConstructSignature */ && + declaration.kind !== 153 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -21190,6 +21733,10 @@ var ts; return anyType; } } + // In JavaScript files, calls to any identifier 'require' are treated as external module imports + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -21224,10 +21771,24 @@ var ts; assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } } + // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push + // the destructured type into the contained binding elements. + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 187 /* OmittedExpression */) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + assignBindingElementTypes(element); + } + } + } + } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { // Even if the parameter already has a type, it might be because it was given a type while @@ -21279,7 +21840,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 190 /* Block */) { + if (func.body.kind !== 192 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -21398,7 +21959,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 206 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 208 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -21413,7 +21974,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 190 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */) { return; } var bodyBlock = func.body; @@ -21431,10 +21992,10 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 171 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 173 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -21477,14 +22038,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -21506,7 +22067,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 190 /* Block */) { + if (node.body.kind === 192 /* Block */) { checkSourceElement(node.body); } else { @@ -21552,24 +22113,24 @@ var ts; // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { - case 67 /* Identifier */: { + case 69 /* Identifier */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 164 /* PropertyAccessExpression */: { + case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 165 /* ElementAccessExpression */: - // old compiler doesn't check indexed assess + case 167 /* ElementAccessExpression */: + // old compiler doesn't check indexed access return true; - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -21577,12 +22138,12 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: { + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; } - case 165 /* ElementAccessExpression */: { + case 167 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 9 /* StringLiteral */) { @@ -21592,7 +22153,7 @@ var ts; } return false; } - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -21638,15 +22199,15 @@ var ts; switch (node.operator) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: + case 50 /* TildeToken */: if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: return booleanType; - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors @@ -21706,31 +22267,31 @@ var ts; function isConstEnumSymbol(symbol) { return (symbol.flags & 128 /* ConstEnum */) !== 0; } - function checkInstanceOfExpression(node, leftType, rightType) { + function checkInstanceOfExpression(left, right, leftType, rightType) { // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } - function checkInExpression(node, leftType, rightType) { + function checkInExpression(left, right, leftType, rightType) { // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } @@ -21738,7 +22299,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { + if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; var type = isTypeAny(sourceType) @@ -21747,7 +22308,12 @@ var ts; isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { - checkDestructuringAssignment(p.initializer || name_13, type); + if (p.kind === 246 /* ShorthandPropertyAssignment */) { + checkDestructuringAssignment(p, type); + } + else { + checkDestructuringAssignment(p.initializer || name_13, type); + } } else { error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); @@ -21767,8 +22333,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 185 /* OmittedExpression */) { - if (e.kind !== 183 /* SpreadElementExpression */) { + if (e.kind !== 187 /* OmittedExpression */) { + if (e.kind !== 185 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -21793,7 +22359,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 179 /* BinaryExpression */ && restExpression.operatorToken.kind === 55 /* EqualsToken */) { + if (restExpression.kind === 181 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -21805,15 +22371,26 @@ var ts; } return sourceType; } - function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 246 /* ShorthandPropertyAssignment */) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 163 /* ObjectLiteralExpression */) { + if (target.kind === 165 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 162 /* ArrayLiteralExpression */) { + if (target.kind === 164 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -21826,34 +22403,39 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - var operator = node.operatorToken.kind; - if (operator === 55 /* EqualsToken */ && (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 /* EqualsToken */ && (left.kind === 165 /* ObjectLiteralExpression */ || left.kind === 164 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); switch (operator) { case 37 /* AsteriskToken */: - case 58 /* AsteriskEqualsToken */: - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: - case 39 /* PercentToken */: - case 60 /* PercentEqualsToken */: + case 38 /* AsteriskAsteriskToken */: + case 59 /* AsteriskEqualsToken */: + case 60 /* AsteriskAsteriskEqualsToken */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: + case 40 /* PercentToken */: + case 62 /* PercentEqualsToken */: case 36 /* MinusToken */: - case 57 /* MinusEqualsToken */: - case 42 /* LessThanLessThanToken */: - case 61 /* LessThanLessThanEqualsToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 46 /* BarToken */: - case 65 /* BarEqualsToken */: - case 47 /* CaretToken */: - case 66 /* CaretEqualsToken */: - case 45 /* AmpersandToken */: - case 64 /* AmpersandEqualsToken */: - // TypeScript 1.0 spec (April 2014): 4.15.1 + case 58 /* MinusEqualsToken */: + case 43 /* LessThanLessThanToken */: + case 63 /* LessThanLessThanEqualsToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 47 /* BarToken */: + case 67 /* BarEqualsToken */: + case 48 /* CaretToken */: + case 68 /* CaretEqualsToken */: + case 46 /* AmpersandToken */: + case 66 /* AmpersandEqualsToken */: + // TypeScript 1.0 spec (April 2014): 4.19.1 // These operators require their operands to be of type Any, the Number primitive type, // or an enum type. Operands of an enum type are treated // as having the primitive type Number. If one operand is the null or undefined value, @@ -21868,21 +22450,21 @@ var ts; // try and return them a helpful suggestion if ((leftType.flags & 8 /* Boolean */) && (rightType.flags & 8 /* Boolean */) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal - var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } } return numberType; case 35 /* PlusToken */: - case 56 /* PlusEqualsToken */: - // TypeScript 1.0 spec (April 2014): 4.15.2 + case 57 /* PlusEqualsToken */: + // TypeScript 1.0 spec (April 2014): 4.19.2 // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. // If one operand is the null or undefined value, it is treated as having the type of the other operand. @@ -21915,7 +22497,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 56 /* PlusEqualsToken */) { + if (operator === 57 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; @@ -21935,15 +22517,15 @@ var ts; reportOperatorError(); } return booleanType; - case 89 /* InstanceOfKeyword */: - return checkInstanceOfExpression(node, leftType, rightType); - case 88 /* InKeyword */: - return checkInExpression(node, leftType, rightType); - case 50 /* AmpersandAmpersandToken */: + case 91 /* InstanceOfKeyword */: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90 /* InKeyword */: + return checkInExpression(left, right, leftType, rightType); + case 51 /* AmpersandAmpersandToken */: return rightType; - case 51 /* BarBarToken */: + case 52 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 55 /* EqualsToken */: + case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 24 /* CommaToken */: @@ -21951,8 +22533,8 @@ var ts; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? node.left : - someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? left : + someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -21962,37 +22544,37 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 46 /* BarToken */: - case 65 /* BarEqualsToken */: - return 51 /* BarBarToken */; - case 47 /* CaretToken */: - case 66 /* CaretEqualsToken */: + case 47 /* BarToken */: + case 67 /* BarEqualsToken */: + return 52 /* BarBarToken */; + case 48 /* CaretToken */: + case 68 /* CaretEqualsToken */: return 33 /* ExclamationEqualsEqualsToken */; - case 45 /* AmpersandToken */: - case 64 /* AmpersandEqualsToken */: - return 50 /* AmpersandAmpersandToken */; + case 46 /* AmpersandToken */: + case 66 /* AmpersandEqualsToken */: + return 51 /* AmpersandAmpersandToken */; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { + if (produceDiagnostics && operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { // TypeScript 1.0 spec (April 2014): 4.17 // An assignment of the form // VarExpr = ValueExpr // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported - checkTypeAssignableTo(valueType, leftType, node.left, /*headMessage*/ undefined); + checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined); } } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function isYieldExpressionInClass(node) { @@ -22083,7 +22665,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -22094,7 +22676,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -22124,7 +22706,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 133 /* QualifiedName */) { + if (node.kind === 135 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -22136,9 +22718,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -22152,78 +22734,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: return checkIdentifier(node); - case 95 /* ThisKeyword */: + case 97 /* ThisKeyword */: return checkThisExpression(node); - case 93 /* SuperKeyword */: + case 95 /* SuperKeyword */: return checkSuperExpression(node); - case 91 /* NullKeyword */: + case 93 /* NullKeyword */: return nullType; - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 164 /* PropertyAccessExpression */: + case 166 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return checkCallExpression(node); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: return checkClassExpression(node); - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 174 /* TypeOfExpression */: + case 176 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return checkAssertion(node); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return checkDeleteExpression(node); - case 175 /* VoidExpression */: + case 177 /* VoidExpression */: return checkVoidExpression(node); - case 176 /* AwaitExpression */: + case 178 /* AwaitExpression */: return checkAwaitExpression(node); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 183 /* SpreadElementExpression */: + case 185 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 185 /* OmittedExpression */: + case 187 /* OmittedExpression */: return undefinedType; - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return checkYieldExpression(node); - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: return checkJsxExpression(node); - case 231 /* JsxElement */: + case 233 /* JsxElement */: return checkJsxElement(node); - case 232 /* JsxSelfClosingElement */: + case 234 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 233 /* JsxOpeningElement */: + case 235 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -22252,7 +22834,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 142 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -22269,15 +22851,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 141 /* MethodDeclaration */ || - node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */; + return node.kind === 143 /* MethodDeclaration */ || + node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 67 /* Identifier */ && + if (param.name.kind === 69 /* Identifier */ && param.name.text === parameter.text) { return i; } @@ -22287,31 +22869,31 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 172 /* ArrowFunction */: - case 145 /* CallSignature */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 150 /* FunctionType */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 174 /* ArrowFunction */: + case 147 /* CallSignature */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 152 /* FunctionType */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 150 /* FunctionType */ || node.kind === 211 /* FunctionDeclaration */ || node.kind === 151 /* ConstructorType */ || - node.kind === 145 /* CallSignature */ || node.kind === 142 /* Constructor */ || - node.kind === 146 /* ConstructSignature */) { + else if (node.kind === 152 /* FunctionType */ || node.kind === 213 /* FunctionDeclaration */ || node.kind === 153 /* ConstructorType */ || + node.kind === 147 /* CallSignature */ || node.kind === 144 /* Constructor */ || + node.kind === 148 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 148 /* TypePredicate */) { + if (node.type.kind === 150 /* TypePredicate */) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -22330,19 +22912,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 159 /* ObjectBindingPattern */ || - param.name.kind === 160 /* ArrayBindingPattern */) { + if (param.name.kind === 161 /* ObjectBindingPattern */ || + param.name.kind === 162 /* ArrayBindingPattern */) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 67 /* Identifier */ && + if (element.name.kind === 69 /* Identifier */ && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 160 /* ArrayBindingPattern */ || - element.name.kind === 159 /* ObjectBindingPattern */) { + else if (element.name.kind === 162 /* ArrayBindingPattern */ || + element.name.kind === 161 /* ObjectBindingPattern */) { checkBindingPattern(element.name); } } @@ -22366,10 +22948,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -22397,7 +22979,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 213 /* InterfaceDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -22417,7 +22999,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 128 /* StringKeyword */: + case 130 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -22425,7 +23007,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 126 /* NumberKeyword */: + case 128 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -22474,7 +23056,7 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 166 /* CallExpression */ && n.expression.kind === 93 /* SuperKeyword */; + return n.kind === 168 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); @@ -22492,15 +23074,15 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 95 /* ThisKeyword */) { + if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 171 /* FunctionExpression */ && n.kind !== 211 /* FunctionDeclaration */) { + else if (n.kind !== 173 /* FunctionExpression */ && n.kind !== 213 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 139 /* PropertyDeclaration */ && + return n.kind === 141 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } @@ -22530,7 +23112,7 @@ var ts; var superCallStatement; for (var _i = 0; _i < statements.length; _i++) { var statement = statements[_i]; - if (statement.kind === 193 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -22556,7 +23138,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 143 /* GetAccessor */) { + if (node.kind === 145 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } @@ -22564,7 +23146,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 143 /* GetAccessor */ ? 144 /* SetAccessor */ : 143 /* GetAccessor */; + var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -22660,9 +23242,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 145 /* CallSignature */ || signatureDeclarationNode.kind === 146 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 145 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 147 /* CallSignature */ || signatureDeclarationNode.kind === 148 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 147 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -22680,7 +23262,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 213 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 215 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -22766,7 +23348,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */); + ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -22802,7 +23384,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 213 /* InterfaceDeclaration */ || node.parent.kind === 153 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -22813,7 +23395,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 211 /* FunctionDeclaration */ || node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */ || node.kind === 142 /* Constructor */) { + if (node.kind === 213 /* FunctionDeclaration */ || node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */ || node.kind === 144 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -22953,16 +23535,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -22973,7 +23555,8 @@ var ts; } } function checkNonThenableType(type, location, message) { - if (!(type.flags & 1 /* Any */) && isTypeAssignableTo(type, getGlobalThenableType())) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -23206,22 +23789,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 136 /* Parameter */: + case 138 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -23234,9 +23817,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 149 /* TypeReference */) { + if (node && node.kind === 151 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Resolve type so we know which symbol is referenced var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); // Resolved symbol is alias @@ -23255,19 +23838,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 136 /* Parameter */: + case 138 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -23296,25 +23879,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 144 /* SetAccessor */: - case 143 /* GetAccessor */: - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 146 /* SetAccessor */: + case 145 /* GetAccessor */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 136 /* Parameter */) { + if (node.kind === 138 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -23332,15 +23915,12 @@ var ts; checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { - if (!compilerOptions.experimentalAsyncFunctions) { - error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning); - } emitAwaiter = true; } // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 136 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -23389,11 +23969,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 190 /* Block */) { + if (node.kind === 192 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 217 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 219 /* ModuleBlock */) { checkFunctionAndClassExpressionBodies(node); } } @@ -23412,12 +23992,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 139 /* PropertyDeclaration */ || - node.kind === 138 /* PropertySignature */ || - node.kind === 141 /* MethodDeclaration */ || - node.kind === 140 /* MethodSignature */ || - node.kind === 143 /* GetAccessor */ || - node.kind === 144 /* SetAccessor */) { + if (node.kind === 141 /* PropertyDeclaration */ || + node.kind === 140 /* PropertySignature */ || + node.kind === 143 /* MethodDeclaration */ || + node.kind === 142 /* MethodSignature */ || + node.kind === 145 /* GetAccessor */ || + node.kind === 146 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -23426,7 +24006,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 136 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 138 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -23442,7 +24022,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 67 /* Identifier */; + var isDeclaration_1 = node.kind !== 69 /* Identifier */; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -23465,7 +24045,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 67 /* Identifier */; + var isDeclaration_2 = node.kind !== 69 /* Identifier */; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -23479,12 +24059,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 246 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -23519,7 +24099,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 209 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 211 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -23529,17 +24109,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 191 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 190 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 217 /* ModuleBlock */ || - container.kind === 216 /* ModuleDeclaration */ || - container.kind === 246 /* SourceFile */); + (container.kind === 192 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 219 /* ModuleBlock */ || + container.kind === 218 /* ModuleDeclaration */ || + container.kind === 248 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -23554,18 +24134,18 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 136 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 138 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 67 /* Identifier */) { + if (n.kind === 69 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 136 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 138 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -23591,7 +24171,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -23602,7 +24182,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 136 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 138 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -23634,10 +24214,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 139 /* PropertyDeclaration */ && node.kind !== 138 /* PropertySignature */) { + if (node.kind !== 141 /* PropertyDeclaration */ && node.kind !== 140 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { + if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -23660,7 +24240,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 163 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 165 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -23698,12 +24278,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -23723,14 +24303,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { + if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -23759,7 +24339,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -23773,7 +24353,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { + if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -24012,7 +24592,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144 /* SetAccessor */))); + return !!(node.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -24035,10 +24615,10 @@ var ts; // for generators. return; } - if (func.kind === 144 /* SetAccessor */) { + if (func.kind === 146 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 142 /* Constructor */) { + else if (func.kind === 144 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -24047,7 +24627,12 @@ var ts; if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + if (promisedType) { + // If the function has a return type, but promisedType is + // undefined, an error will be reported in checkAsyncFunctionReturnType + // so we don't need to report one here. + checkTypeAssignableTo(awaitedType, promisedType, node.expression); + } } else { checkTypeAssignableTo(exprType, returnType, node.expression); @@ -24074,7 +24659,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 240 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -24086,7 +24671,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 239 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 241 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. @@ -24107,7 +24692,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 205 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 207 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -24137,7 +24722,7 @@ var ts; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 67 /* Identifier */) { + if (catchClause.variableDeclaration.name.kind !== 69 /* Identifier */) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -24212,7 +24797,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 134 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 136 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -24289,6 +24874,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -24307,7 +24893,7 @@ var ts; } } } - checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify @@ -24324,7 +24910,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - ts.forEach(implementedTypeNodes, function (typeRefNode) { + for (var _b = 0; _b < implementedTypeNodes.length; _b++) { + var typeRefNode = implementedTypeNodes[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -24334,14 +24921,14 @@ var ts; if (t !== unknownType) { var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { - checkTypeAssignableTo(type, t, node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); } } } - }); + } } if (produceDiagnostics) { checkIndexConstraints(type); @@ -24392,7 +24979,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { - if (derivedClassDecl.kind === 184 /* ClassExpression */) { + if (derivedClassDecl.kind === 186 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -24440,7 +25027,7 @@ var ts; } } function isAccessor(kind) { - return kind === 143 /* GetAccessor */ || kind === 144 /* SetAccessor */; + return kind === 145 /* GetAccessor */ || kind === 146 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -24480,7 +25067,7 @@ var ts; var ok = true; for (var _i = 0; _i < baseTypes.length; _i++) { var base = baseTypes[_i]; - var properties = getPropertiesOfObjectType(base); + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0; _a < properties.length; _a++) { var prop = properties[_a]; if (!ts.hasProperty(seen, prop.name)) { @@ -24510,7 +25097,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -24519,19 +25106,21 @@ var ts; // Only check this symbol once if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); // run subsequent checks only if first set succeeded if (checkInheritedPropertiesAreIdentical(type, node.name)) { - ts.forEach(getBaseTypes(type), function (baseType) { - checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); - }); + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } checkIndexConstraints(type); } } // Interfaces cannot merge with non-ambient classes. if (symbol && symbol.declarations) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 212 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var declaration = _c[_b]; + if (declaration.kind === 214 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -24560,24 +25149,38 @@ var ts; if (!(nodeLinks.flags & 8192 /* EnumValuesComputed */)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); - var autoValue = 0; + var autoValue = 0; // set to undefined when enum member is non-constant var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); - ts.forEach(node.members, function (member) { - if (member.name.kind !== 134 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name.kind === 136 /* ComputedPropertyName */) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } + var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; if (initializer) { autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { + // In ambient enum declarations that specify no const modifier, enum member declarations + // that omit a value are considered computed members (as opposed to having auto-incremented values assigned). autoValue = undefined; } + else if (previousEnumMemberIsNonConstant) { + // If the member declaration specifies no value, the member is considered a constant enum member. + // If the member is the first member in the enum declaration, it is assigned the value zero. + // Otherwise, it is assigned the value of the immediately preceding member plus one, + // and an error occurs if the immediately preceding member is not a constant enum member + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } if (autoValue !== undefined) { getNodeLinks(member).enumMemberValue = autoValue++; } - }); + } nodeLinks.flags |= 8192 /* EnumValuesComputed */; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { @@ -24590,11 +25193,11 @@ var ts; if (enumIsConst) { error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); } - else if (!ambient) { + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. - // Also, we do not need to check this for ambients because there is already - // a syntax error if it is not a constant. checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); } } @@ -24610,7 +25213,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -24618,10 +25221,10 @@ var ts; switch (e.operator) { case 35 /* PlusToken */: return value_1; case 36 /* MinusToken */: return -value_1; - case 49 /* TildeToken */: return ~value_1; + case 50 /* TildeToken */: return ~value_1; } return undefined; - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -24631,31 +25234,31 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 46 /* BarToken */: return left | right; - case 45 /* AmpersandToken */: return left & right; - case 43 /* GreaterThanGreaterThanToken */: return left >> right; - case 44 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 42 /* LessThanLessThanToken */: return left << right; - case 47 /* CaretToken */: return left ^ right; + case 47 /* BarToken */: return left | right; + case 46 /* AmpersandToken */: return left & right; + case 44 /* GreaterThanGreaterThanToken */: return left >> right; + case 45 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 43 /* LessThanLessThanToken */: return left << right; + case 48 /* CaretToken */: return left ^ right; case 37 /* AsteriskToken */: return left * right; - case 38 /* SlashToken */: return left / right; + case 39 /* SlashToken */: return left / right; case 35 /* PlusToken */: return left + right; case 36 /* MinusToken */: return left - right; - case 39 /* PercentToken */: return left % right; + case 40 /* PercentToken */: return left % right; } return undefined; case 8 /* NumericLiteral */: return +e.text; - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return evalConstant(e.expression); - case 67 /* Identifier */: - case 165 /* ElementAccessExpression */: - case 164 /* PropertyAccessExpression */: + case 69 /* Identifier */: + case 167 /* ElementAccessExpression */: + case 166 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName; - if (e.kind === 67 /* Identifier */) { + if (e.kind === 69 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type enumType_1 = currentType; @@ -24663,7 +25266,7 @@ var ts; } else { var expression; - if (e.kind === 165 /* ElementAccessExpression */) { + if (e.kind === 167 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -24678,10 +25281,10 @@ var ts; // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName var current = expression; while (current) { - if (current.kind === 67 /* Identifier */) { + if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 164 /* PropertyAccessExpression */) { + else if (current.kind === 166 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -24707,7 +25310,7 @@ var ts; return undefined; } // illegal case: forward reference - if (!isDefinedBefore(propertyDecl, member)) { + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { reportError = false; error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return undefined; @@ -24722,7 +25325,7 @@ var ts; return; } // Grammar checking - checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -24752,7 +25355,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 215 /* EnumDeclaration */) { + if (declaration.kind !== 217 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -24775,8 +25378,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 212 /* ClassDeclaration */ || - (declaration.kind === 211 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 214 /* ClassDeclaration */ || + (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -24832,7 +25435,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 212 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 214 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -24841,9 +25444,9 @@ var ts; // Checks for ambient external modules. if (isAmbientExternalModule) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } - if (isExternalModuleNameRelative(node.name.text)) { + if (ts.isExternalModuleNameRelative(node.name.text)) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -24852,17 +25455,17 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 133 /* QualifiedName */) { + if (node.kind === 135 /* QualifiedName */) { node = node.left; } - else if (node.kind === 164 /* PropertyAccessExpression */) { + else if (node.kind === 166 /* PropertyAccessExpression */) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 67 /* Identifier */); + ts.Debug.assert(node.kind === 69 /* Identifier */); return node; } function checkExternalImportOrExportDeclaration(node) { @@ -24871,14 +25474,14 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 226 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 228 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { // TypeScript 1.0 spec (April 2013): 12.1.6 // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference // other external modules only through top - level external module names. @@ -24896,7 +25499,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 228 /* ExportSpecifier */ ? + var message = node.kind === 230 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -24923,7 +25526,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -24960,9 +25563,9 @@ var ts; } } else { - if (languageVersion >= 2 /* ES6 */ && !ts.isInAmbientContext(node)) { + if (modulekind === 5 /* ES6 */ && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -24980,8 +25583,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -24995,7 +25598,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 246 /* SourceFile */ && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 216 /* ModuleDeclaration */) { + if (node.parent.kind !== 248 /* SourceFile */ && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 218 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -25010,8 +25613,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 246 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 216 /* ModuleDeclaration */ && container.name.kind === 67 /* Identifier */) { + var container = node.parent.kind === 248 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 218 /* ModuleDeclaration */ && container.name.kind === 69 /* Identifier */) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -25019,7 +25622,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { markExportAsReferenced(node); } else { @@ -25027,21 +25630,21 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (languageVersion >= 2 /* ES6 */) { - // export assignment is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (modulekind === 5 /* ES6 */) { + // export assignment is not supported in es6 modules + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (compilerOptions.module === 4 /* System */) { + else if (modulekind === 4 /* System */) { // system modules does not support export assignment grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } function getModuleStatements(node) { - if (node.kind === 246 /* SourceFile */) { + if (node.kind === 248 /* SourceFile */) { return node.statements; } - if (node.kind === 216 /* ModuleDeclaration */ && node.body.kind === 217 /* ModuleBlock */) { + if (node.kind === 218 /* ModuleDeclaration */ && node.body.kind === 219 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -25080,118 +25683,118 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessivly // hitting the cancellation token on every node we check. switch (kind) { - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return checkTypeParameter(node); - case 136 /* Parameter */: + case 138 /* Parameter */: return checkParameter(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return checkPropertyDeclaration(node); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return checkSignatureDeclaration(node); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return checkMethodDeclaration(node); - case 142 /* Constructor */: + case 144 /* Constructor */: return checkConstructorDeclaration(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return checkAccessorDeclaration(node); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return checkTypeReferenceNode(node); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return checkTypePredicate(node); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return checkTypeQuery(node); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return checkTypeLiteral(node); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return checkArrayType(node); - case 155 /* TupleType */: + case 157 /* TupleType */: return checkTupleType(node); - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return checkSourceElement(node.type); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return checkBlock(node); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return checkVariableStatement(node); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: return checkExpressionStatement(node); - case 194 /* IfStatement */: + case 196 /* IfStatement */: return checkIfStatement(node); - case 195 /* DoStatement */: + case 197 /* DoStatement */: return checkDoStatement(node); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: return checkWhileStatement(node); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return checkForStatement(node); - case 198 /* ForInStatement */: + case 200 /* ForInStatement */: return checkForInStatement(node); - case 199 /* ForOfStatement */: + case 201 /* ForOfStatement */: return checkForOfStatement(node); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return checkReturnStatement(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return checkWithStatement(node); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return checkSwitchStatement(node); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return checkLabeledStatement(node); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: return checkThrowStatement(node); - case 207 /* TryStatement */: + case 209 /* TryStatement */: return checkTryStatement(node); - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 161 /* BindingElement */: + case 163 /* BindingElement */: return checkBindingElement(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return checkClassDeclaration(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return checkImportDeclaration(node); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return checkExportDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return checkExportAssignment(node); - case 192 /* EmptyStatement */: + case 194 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 208 /* DebuggerStatement */: + case 210 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 229 /* MissingDeclaration */: + case 231 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -25206,97 +25809,98 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: ts.forEach(node.members, checkSourceElement); + ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 203 /* WithStatement */: + case 205 /* WithStatement */: checkFunctionAndClassExpressionBodies(node.expression); break; - case 137 /* Decorator */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 161 /* BindingElement */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 243 /* PropertyAssignment */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 168 /* TaggedTemplateExpression */: - case 181 /* TemplateExpression */: - case 188 /* TemplateSpan */: - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: - case 170 /* ParenthesizedExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 176 /* AwaitExpression */: - case 173 /* DeleteExpression */: - case 177 /* PrefixUnaryExpression */: - case 178 /* PostfixUnaryExpression */: - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 182 /* YieldExpression */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 191 /* VariableStatement */: - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 218 /* CaseBlock */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 206 /* ThrowStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: - case 209 /* VariableDeclaration */: - case 210 /* VariableDeclarationList */: - case 212 /* ClassDeclaration */: - case 241 /* HeritageClause */: - case 186 /* ExpressionWithTypeArguments */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 225 /* ExportAssignment */: - case 246 /* SourceFile */: - case 238 /* JsxExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - case 233 /* JsxOpeningElement */: + case 139 /* Decorator */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 163 /* BindingElement */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 245 /* PropertyAssignment */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 170 /* TaggedTemplateExpression */: + case 183 /* TemplateExpression */: + case 190 /* TemplateSpan */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: + case 172 /* ParenthesizedExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 178 /* AwaitExpression */: + case 175 /* DeleteExpression */: + case 179 /* PrefixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 184 /* YieldExpression */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 193 /* VariableStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 220 /* CaseBlock */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 208 /* ThrowStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: + case 211 /* VariableDeclaration */: + case 212 /* VariableDeclarationList */: + case 214 /* ClassDeclaration */: + case 243 /* HeritageClause */: + case 188 /* ExpressionWithTypeArguments */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 227 /* ExportAssignment */: + case 248 /* SourceFile */: + case 240 /* JsxExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + case 235 /* JsxOpeningElement */: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -25323,7 +25927,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -25382,7 +25986,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 203 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 205 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -25405,34 +26009,34 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location)) { + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, - // add the type parameters into the symbol table + // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 171 /* FunctionExpression */: + case 173 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -25475,43 +26079,43 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 67 /* Identifier */ && + return name.kind === 69 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 135 /* TypeParameter */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: + case 137 /* TypeParameter */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 133 /* QualifiedName */) { + while (node.parent && node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 149 /* TypeReference */; + return node.parent && node.parent.kind === 151 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 164 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 166 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 186 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 188 /* ExpressionWithTypeArguments */; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 133 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 135 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 219 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 221 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 227 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -25523,11 +26127,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 225 /* ExportAssignment */) { + if (entityName.parent.kind === 227 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 164 /* PropertyAccessExpression */) { + if (entityName.kind !== 166 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -25537,13 +26141,24 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 186 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = 0 /* None */; + // In an interface or class, we're definitely interested in a type. + if (entityName.parent.kind === 188 /* ExpressionWithTypeArguments */) { + meaning = 793056 /* Type */; + // In a class 'extends' clause we are also looking for a value. + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455 /* Value */; + } + } + else { + meaning = 1536 /* Namespace */; + } meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 233 /* JsxOpeningElement */) || - (entityName.parent.kind === 232 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 235 /* JsxClosingElement */)) { + else if ((entityName.parent.kind === 235 /* JsxOpeningElement */) || + (entityName.parent.kind === 234 /* JsxSelfClosingElement */) || + (entityName.parent.kind === 237 /* JsxClosingElement */)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { @@ -25551,20 +26166,20 @@ var ts; // Missing entity name. return undefined; } - if (entityName.kind === 67 /* Identifier */) { + if (entityName.kind === 69 /* Identifier */) { // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 164 /* PropertyAccessExpression */) { + else if (entityName.kind === 166 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 133 /* QualifiedName */) { + else if (entityName.kind === 135 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -25573,16 +26188,16 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 236 /* JsxAttribute */) { + else if (entityName.parent.kind === 238 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 148 /* TypePredicate */) { + if (entityName.parent.kind === 150 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? @@ -25597,14 +26212,14 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } - if (node.kind === 67 /* Identifier */) { + if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 225 /* ExportAssignment */ + return node.parent.kind === 227 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 161 /* BindingElement */ && - node.parent.parent.kind === 159 /* ObjectBindingPattern */ && + else if (node.parent.kind === 163 /* BindingElement */ && + node.parent.parent.kind === 161 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -25614,18 +26229,18 @@ var ts; } } switch (node.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - var type = checkExpression(node); + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 119 /* ConstructorKeyword */: + case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 142 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 144 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -25633,14 +26248,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 220 /* ImportDeclaration */ || node.parent.kind === 226 /* ExportDeclaration */) && + ((node.parent.kind === 222 /* ImportDeclaration */ || node.parent.kind === 228 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -25657,7 +26272,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 244 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 246 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -25774,11 +26389,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 246 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 248 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 216 /* ModuleDeclaration */ || n.kind === 215 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 218 /* ModuleDeclaration */ || n.kind === 217 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -25793,11 +26408,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 190 /* Block */: - case 218 /* CaseBlock */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 192 /* Block */: + case 220 /* CaseBlock */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return true; } return false; @@ -25827,22 +26442,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 225 /* ExportAssignment */: - return node.expression && node.expression.kind === 67 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 227 /* ExportAssignment */: + return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 246 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 248 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -25904,7 +26519,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 245 /* EnumMember */) { + if (node.kind === 247 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -25996,23 +26611,6 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function getBlockScopedVariableId(n) { - ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 161 /* BindingElement */ || (n.parent.kind === 209 /* VariableDeclaration */ && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); - var isLetOrConst = symbol && - (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 242 /* CatchClause */; - if (isLetOrConst) { - // side-effect of calling this method: - // assign id to symbol if it was not yet set - getSymbolLinks(symbol); - return symbol.id; - } - return undefined; - } function instantiateSingleCallFunctionType(functionType, typeArguments) { if (functionType === unknownType) { return unknownType; @@ -26044,7 +26642,6 @@ var ts; isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, collectLinkedAliases: collectLinkedAliases, - getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter @@ -26057,11 +26654,10 @@ var ts; }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); - // Initialize special symbols getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; @@ -26087,6 +26683,7 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. if (languageVersion >= 2 /* ES6 */) { @@ -26136,10 +26733,7 @@ var ts; if (!ts.nodeCanBeDecorated(node)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } - else if (languageVersion < 1 /* ES5 */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); - } - else if (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */) { + else if (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -26149,38 +26743,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: - case 216 /* ModuleDeclaration */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: - case 225 /* ExportAssignment */: - case 136 /* Parameter */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: + case 218 /* ModuleDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + case 227 /* ExportAssignment */: + case 138 /* Parameter */: break; - case 211 /* FunctionDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116 /* AsyncKeyword */) && - node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 213 /* FunctionDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && + node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 191 /* VariableStatement */: - case 214 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 193 /* VariableStatement */: + case 216 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 215 /* EnumDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72 /* ConstKeyword */) && - node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 217 /* EnumDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && + node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -26195,14 +26789,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { - case 110 /* PublicKeyword */: - case 109 /* ProtectedKeyword */: - case 108 /* PrivateKeyword */: + case 112 /* PublicKeyword */: + case 111 /* ProtectedKeyword */: + case 110 /* PrivateKeyword */: var text = void 0; - if (modifier.kind === 110 /* PublicKeyword */) { + if (modifier.kind === 112 /* PublicKeyword */) { text = "public"; } - else if (modifier.kind === 109 /* ProtectedKeyword */) { + else if (modifier.kind === 111 /* ProtectedKeyword */) { text = "protected"; lastProtected = modifier; } @@ -26219,11 +26813,11 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256 /* Abstract */) { - if (modifier.kind === 108 /* PrivateKeyword */) { + if (modifier.kind === 110 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -26232,17 +26826,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 111 /* StaticKeyword */: + case 113 /* StaticKeyword */: if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { @@ -26251,7 +26845,7 @@ var ts; flags |= 128 /* Static */; lastStatic = modifier; break; - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -26264,42 +26858,42 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 120 /* DeclareKeyword */: + case 122 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 113 /* AbstractKeyword */: + case 115 /* AbstractKeyword */: if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 212 /* ClassDeclaration */) { - if (node.kind !== 141 /* MethodDeclaration */) { + if (node.kind !== 214 /* ClassDeclaration */) { + if (node.kind !== 143 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 212 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128 /* Static */) { @@ -26311,14 +26905,14 @@ var ts; } flags |= 256 /* Abstract */; break; - case 116 /* AsyncKeyword */: + case 118 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512 /* Async */; @@ -26326,7 +26920,7 @@ var ts; break; } } - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -26344,10 +26938,10 @@ var ts; } return; } - else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 136 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512 /* Async */) { @@ -26359,10 +26953,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 141 /* MethodDeclaration */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -26428,7 +27022,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 172 /* ArrowFunction */) { + if (node.kind === 174 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -26463,7 +27057,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 128 /* StringKeyword */ && parameter.type.kind !== 126 /* NumberKeyword */) { + if (parameter.type.kind !== 130 /* StringKeyword */ && parameter.type.kind !== 128 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -26496,7 +27090,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 185 /* OmittedExpression */) { + if (arg.kind === 187 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -26523,7 +27117,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81 /* ExtendsKeyword */) { + if (heritageClause.token === 83 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -26536,7 +27130,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -26552,14 +27146,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81 /* ExtendsKeyword */) { + if (heritageClause.token === 83 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -26570,19 +27164,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 134 /* ComputedPropertyName */) { + if (node.kind !== 136 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 179 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 181 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -26599,7 +27193,7 @@ var ts; return grammarErrorOnNode(questionToken, message); } } - function checkGrammarObjectLiteralExpression(node) { + function checkGrammarObjectLiteralExpression(node, inDestructuring) { var seen = {}; var Property = 1; var GetAccessor = 2; @@ -26608,12 +27202,17 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 185 /* OmittedExpression */ || - name_16.kind === 134 /* ComputedPropertyName */) { + if (prop.kind === 187 /* OmittedExpression */ || + name_16.kind === 136 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_16); continue; } + if (prop.kind === 246 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern + // outside of destructuring it is a syntax error + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + } // ECMA-262 11.1.5 Object Initialiser // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and @@ -26623,7 +27222,7 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */) { + if (prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_16.kind === 8 /* NumericLiteral */) { @@ -26631,13 +27230,13 @@ var ts; } currentKind = Property; } - else if (prop.kind === 141 /* MethodDeclaration */) { + else if (prop.kind === 143 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 143 /* GetAccessor */) { + else if (prop.kind === 145 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 144 /* SetAccessor */) { + else if (prop.kind === 146 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -26669,7 +27268,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 237 /* JsxSpreadAttribute */) { + if (attr.kind === 239 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -26681,7 +27280,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 238 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 240 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -26690,24 +27289,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 210 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 212 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -26730,10 +27329,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 143 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 145 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 144 /* SetAccessor */) { + else if (kind === 146 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -26758,7 +27357,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 134 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 136 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -26768,7 +27367,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 163 /* ObjectLiteralExpression */) { + if (node.parent.kind === 165 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -26792,22 +27391,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 213 /* InterfaceDeclaration */) { + else if (node.parent.kind === 215 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 153 /* TypeLiteral */) { + else if (node.parent.kind === 155 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: return true; - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -26819,11 +27418,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 200 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 202 /* ContinueStatement */ && !isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -26831,8 +27430,8 @@ var ts; return false; } break; - case 204 /* SwitchStatement */: - if (node.kind === 201 /* BreakStatement */ && !node.label) { + case 206 /* SwitchStatement */: + if (node.kind === 203 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -26847,13 +27446,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 201 /* BreakStatement */ + var message = node.kind === 203 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 201 /* BreakStatement */ + var message = node.kind === 203 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -26865,7 +27464,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 160 /* ArrayBindingPattern */ || node.name.kind === 159 /* ObjectBindingPattern */) { + if (node.name.kind === 162 /* ArrayBindingPattern */ || node.name.kind === 161 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -26875,7 +27474,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 198 /* ForInStatement */ && node.parent.parent.kind !== 199 /* ForOfStatement */) { + if (node.parent.parent.kind !== 200 /* ForInStatement */ && node.parent.parent.kind !== 201 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -26902,7 +27501,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 67 /* Identifier */) { + if (name.kind === 69 /* Identifier */) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -26911,7 +27510,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 185 /* OmittedExpression */) { + if (element.kind !== 187 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -26928,15 +27527,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return false; - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -26952,7 +27551,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 177 /* PrefixUnaryExpression */) { + if (expression.kind === 179 /* PrefixUnaryExpression */) { var unaryExpression = expression; if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { expression = unaryExpression.operand; @@ -26968,37 +27567,6 @@ var ts; } return false; } - function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 32768 /* Const */) !== 0; - var hasError = false; - // skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions. - // since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members. - if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { - var node = _a[_i]; - // Do not use hasDynamicName here, because that returns false for well known symbols. - // We want to perform checkComputedPropertyName for all computed properties, including - // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); - } - else if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer)) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; - } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; - } - } - } - return hasError; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -27024,7 +27592,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -27044,12 +27612,12 @@ var ts; return true; } } - else if (node.parent.kind === 213 /* InterfaceDeclaration */) { + else if (node.parent.kind === 215 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 153 /* TypeLiteral */) { + else if (node.parent.kind === 155 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -27069,11 +27637,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 213 /* InterfaceDeclaration */ || - node.kind === 220 /* ImportDeclaration */ || - node.kind === 219 /* ImportEqualsDeclaration */ || - node.kind === 226 /* ExportDeclaration */ || - node.kind === 225 /* ExportAssignment */ || + if (node.kind === 215 /* InterfaceDeclaration */ || + node.kind === 222 /* ImportDeclaration */ || + node.kind === 221 /* ImportEqualsDeclaration */ || + node.kind === 228 /* ExportDeclaration */ || + node.kind === 227 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 1024 /* Default */))) { return false; @@ -27083,7 +27651,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 191 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 193 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -27109,7 +27677,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 190 /* Block */ || node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + if (node.parent.kind === 192 /* Block */ || node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -27160,6 +27728,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; + var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; @@ -27191,7 +27760,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 220 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -27245,6 +27814,7 @@ var ts; function createAndSetNewTextWriterWithSymbolWriter() { var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -27267,10 +27837,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 209 /* VariableDeclaration */) { + if (declaration.kind === 211 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 223 /* NamedImports */ || declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 221 /* ImportClause */) { + else if (declaration.kind === 225 /* NamedImports */ || declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 223 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -27288,7 +27858,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 220 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 222 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -27298,12 +27868,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -27337,6 +27907,11 @@ var ts; function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); } + function reportInaccessibleThisError() { + if (errorNameNode) { + diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); @@ -27345,7 +27920,9 @@ var ts; emitType(type); } else { + errorNameNode = declaration.name; resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + errorNameNode = undefined; } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -27356,7 +27933,9 @@ var ts; emitType(signature.type); } else { + errorNameNode = signature.name; resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + errorNameNode = undefined; } } function emitLines(nodes) { @@ -27395,49 +27974,50 @@ var ts; } function emitType(type) { switch (type.kind) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: case 9 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return emitTypeReference(type); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return emitTypeQuery(type); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return emitArrayType(type); - case 155 /* TupleType */: + case 157 /* TupleType */: return emitTupleType(type); - case 156 /* UnionType */: + case 158 /* UnionType */: return emitUnionType(type); - case 157 /* IntersectionType */: + case 159 /* IntersectionType */: return emitIntersectionType(type); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return emitParenType(type); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return emitTypeLiteral(type); - case 67 /* Identifier */: + case 69 /* Identifier */: return emitEntityName(type); - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: return emitEntityName(type); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 67 /* Identifier */) { + if (entityName.kind === 69 /* Identifier */) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 133 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 133 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); @@ -27446,13 +28026,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 219 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 221 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 67 /* Identifier */ || node.expression.kind === 164 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 166 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -27533,7 +28113,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -27553,7 +28133,7 @@ var ts; write(";"); writeLine(); // Make all the declarations visible for the export name - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { var nodes = resolver.collectLinkedAliases(node.expression); // write each of these declarations asynchronously writeAsynchronousModuleElements(nodes); @@ -27572,10 +28152,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 219 /* ImportEqualsDeclaration */ || - (node.parent.kind === 246 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 221 /* ImportEqualsDeclaration */ || + (node.parent.kind === 248 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -27585,7 +28165,7 @@ var ts; }); } else { - if (node.kind === 220 /* ImportDeclaration */) { + if (node.kind === 222 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -27603,23 +28183,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return writeVariableStatement(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return writeClassDeclaration(node); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -27635,7 +28215,7 @@ var ts; if (node.flags & 1024 /* Default */) { write("default "); } - else if (node.kind !== 213 /* InterfaceDeclaration */) { + else if (node.kind !== 215 /* InterfaceDeclaration */) { write("declare "); } } @@ -27684,7 +28264,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 222 /* NamespaceImport */) { + if (namedBindings.kind === 224 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -27712,7 +28292,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -27770,7 +28350,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 217 /* ModuleBlock */) { + while (node.body.kind !== 219 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -27835,7 +28415,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 141 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -27846,15 +28426,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 153 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 141 /* MethodDeclaration */ || - node.parent.kind === 140 /* MethodSignature */ || - node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - node.parent.kind === 145 /* CallSignature */ || - node.parent.kind === 146 /* ConstructSignature */); + if (node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 155 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 143 /* MethodDeclaration */ || + node.parent.kind === 142 /* MethodSignature */ || + node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + node.parent.kind === 147 /* CallSignature */ || + node.parent.kind === 148 /* ConstructSignature */); emitType(node.constraint); } else { @@ -27865,31 +28445,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -27917,13 +28497,13 @@ var ts; if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - else if (!isImplementsList && node.expression.kind === 91 /* NullKeyword */) { + else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + if (node.parent.parent.kind === 214 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -28007,7 +28587,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 209 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 211 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -28017,10 +28597,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && node.parent.kind === 153 /* TypeLiteral */) { + if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -28029,14 +28609,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 209 /* VariableDeclaration */) { + if (node.kind === 211 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) { + else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -28045,7 +28625,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28077,7 +28657,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 185 /* OmittedExpression */) { + if (element.kind !== 187 /* OmittedExpression */) { elements.push(element); } } @@ -28147,7 +28727,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 143 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 145 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -28160,7 +28740,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 143 /* GetAccessor */ + return accessor.kind === 145 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -28169,7 +28749,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 144 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -28219,17 +28799,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 211 /* FunctionDeclaration */) { + if (node.kind === 213 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 141 /* MethodDeclaration */) { + else if (node.kind === 143 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 211 /* FunctionDeclaration */) { + if (node.kind === 213 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 142 /* Constructor */) { + else if (node.kind === 144 /* Constructor */) { write("constructor"); } else { @@ -28247,11 +28827,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 146 /* ConstructSignature */ || node.kind === 151 /* ConstructorType */) { + if (node.kind === 148 /* ConstructSignature */ || node.kind === 153 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { write("["); } else { @@ -28261,22 +28841,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 150 /* FunctionType */ || node.kind === 151 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 153 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 152 /* FunctionType */ || node.kind === 153 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 155 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 142 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 144 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -28287,26 +28867,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -28314,7 +28894,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -28328,7 +28908,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -28363,9 +28943,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - node.parent.parent.kind === 153 /* TypeLiteral */) { + if (node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + node.parent.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -28381,24 +28961,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 142 /* Constructor */: + case 144 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 145 /* CallSignature */: + case 147 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -28406,7 +28986,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28419,7 +28999,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28431,12 +29011,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 159 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 161 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 160 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 162 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -28455,7 +29035,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 185 /* OmittedExpression */) { + if (bindingElement.kind === 187 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -28464,7 +29044,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 161 /* BindingElement */) { + else if (bindingElement.kind === 163 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -28487,7 +29067,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 67 /* Identifier */); + ts.Debug.assert(bindingElement.name.kind === 69 /* Identifier */); // If the node is just an identifier, we will simply emit the text associated with the node's name // Example: // original: function foo({y = 10, x}) {} @@ -28503,40 +29083,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 216 /* ModuleDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 213 /* InterfaceDeclaration */: - case 212 /* ClassDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: + case 213 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 215 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return emitExportDeclaration(node); - case 142 /* Constructor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 144 /* Constructor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return writeFunctionDeclaration(node); - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 147 /* IndexSignature */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 149 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return emitAccessorDeclaration(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return emitPropertyDeclaration(node); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return emitExportAssignment(node); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return emitSourceFile(node); } } @@ -28587,6425 +29167,6 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; - // Flags enum to track count of temp variables and a few dedicated names - var TempFlags; - (function (TempFlags) { - TempFlags[TempFlags["Auto"] = 0] = "Auto"; - TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; - TempFlags[TempFlags["_i"] = 268435456] = "_i"; - })(TempFlags || (TempFlags = {})); - // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile) { - // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - // emit output for the __param helper function - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; - var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; - if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - else { - // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - // Sort and make the unique list of diagnostics - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); - return { - emitSkipped: false, - diagnostics: diagnostics, - sourceMaps: sourceMapDataList - }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { - return false; - } - } - } - return true; - } - function emitJavaScript(jsFilePath, root) { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var currentSourceFile; - // name of an exporter function if file is a System external module - // System.register([...], function () {...}) - // exporting in System modules looks like: - // export var x; ... x = 1 - // => - // var x;... exporter("x", x = 1) - var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; - var computedPropertyNamesToGeneratedNames; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStars; - /** Write emitted output to disk */ - var writeEmittedFiles = writeJavaScriptFile; - var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - /** Emit a node */ - var emit = emitNodeWithCommentsAndWithoutSourcemap; - /** Called just before starting emit of a node */ - var emitStart = function (node) { }; - /** Called once the emit of the node is done */ - var emitEnd = function (node) { }; - /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind - * but if optional emitFn callback is provided the text is emitted using the callback instead of default text - * @param tokenKind the kind of the token to search and emit - * @param startPos the position in the source to start searching for the token - * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - var emitToken = emitTokenText; - /** Called to before starting the lexical scopes as in function/class in the emitted code because of node - * @param scopeDeclaration node that starts the lexical scope - * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - /** Called after coming out of the scope */ - var scopeEmitEnd = function () { }; - /** Sourcemap data that will get encoded */ - var sourceMapData; - /** If removeComments is true, no leading-comments needed to be emitted **/ - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); - return; - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - emit(sourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - // Return the next available name in the pattern _a ... _z, _0, _1, ... - // TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. - // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_19)) { - tempFlags |= flags; - return name_19; - } - } - while (true) { - var count = tempFlags & 268435455 /* CountMask */; - tempFlags++; - // Skip over 'i' and 'n' - if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; - } - } - } - } - // Generate a name that is unique within the current file and doesn't conflict with any names - // in global scope. The name is formed by adding an '_n' suffix to the specified base name, - // where n is a positive integer. Note that names generated by makeTempVariableName and - // makeUniqueName are guaranteed to never conflict. - function makeUniqueName(baseName) { - // Find the first unique 'name_n', where n is a positive number - if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 /* StringLiteral */ ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 67 /* Identifier */: - return makeUniqueName(node.text); - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - return generateNameForModuleOrEnum(node); - case 220 /* ImportDeclaration */: - case 226 /* ExportDeclaration */: - return generateNameForImportOrExportDeclaration(node); - case 211 /* FunctionDeclaration */: - case 212 /* ClassDeclaration */: - case 225 /* ExportAssignment */: - return generateNameForExportDefault(); - case 184 /* ClassExpression */: - return generateNameForClassExpression(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - function initializeEmitterWithSourceMaps() { - var sourceMapDir; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - var sourceMapSourceIndex = -1; - // Names and its index map - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; - } - // Last recorded and encoded spans - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - // Add a new least significant bit that has the sign of the value. - // if negative number the least significant bit that gets added to the number has value 1 - // else least significant bit value that gets added is 0 - // eg. -1 changes to binary : 01 [1] => 3 - // +1 changes to binary : 01 [0] => 2 - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; - do { - var currentDigit = inValue & 31; // 11111 - inValue = inValue >> 5; - if (inValue > 0) { - // There are still more digits to decode, set the msb (6th bit) - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } - } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - // Convert the location to be one-based. - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - // If this location wasn't recorded or the location in source is going backwards, record the span - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - // New span - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path - // otherwise source locations relative to map file location - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - // Child scopes are always shown with a dot (even if they have no name), - // unless it is a computed property. Then it is shown with brackets, - // but the brackets are included in the name. - var name_21 = node.name; - if (!name_21 || name_21.kind !== 134 /* ComputedPropertyName */) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - // The scope was already given a name use it - recordScopeNameStart(scopeName); - } - else if (node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */ || - node.kind === 140 /* MethodSignature */ || - node.kind === 143 /* GetAccessor */ || - node.kind === 144 /* SetAccessor */ || - node.kind === 216 /* ModuleDeclaration */ || - node.kind === 212 /* ClassDeclaration */ || - node.kind === 215 /* EnumDeclaration */) { - // Declaration and has associated name use it - if (node.name) { - var name_22 = node.name; - // For computed property names, the text will include the brackets - scopeName = name_22.kind === 134 /* ComputedPropertyName */ - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - // Block just use the name from upper level scope - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - // Encode the sourceMap into the sourceMap url - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); - } - // Initialize source map data - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the - // relative paths of the sources list in the sourcemap - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - // For modules or multiple emit files the mapRoot will have directory structure like the sources - // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - // The relative paths are relative to the common directory - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath - ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap - host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 246 /* SourceFile */) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); - } - // Create a temporary variable with a unique unused name. - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(67 /* Identifier */); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - function emitTokenText(tokenKind, startPos, emitFn) { - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); - } - else { - write(tokenString); - } - return startPos + tokenString.length; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - // This emitting is to make sure we emit following comment properly - // ...(x, /*comment1*/ y)... - // ^ => node.pos - // "comment1" is not considered leading comment for "y" but rather - // considered as trailing comment of the previous node. - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, /*startIndex*/ 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98 /* b */: - case 66 /* B */: - case 111 /* o */: - case 79 /* O */: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - // Any template literal or string literal with an extended escape - // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. - if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); - } - // If we don't need to downlevel and we can reach the original source text using - // the node's parent reference, then simply get the text as it was originally written. - if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - } - // If we can't reach the original source text, use the canonical form if it's a number, - // or an escaped quoted form of the original text if it's string-like. - switch (node.kind) { - case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); - case 11 /* NoSubstitutionTemplateLiteral */: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12 /* TemplateHead */: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13 /* TemplateMiddle */: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14 /* TemplateTail */: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8 /* NumericLiteral */: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - // Find original source text, since we need to emit the raw strings of the tagged template. - // The raw strings contain the (escaped) strings of what the user wrote. - // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), - // thus we need to remove those characters. - // First template piece starts with "`", others with "}" - // Last template piece ends with "`", others with "${" - var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - // Newline normalization: - // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's - // and LineTerminatorSequences are normalized to for both TV and TRV. - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); - }); - } - write("]"); - } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - // Now we emit the expressions - if (node.template.kind === 181 /* TemplateExpression */) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 179 /* BinaryExpression */ - && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); - } - function emitTemplateExpression(node) { - // In ES6 mode and above, we can simply emit each portion of a template in order, but in - // ES3 & ES5 we must convert the template expression into a series of string concatenations. - if (languageVersion >= 2 /* ES6 */) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - // Check if the expression has operands and binds its operands less closely than binary '+'. - // If it does, we need to wrap the expression in parentheses. Otherwise, something like - // `abc${ 1 << 2 }` - // becomes - // "abc" + 1 << 2 + "" - // which is really - // ("abc" + 1) << (2 + "") - // rather than - // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 170 /* ParenthesizedExpression */ - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; - if (i > 0 || headEmitted) { - // If this is the first span and the head was not emitted, then this templateSpan's - // expression will be the first to be emitted. Don't emit the preceding ' + ' in that - // case. - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - // Only emit if the literal is non-empty. - // The binary '+' operator is left-associative, so the first string concatenation - // with the head will force the result up to this point to be a string. - // Emitting a '+ ""' has no semantic effect for middles and tails. - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); - } - } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar - // There is always atleast one templateSpan in this code path, since - // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 166 /* CallExpression */: - case 167 /* NewExpression */: - return parent.expression === template; - case 168 /* TaggedTemplateExpression */: - case 170 /* ParenthesizedExpression */: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; - } - } - /** - * Returns whether the expression has lesser, greater, - * or equal precedence to the binary '+' operator - */ - function comparePrecedenceToBinaryPlus(expression) { - // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' - // which have greater precedence and '-' which has equal precedence. - // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, - // although we convert the former into regular function expressions in ES5 mode, - // and in ES6 mode this function won't get called anyway. - // - // TODO (drosen): Note that we need to account for the upcoming 'yield' and - // spread ('...') unary operators that are anticipated for ES6. - switch (expression.kind) { - case 179 /* BinaryExpression */: - switch (expression.operatorToken.kind) { - case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: - return 1 /* GreaterThan */; - case 35 /* PlusToken */: - case 36 /* MinusToken */: - return 0 /* EqualTo */; - default: - return -1 /* LessThan */; - } - case 182 /* YieldExpression */: - case 180 /* ConditionalExpression */: - return -1 /* LessThan */; - default: - return 1 /* GreaterThan */; - } - } - } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); - } - function jsxEmitReact(node) { - /// Emit a tag name, which is either '"div"' for lower-cased names, or - /// 'Div' for upper-cased or dotted names - function emitTagName(name) { - if (name.kind === 67 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - /// Emit an attribute name, which is quoted if it needs to be quoted. Because - /// these emit into an object literal property name, we don't need to be worried - /// about keywords, just non-identifier characters - function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - /// Emit an name/value pair for an attribute (e.g. "x: 3") - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } - } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */); - syntheticReactRef.text = 'React'; - syntheticReactRef.parent = openingNode; - // Call React.createElement(tag, ... - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - // Attribute list - if (openingNode.attributes.length === 0) { - // When there are no attributes, React wants "null" - write("null"); - } - else { - // Either emit one big object literal (no spread attribs), or - // a call to React.__spread - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); - var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { - // If this is the first argument, we need to emit a {} as the first argument - if (i_1 === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i_1 > 0) { - write(", "); - } - emit(attrs[i_1].expression); - } - else { - ts.Debug.assert(attrs[i_1].kind === 236 /* JsxAttribute */); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i_1 > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i_1]); - } - } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); // closing paren to React.__spread( - } - else { - // One object literal with all the attributes in them - write("{"); - for (var i = 0; i < attrs.length; i++) { - if (i > 0) { - write(", "); - } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - // Children - if (children) { - for (var i = 0; i < children.length; i++) { - // Don't emit empty expressions - if (children[i].kind === 238 /* JsxExpression */ && !(children[i].expression)) { - continue; - } - // Don't emit empty strings - if (children[i].kind === 234 /* JsxText */) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); - } - } - else { - write(", "); - emit(children[i]); - } - } - } - // Closing paren - write(")"); // closes "React.createElement(" - emitTrailingComments(openingNode); - } - if (node.kind === 231 /* JsxElement */) { - emitJsxElement(node.openingElement, node.children); - } - else { - ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); - emitJsxElement(node); - } - } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); - } - } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); - } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 237 /* JsxSpreadAttribute */) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 236 /* JsxAttribute */); - emitJsxAttribute(attribs[i]); - } - } - } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 232 /* JsxSelfClosingElement */)) { - write(" "); - } - emitAttributes(node.attributes); - if (node.kind === 232 /* JsxSelfClosingElement */) { - write("/>"); - } - else { - write(">"); - } - } - function emitJsxClosingElement(node) { - write(""); - } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 231 /* JsxElement */) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); - emitJsxOpeningOrSelfClosingElement(node); - } - } - // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. - // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. - // For example, this is utilized when feeding in a result to Object.defineProperty. - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 161 /* BindingElement */); - if (node.kind === 9 /* StringLiteral */) { - emitLiteral(node); - } - else if (node.kind === 134 /* ComputedPropertyName */) { - // if this is a decorated computed property, we will need to capture the result - // of the property expression so that we can apply decorators later. This is to ensure - // we don't introduce unintended side effects: - // - // class C { - // [_a = x]() { } - // } - // - // The emit for the decorated computed property decorator is: - // - // Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); - // - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - // we have already generated a variable for this node, write that value instead. - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0 /* Auto */).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write("\""); - if (node.kind === 8 /* NumericLiteral */) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - write("\""); - } - } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 162 /* ArrayLiteralExpression */: - case 179 /* BinaryExpression */: - case 166 /* CallExpression */: - case 239 /* CaseClause */: - case 134 /* ComputedPropertyName */: - case 180 /* ConditionalExpression */: - case 137 /* Decorator */: - case 173 /* DeleteExpression */: - case 195 /* DoStatement */: - case 165 /* ElementAccessExpression */: - case 225 /* ExportAssignment */: - case 193 /* ExpressionStatement */: - case 186 /* ExpressionWithTypeArguments */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 194 /* IfStatement */: - case 232 /* JsxSelfClosingElement */: - case 233 /* JsxOpeningElement */: - case 237 /* JsxSpreadAttribute */: - case 238 /* JsxExpression */: - case 167 /* NewExpression */: - case 170 /* ParenthesizedExpression */: - case 178 /* PostfixUnaryExpression */: - case 177 /* PrefixUnaryExpression */: - case 202 /* ReturnStatement */: - case 244 /* ShorthandPropertyAssignment */: - case 183 /* SpreadElementExpression */: - case 204 /* SwitchStatement */: - case 168 /* TaggedTemplateExpression */: - case 188 /* TemplateSpan */: - case 206 /* ThrowStatement */: - case 169 /* TypeAssertionExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 182 /* YieldExpression */: - return true; - case 161 /* BindingElement */: - case 245 /* EnumMember */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 209 /* VariableDeclaration */: - return parent.initializer === node; - case 164 /* PropertyAccessExpression */: - return parent.expression === node; - case 172 /* ArrowFunction */: - case 171 /* FunctionExpression */: - return parent.body === node; - case 219 /* ImportEqualsDeclaration */: - return parent.moduleReference === node; - case 133 /* QualifiedName */: - return parent.left === node; - } - return false; - } - function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { - write("_arguments"); - return; - } - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 246 /* SourceFile */) { - // Identifier references module export - if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { - write("exports."); - } - } - else { - // Identifier references namespace export - write(getGeneratedNameForNode(container)); - write("."); - } - } - else if (languageVersion < 2 /* ES6 */) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 221 /* ImportClause */) { - // Identifier references default import - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); - return; - } - else if (declaration.kind === 224 /* ImportSpecifier */) { - // Identifier references named import - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); - if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); - } - else { - write("."); - write(identifier); - } - return; - } - } - declaration = resolver.getReferencedNestedRedeclaration(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function isNameOfNestedRedeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 209 /* VariableDeclaration */: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); - } - } - return false; - } - function emitIdentifier(node) { - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - emitExpressionIdentifier(node); - } - else if (isNameOfNestedRedeclaration(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { - write("_this"); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2 /* ES6 */) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256 /* SuperInstance */) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { - write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); - write("]"); - } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); - } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); - } - function emitYieldExpression(node) { - write(ts.tokenToString(112 /* YieldKeyword */)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } - } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(112 /* YieldKeyword */)); - write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } - } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 179 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 180 /* ConditionalExpression */ && node.parent.condition === node) { - return true; - } - return false; - } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 67 /* Identifier */: - case 162 /* ArrayLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 170 /* ParenthesizedExpression */: - // This list is not exhaustive and only includes those cases that are relevant - // to the check in emitArrayLiteral. More cases can be added as needed. - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - // Emit using the pattern .concat(, , ...) - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 183 /* SpreadElementExpression */) { - e = e.expression; - emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162 /* ArrayLiteralExpression */) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 183 /* SpreadElementExpression */) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 183 /* SpreadElementExpression */; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); - write("]"); - } - else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, - /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } - write("{"); - if (numElements > 0) { - var properties = node.properties; - // If we are not doing a downlevel transformation for object literals, - // then try to preserve the original shape of the object literal. - // Otherwise just try to preserve the formatting. - if (numElements === properties.length) { - emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); - } - else { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - } - write("}"); - } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createAndRecordTempVariable(0 /* Auto */); - // Write out the first non-computed properties - // (or all properties if none of them are computed), - // then emit the rest through indexing on the temp variable. - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 143 /* GetAccessor */ || property.kind === 144 /* SetAccessor */) { - // TODO (drosen): Reconcile with 'emitMemberFunctions'. - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 243 /* PropertyAssignment */) { - emit(property.initializer); - } - else if (property.kind === 244 /* ShorthandPropertyAssignment */) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 141 /* MethodDeclaration */) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2 /* ES6 */) { - var numProperties = properties.length; - // Find the first computed property. - // Everything until that point can be emitted as part of the initial object literal. - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 134 /* ComputedPropertyName */) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } - } - // Ordinary case: either the object has no computed properties - // or we're compiling with an ES6+ target. - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(179 /* BinaryExpression */, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(164 /* PropertyAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(165 /* ElementAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - // When diagnosing whether the expression needs parentheses, the decision should be based - // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 169 /* TypeAssertionExpression */ || expr.kind === 187 /* AsExpression */) { - expr = expr.expression; - } - // isLeftHandSideExpression is almost the correct criterion for when it is not necessary - // to parenthesize the expression before a dot. The known exceptions are: - // - // NewExpression: - // new C.x -> not the same as (new C).x - // NumberLiteral - // 1.x -> not the same as (1).x - // - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 167 /* NewExpression */ && - expr.kind !== 8 /* NumericLiteral */) { - return expr; - } - var node = ts.createSynthesizedNode(170 /* ParenthesizedExpression */); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2 /* ES6 */) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - // This is to ensure that we emit comment in the following case: - // For example: - // obj = { - // id: /*comment1*/ ()=>void - // } - // "comment1" is not considered to be leading comment for node.initializer - // but rather a trailing comment on the previous node. - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - // Return true if identifier resolves to an exported member of a namespace - function isNamespaceExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 246 /* SourceFile */; - } - function emitShorthandPropertyAssignment(node) { - // The name property of a short-hand property assignment is considered an expression position, so here - // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentSourceFile, node.name); - // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, - // we emit a normal property assignment. For example: - // module m { - // export let y; - // } - // module m { - // let obj = { y }; - // } - // Here we need to emit obj = { y : m.y } regardless of the output target. - if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { - // Emit identifier as an identifier - write(": "); - emit(node.name); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 164 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 164 /* PropertyAccessExpression */ || node.kind === 165 /* ElementAccessExpression */ - ? resolver.getConstantValue(node) - : undefined; - } - // Returns 'true' if the code was actually indented, false otherwise. - // If the code is not indented, an optional valueToWriteWhenNotIndenting will be - // emitted instead. - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - // Always use a newline for synthesized code if the synthesizer desires it. - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - // 1 .toString is a valid property access, emit a space after the literal - // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - var shouldEmitSpace; - if (!indentedBeforeDot) { - if (node.expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; - } - else { - // check if constant enum value is integer - var constantValue = tryGetConstEnumValue(node.expression); - // isFinite handles cases when constantValue is undefined - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 67 /* Identifier */) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, /*useFallback*/ true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, /*useFallback*/ false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 67 /* Identifier */: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 133 /* QualifiedName */: - emitQualifiedNameAsExpression(node, useFallback); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 183 /* SpreadElementExpression */; }); - } - function skipParentheses(node) { - while (node.kind === 170 /* ParenthesizedExpression */ || node.kind === 169 /* TypeAssertionExpression */ || node.kind === 187 /* AsExpression */) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 67 /* Identifier */ || node.kind === 95 /* ThisKeyword */ || node.kind === 93 /* SuperKeyword */) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 164 /* PropertyAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 165 /* ElementAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 93 /* SuperKeyword */) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 93 /* SuperKeyword */) { - // Calls of form super(...) and super.foo(...) - emitThis(target); - } - else { - // Calls of form obj.foo(...) - emit(target); - } - } - else { - // Calls of form foo(...) - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); - write(")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var superCall = false; - if (node.expression.kind === 93 /* SuperKeyword */) { - emitSuper(node.expression); - superCall = true; - } - else { - emit(node.expression); - superCall = node.expression.kind === 164 /* PropertyAccessExpression */ && node.expression.expression.kind === 93 /* SuperKeyword */; - } - if (superCall && languageVersion < 2 /* ES6 */) { - write(".call("); - emitThis(node.expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - // Spread operator logic is supported in new expressions in ES5 using a combination - // of Function.prototype.bind() and Function.prototype.apply(). - // - // Example: - // - // var args = [1, 2, 3, 4, 5]; - // new Array(...args); - // - // is compiled into the following ES5: - // - // var args = [1, 2, 3, 4, 5]; - // new (Array.bind.apply(Array, [void 0].concat(args))); - // - // The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new', - // Thus, we set it to undefined ('void 0'). - if (languageVersion === 1 /* ES5 */ && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2 /* ES6 */) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - // If the node is synthesized, it means the emitter put the parentheses there, - // not the user. If we didn't want them, the emitter would not have put them - // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172 /* ArrowFunction */) { - if (node.expression.kind === 169 /* TypeAssertionExpression */ || node.expression.kind === 187 /* AsExpression */) { - var operand = node.expression.expression; - // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; - while (operand.kind === 169 /* TypeAssertionExpression */ || operand.kind === 187 /* AsExpression */) { - operand = operand.expression; - } - // We have an expression of the form: (SubExpr) - // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. - // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: - // (new A).foo should be emitted as (new A).foo and not new A.foo - // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() - // new (A()) should be emitted as new (A()) and not new A() - // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 177 /* PrefixUnaryExpression */ && - operand.kind !== 175 /* VoidExpression */ && - operand.kind !== 174 /* TypeOfExpression */ && - operand.kind !== 173 /* DeleteExpression */ && - operand.kind !== 178 /* PostfixUnaryExpression */ && - operand.kind !== 167 /* NewExpression */ && - !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && - !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 164 /* PropertyAccessExpression */)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(76 /* DeleteKeyword */)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(101 /* VoidKeyword */)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(99 /* TypeOfKeyword */)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 67 /* Identifier */ || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 /* VariableDeclaration */ || node.parent.kind === 161 /* BindingElement */); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); - } - function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - // emit - // ++x - // as - // exports('x', ++x) - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - write(ts.tokenToString(node.operator)); - // In some cases, we need to emit a space between the operator and the operand. One obvious case - // is when the operator is an identifier, like delete or typeof. We also need to do this for plus - // and minus expressions in certain cases. Specifically, consider the following two cases (parens - // are just for clarity of exposition, and not part of the source code): - // - // (+(+1)) - // (+(++1)) - // - // We need to emit a space in both cases. In the first case, the absence of a space will make - // the resulting expression a prefix increment operation. And in the second, it will make the resulting - // expression a prefix increment whose operand is a plus expression - (++(+x)) - // The same is true of minus of course. - if (node.operand.kind === 177 /* PrefixUnaryExpression */) { - var operand = node.operand; - if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 40 /* PlusPlusToken */)) { - write(" "); - } - else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 41 /* MinusMinusToken */)) { - write(" "); - } - } - emit(node.operand); - if (exportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - // export function returns the value that was passes as the second argument - // however for postfix unary expressions result value should be the value before modification. - // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 40 /* PlusPlusToken */) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); - } - /* - * Checks if given node is a source file level declaration (not nested in module/function). - * If 'isExported' is true - then declaration must also be exported. - * This function is used in two cases: - * - check if node is a exported source file level value to determine - * if we should also export the value after its it changed - * - check if node is a source level declaration to emit it differently, - * i.e non-exported variable statement 'var x = 1' is hoisted so - * we we emit variable statement 'var' should be dropped. - */ - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = node; - while (current) { - if (current.kind === 246 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); - } - else if (ts.isFunctionLike(current) || current.kind === 217 /* ModuleBlock */) { - return false; - } - else { - current = current.parent; - } - } - } - function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 55 /* EqualsToken */ && - (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 193 /* ExpressionStatement */); - } - else { - var exportChanged = node.operatorToken.kind >= 55 /* FirstAssignment */ && - node.operatorToken.kind <= 66 /* LastAssignment */ && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (exportChanged) { - // emit assignment 'x y' as 'exports("x", x y)' - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - if (exportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - // Helper function to decrease the indent if we previously indented. Allows multiple - // previous indent values to be considered at a time. This also allows caller to just - // call this once, passing in all their appropriate indent values, instead of needing - // to call this helper function multiple times. - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 190 /* Block */) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15 /* OpenBraceToken */, node.pos); - write(" "); - emitToken(16 /* CloseBraceToken */, node.statements.end); - return; - } - emitToken(15 /* OpenBraceToken */, node.pos); - increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 217 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 216 /* ModuleDeclaration */); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 217 /* ModuleBlock */) { - emitTempDeclarations(/*newLine*/ true); - } - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.statements.end); - scopeEmitEnd(); - } - function emitEmbeddedStatement(node) { - if (node.kind === 190 /* Block */) { - write(" "); - emit(node); - } - else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); - } - } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 172 /* ArrowFunction */); - write(";"); - } - function emitIfStatement(node) { - var endPos = emitToken(86 /* IfKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(78 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 194 /* IfStatement */) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - write("do"); - emitEmbeddedStatement(node.statement); - if (node.statement.kind === 190 /* Block */) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); - write(");"); - } - function emitWhileStatement(node) { - write("while ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - /** - * Returns true if start of variable declaration list was emitted. - * Returns false if nothing was written - this can happen for source file level variable declarations - * in system modules where such variable declarations are hoisted. - */ - function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { - // variables in variable declaration list were already hoisted - return false; - } - var tokenKind = 100 /* VarKeyword */; - if (decl && languageVersion >= 2 /* ES6 */) { - if (ts.isLet(decl)) { - tokenKind = 106 /* LetKeyword */; - } - else if (ts.isConst(decl)) { - tokenKind = 72 /* ConstKeyword */; - } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); - } - else { - switch (tokenKind) { - case 100 /* VarKeyword */: - write("var "); - break; - case 106 /* LetKeyword */: - write("let "); - break; - case 72 /* ConstKeyword */: - write("const "); - break; - } - } - return true; - } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { - write(", "); - } - emit(decl); - } - return started; - } - function emitForStatement(node) { - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 199 /* ForOfStatement */) { - return emitDownLevelForOfStatement(node); - } - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 210 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 198 /* ForInStatement */) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); - } - function emitDownLevelForOfStatement(node) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - // Do not emit the LHS let declaration yet, because it might contain destructuring. - // Do not call recordTempDeclaration because we are declaring the temps - // right here. Recording means they will be declared later. - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 67 /* Identifier */; - var counter = createTempVariable(268435456 /* _i */); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); - // This is the let keyword for the counter and rhsReference. The let keyword for - // the LHS will be emitted inside the body. - emitStart(node.expression); - write("var "); - // _i = 0 - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - if (!rhsIsIdentifier) { - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } - write("; "); - // _i < _a.length; - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.initializer); - write("; "); - // _i++) - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.initializer); - emitToken(18 /* CloseParenToken */, node.expression.end); - // Body - write(" {"); - writeLine(); - increaseIndent(); - // Initialize LHS - // let v = _a[_i]; - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 210 /* VariableDeclarationList */) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - // This works whether the declaration is a var, let, or const. - // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); - } - else { - // The following call does not include the initializer, so we have - // to emit it separately. - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // It's an empty declaration list. This can only happen in an error case, if the user wrote - // for (let of []) {} - emitNodeWithoutSourceMap(createTempVariable(0 /* Auto */)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // Initializer is an expression. Emit the expression in the body, so that it's - // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, 55 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); - if (node.initializer.kind === 162 /* ArrayLiteralExpression */ || node.initializer.kind === 163 /* ObjectLiteralExpression */) { - // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause - // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (node.statement.kind === 190 /* Block */) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - writeLine(); - decreaseIndent(); - write("}"); - } - function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */, node.pos); - emitOptional(" ", node.label); - write(";"); - } - function emitReturnStatement(node) { - emitToken(92 /* ReturnKeyword */, node.pos); - emitOptional(" ", node.expression); - write(";"); - } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitSwitchStatement(node) { - var endPos = emitToken(94 /* SwitchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - endPos = emitToken(18 /* CloseParenToken */, node.expression.end); - write(" "); - emitCaseBlock(node.caseBlock, endPos); - } - function emitCaseBlock(node, startPos) { - emitToken(15 /* OpenBraceToken */, startPos); - increaseIndent(); - emitLines(node.clauses); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 239 /* CaseClause */) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(70 /* CatchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.variableDeclaration); - emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(74 /* DebuggerKeyword */, node.pos); - write(";"); - } - function emitLabelledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 216 /* ModuleDeclaration */); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { - write("exports."); - } - } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); - zero.text = "0"; - var result = ts.createSynthesizedNode(175 /* VoidExpression */); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 246 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 225 /* ExportAssignment */); - // only allow export default at a source file level - if (compilerOptions.module === 1 /* CommonJS */ || compilerOptions.module === 2 /* AMD */ || compilerOptions.module === 3 /* UMD */) { - if (!currentSourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 1 /* ES5 */) { - // default value of configurable, enumerable, writable are `false`. - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); - writeLine(); - } - else if (languageVersion === 0 /* ES3 */) { - write("exports.__esModule = true;"); - writeLine(); - } - } - } - } - } - function emitExportMemberAssignment(node) { - if (node.flags & 1 /* Export */) { - writeLine(); - emitStart(node); - // emit call to exporter only for top level nodes - if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { - // emit export default as - // export("default", ) - write(exportFunctionForFile + "(\""); - if (node.flags & 1024 /* Default */) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 1024 /* Default */) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } - } - function emitExportMemberAssignments(name) { - if (compilerOptions.module === 4 /* System */) { - return; - } - if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } - } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(compilerOptions.module === 4 /* System */); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; - } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - // An exported declaration is actually emitted as an assignment (to a property on the module object), so - // temporary variables in an exported declaration need to have real declarations elsewhere - // Also temporary variables should be explicitly allocated for source level declarations when module target is system - // because actual variable declarations are hoisted - var canDefineTempVariablesInPlace = false; - if (root.kind === 209 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 136 /* Parameter */) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 179 /* BinaryExpression */) { - emitAssignmentExpression(root); - } - else { - ts.Debug.assert(!isAssignmentExpressionStatement); - emitBindingElement(root, value); - } - function emitAssignment(name, value) { - if (emitCount++) { - write(", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 /* VariableDeclaration */ || name.parent.kind === 161 /* BindingElement */); - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - if (exportChanged) { - write(")"); - } - } - /** - * Ensures that there exists a declared identifier whose value holds the given expression. - * This function is useful to ensure that the expression's value can be read from in subsequent expressions. - * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. - * - * @param expr the expression whose value needs to be bound. - * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; - * false if it is necessary to always emit an identifier. - */ - function ensureIdentifier(expr, reuseIdentifierExpressions) { - if (expr.kind === 67 /* Identifier */ && reuseIdentifierExpressions) { - return expr; - } - var identifier = createTempVariable(0 /* Auto */); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - return identifier; - } - function createDefaultValueCheck(value, defaultValue) { - // The value expression will be evaluated twice, so for anything but a simple identifier - // we need to generate a temporary variable - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(180 /* ConditionalExpression */); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(52 /* QuestionToken */); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(53 /* ColonToken */); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8 /* NumericLiteral */); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 67 /* Identifier */) { - return createElementAccessExpression(object, syntheticName); - } - return createPropertyAccessExpression(object, syntheticName); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(166 /* CallExpression */); - var sliceIdentifier = ts.createSynthesizedNode(67 /* Identifier */); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value) { - var properties = target.properties; - if (properties.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; - if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { - var propName = p.name; - emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); - } - } - } - function emitArrayLiteralAssignment(target, value) { - var elements = target.elements; - if (elements.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 185 /* OmittedExpression */) { - if (e.kind !== 183 /* SpreadElementExpression */) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); - } - } - } - } - function emitDestructuringAssignment(target, value) { - if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { - value = createDefaultValueCheck(value, target.right); - target = target.left; - } - if (target.kind === 163 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value); - } - else if (target.kind === 162 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value); - } - else { - emitAssignment(target, value); - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { - if (root.parent.kind !== 170 /* ParenthesizedExpression */) { - write("("); - } - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - emitDestructuringAssignment(target, value); - write(", "); - emit(value); - if (root.parent.kind !== 170 /* ParenthesizedExpression */) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - if (target.initializer) { - // Combine value and initializer - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; - } - else if (!value) { - // Use 'void 0' in absence of value and initializer - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything other than a single-element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. Additionally, if we have zero elements - // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, - // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 159 /* ObjectBindingPattern */) { - // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 185 /* OmittedExpression */) { - if (!element.dotDotDotToken) { - // Rewrite element to a declaration that accesses array element at index i - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value); - } - } - } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - else { - var initializer = node.initializer; - if (!initializer && languageVersion < 2 /* ES6 */) { - // downlevel emit for non-initialized let bindings defined in loops - // for (...) { let x; } - // should be - // for (...) { var = void 0; } - // this is necessary to preserve ES6 semantic in scenarios like - // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); - // NOTE: default initialization should not be added to let bindings in for-in\for-of statements - if (isUninitializedLet && - node.parent.parent.kind !== 198 /* ForInStatement */ && - node.parent.parent.kind !== 199 /* ForOfStatement */) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 185 /* OmittedExpression */) { - return; - } - var name = node.name; - if (name.kind === 67 /* Identifier */) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 209 /* VariableDeclaration */ && node.parent.kind !== 161 /* BindingElement */)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1 /* Export */) && - languageVersion >= 2 /* ES6 */ && - node.parent.kind === 246 /* SourceFile */; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1 /* Export */) { - if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - // If we're not exporting the variables, there's nothing special here. - // Always emit comments for these nodes. - if (!(node.flags & 1 /* Export */)) { - return true; - } - // If we are exporting, but it's a top-level ES6 module exports, - // we'll emit the declaration list verbatim, so emit comments too. - if (isES6ExportedDeclaration(node)) { - return true; - } - // Otherwise, only emit if we have at least one initializer present. - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2 /* ES6 */) { - if (ts.isBindingPattern(node.name)) { - var name_23 = createTempVariable(0 /* Auto */); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_23); - emit(name_23); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2 /* ES6 */) { - var tempIndex = 0; - ts.forEach(node.parameters, function (parameter) { - // A rest parameter cannot have a binding pattern or an initializer, - // so let's just ignore it. - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - // In cases where a binding pattern is simply '[]' or '{}', - // we usually don't want to emit a var declaration; however, in the presence - // of an initializer, we must emit that expression to preserve side effects. - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); - } - else { - emit(tempParameters[tempIndex]); - write(" = "); - emit(initializer); - } - write(";"); - tempIndex++; - } - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); - } - }); - } - } - function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. - if (ts.isBindingPattern(restParam.name)) { - return; - } - var tempName = createTempVariable(268435456 /* _i */).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitAccessor(node) { - write(node.kind === 143 /* GetAccessor */ ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); - } - function shouldEmitAsArrowFunction(node) { - return node.kind === 172 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; - } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 171 /* FunctionExpression */) { - // Emit name if one is present - return !!node.name; - } - if (node.kind === 211 /* FunctionDeclaration */) { - // Emit name if one is present, or emit generated name in down-level case (for export default case) - return !!node.name || languageVersion < 2 /* ES6 */; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitCommentsOnNotEmittedNode(node); - } - // TODO (yuisu) : we should not have special cases to condition emitting comments - // but have one place to fix check for these conditions. - if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */ && - node.parent && node.parent.kind !== 243 /* PropertyAssignment */ && - node.parent.kind !== 166 /* CallExpression */) { - // 1. Methods will emit the comments as part of emitting method declaration - // 2. If the function is a property of object literal, emitting leading-comments - // is done by emitNodeWithoutSourceMap which then call this function. - // In particular, we would like to avoid emit comments twice in following case: - // For example: - // var obj = { - // id: - // /*comment*/ () => void - // } - // 3. If the function is an argument in call expression, emitting of comments will be - // taken care of in emit list of arguments inside of emitCallexpression - emitLeadingComments(node); - } - emitStart(node); - // For targeting below es6, emit functions-like declaration including arrow function using function keyword. - // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024 /* Default */) { - write("default "); - } - } - write("function"); - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); - } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 211 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - // Check whether the parameter list needs parentheses and preserve no-parenthesis - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 172 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; - var args; - // An async function is emit as an outer function that calls an inner - // generator function. To preserve lexical bindings, we pass the current - // `this` and `arguments` objects to `__awaiter`. The generator function - // passed to `__awaiter` is executed inside of the callback to the - // promise constructor. - // - // The emit for an async arrow without a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await b; } - // - // // output - // let a = (b) => __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // - // The emit for an async arrow with a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await arguments[0]; } - // - // // output - // let a = (b) => __awaiter(this, arguments, void 0, function* (arguments) { - // yield arguments[0]; - // }); - // - // The emit for an async function expression without a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await b; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, void 0, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // and a return type annotation might be: - // - // // input - // let a = async function (b): MyPromise { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, MyPromise, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // If this is not an async arrow, emit the opening brace of the function body - // and the start of the return statement. - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments"); - } - else { - write(", void 0"); - } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); - } - else { - write(", Promise"); - } - // Emit the call to __awaiter. - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } - // Emit the signature and body for the inner generator function. - emitFunctionBody(node); - write(")"); - // If this is not an async arrow, emit the closing brace of the outer function body. - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitFunctionBody(node) { - if (!node.body) { - // There can be no body when there are parse errors. Just emit an empty block - // in that case. - write(" { }"); - } - else { - if (node.body.kind === 190 /* Block */) { - emitBlockFunctionBody(node, node.body); - } - else { - emitExpressionFunctionBody(node, node.body); - } - } - } - function emitSignatureAndBody(node) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - // When targeting ES6, emit arrow function natively in ES6 - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2 /* ES6 */) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - // Returns true if any preamble code was emitted. - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - // For es6 and higher we can emit the expression as is. However, in the case - // where the expression might end up looking like a block when emitted, we'll - // also wrap it in parentheses first. For example if you have: a => {} - // then we need to generate: a => ({}) - write(" "); - // Unwrap all type assertions. - var current = body; - while (current.kind === 169 /* TypeAssertionExpression */) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 163 /* ObjectLiteralExpression */); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedComments(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - // If we didn't have to emit any preamble code, then attempt to keep the arrow - // function on one line. - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(/*newLine*/ true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - scopeEmitEnd(); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedComments(body.statements); - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16 /* CloseBraceToken */, body.statements.end); - scopeEmitEnd(); - } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 193 /* ExpressionStatement */) { - var expr = statement.expression; - if (expr && expr.kind === 166 /* CallExpression */) { - var func = expr.expression; - if (func && func.kind === 93 /* SuperKeyword */) { - return statement; - } - } - } - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - // This does not emit source map because it is emitted by caller as caller - // is aware how the property name changes to the property access - // eg. public x = 10; becomes this.x and static x = 10 becomes className.x - if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 134 /* ComputedPropertyName */) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 139 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { - properties.push(member); - } - } - return properties; - } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; - emitPropertyDeclaration(node, property); - } - } - function emitPropertyDeclaration(node, property, receiver, isExpression) { - writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - emit(receiver); - } - else { - if (property.flags & 128 /* Static */) { - emitDeclarationName(node); - } - else { - write("this"); - } - } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 189 /* SemicolonClassElement */) { - writeLine(); - write(";"); - } - else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { - if (!member.body) { - return emitCommentsOnNotEmittedNode(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - else if (member.kind === 141 /* MethodDeclaration */ || - member.kind === 143 /* GetAccessor */ || - member.kind === 144 /* SetAccessor */) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 128 /* Static */) { - write("static "); - } - if (member.kind === 143 /* GetAccessor */) { - write("get "); - } - else if (member.kind === 144 /* SetAccessor */) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 189 /* SemicolonClassElement */) { - writeLine(); - write(";"); - } - } - } - function emitConstructor(node, baseTypeElement) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitConstructorWorker(node, baseTypeElement) { - // Check if we have property assignment inside class declaration. - // If there is property assignment, we need to emit constructor whether users define it or not - // If there is no property assignment, we can omit constructor if users do not define it - var hasInstancePropertyWithInitializer = false; - // Emit the constructor overload pinned comments - ts.forEach(node.members, function (member) { - if (member.kind === 142 /* Constructor */ && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - // Check if there is any non-static property assignment - if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - // For target ES6 and above, if there is no user-defined constructor and there is no property assignment - // do not emit constructor in class declaration. - if (languageVersion >= 2 /* ES6 */ && !ctor && !hasInstancePropertyWithInitializer) { - return; - } - if (ctor) { - emitLeadingComments(ctor); - } - emitStart(ctor || node); - if (languageVersion < 2 /* ES6 */) { - write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); - } - else { - write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - // Based on EcmaScript6 section 14.5.14: Runtime Semantics: ClassDefinitionEvaluation. - // If constructor is empty, then, - // If ClassHeritageopt is present, then - // Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition. - // Else, - // Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition - if (baseTypeElement) { - write("(...args)"); - } - else { - write("()"); - } - } - } - var startIndex = 0; - write(" {"); - scopeEmitStart(node, "constructor"); - increaseIndent(); - if (ctor) { - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedComments(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); - } - else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2 /* ES6 */) { - write("_super.apply(this, arguments);"); - } - else { - write("super(...args);"); - } - emitEnd(baseTypeElement); - } - } - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } - } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); - } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - emitClassLikeDeclarationBelowES6(node); - } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 212 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { - // To preserve the correct runtime semantics when decorators are applied to the class, - // the emit needs to follow one of the following rules: - // - // * For a local class declaration: - // - // @dec class C { - // } - // - // The emit should be: - // - // let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For an exported class declaration: - // - // @dec export class C { - // } - // - // The emit should be: - // - // export let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For a default export of a class declaration with a name: - // - // @dec default export class C { - // } - // - // The emit should be: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // export default C; - // - // * For a default export of a class declaration without a name: - // - // @dec default export class { - // } - // - // The emit should be: - // - // let _default = class { - // } - // _default = __decorate([dec], _default); - // export default _default; - // - if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024 /* Default */) { - write("default "); - } - } - } - // If the class has static properties, and it's a class expression, then we'll need - // to specialize the emit a bit. for a class expression of the form: - // - // class C { static a = 1; static b = 2; ... } - // - // We'll emit: - // - // (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp) - // - // This keeps the expression as an expression, while ensuring that the static parts - // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, /*static:*/ true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184 /* ClassExpression */; - var tempVariable; - if (isClassExpressionWithStaticProperties) { - tempVariable = createAndRecordTempVariable(0 /* Auto */); - write("("); - increaseIndent(); - emit(tempVariable); - write(" = "); - } - write("class"); - // check if this is an "export default class" as it may not have a name. Do not emit the name if the class is decorated. - if ((node.name || !(node.flags & 1024 /* Default */)) && !thisNodeIsDecorated) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - scopeEmitStart(node); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. - // For a decorated class, we need to assign its name (if it has one). This is because we emit - // the class as a class expression to avoid the double-binding of the identifier: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // - if (thisNodeIsDecorated) { - write(";"); - } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); - } - write(","); - writeLine(); - emit(tempVariable); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); - } - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { - // if this is a top level default export of decorated class, write the export after the declaration. - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 212 /* ClassDeclaration */) { - // source file level classes in system modules are hoisted so 'var's for them are already defined - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - scopeEmitStart(node); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); - writeLine(); - emitDecoratorsOfClass(node); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(/*newLine*/ true); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - emitStart(node); - write(")("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write(")"); - if (node.kind === 212 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - if (node.kind === 212 /* ClassDeclaration */) { - emitExportMemberAssignment(node); - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 128 /* Static */)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 128 /* Static */); - emitDecoratorsOfConstructor(node); - } - function emitDecoratorsOfConstructor(node) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !hasDecoratedParameters) { - return; - } - // Emit the call to __decorate. Given the class: - // - // @dec - // class C { - // } - // - // The emit for the class is: - // - // C = __decorate([dec], C); - // - writeLine(); - emitStart(node); - emitDeclarationName(node); - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); - emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(");"); - emitEnd(node); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - // only emit members in the correct group - if ((member.flags & 128 /* Static */) !== staticFlag) { - continue; - } - // skip members that cannot be decorated (such as the constructor) - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - // skip a member if it or any of its parameters are not decorated - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } - // skip an accessor declaration if it is not the first accessor - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - // get the decorators from the first accessor with decorators - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - // we only decorate parameters of the set accessor - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - // we only decorate the parameters here if this is a method - if (member.kind === 141 /* MethodDeclaration */) { - functionLikeMember = member; - } - } - // Emit the call to __decorate. Given the following: - // - // class C { - // @dec method(@dec2 x) {} - // @dec get accessor() {} - // @dec prop; - // } - // - // The emit for a method is: - // - // Object.defineProperty(C.prototype, "method", - // __decorate([ - // dec, - // __param(0, dec2), - // __metadata("design:type", Function), - // __metadata("design:paramtypes", [Object]), - // __metadata("design:returntype", void 0) - // ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); - // - // The emit for an accessor is: - // - // Object.defineProperty(C.prototype, "accessor", - // __decorate([ - // dec - // ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); - // - // The emit for a property is: - // - // __decorate([ - // dec - // ], C.prototype, "prop"); - // - writeLine(); - emitStart(member); - if (member.kind !== 139 /* PropertyDeclaration */) { - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(","); - increaseIndent(); - writeLine(); - } - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - if (member.kind !== 139 /* PropertyDeclaration */) { - write(", Object.getOwnPropertyDescriptor("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write("))"); - decreaseIndent(); - } - write(");"); - emitEnd(member); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); - emit(decorator.expression); - write(")"); - emitEnd(decorator); - }); - leadingComma = true; - } - ++parameterIndex; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - // This method determines whether to emit the "design:type" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 139 /* PropertyDeclaration */: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - // This method determines whether to emit the "design:returntype" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 141 /* MethodDeclaration */: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 212 /* ClassDeclaration */: - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: - return true; - } - return false; - } - /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ - function emitSerializedTypeOfNode(node) { - // serialization of the type of a declaration uses the following rules: - // - // * The serialized type of a ClassDeclaration is "Function" - // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. - // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. - // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. - // * The serialized type of any other FunctionLikeDeclaration is "Function". - // * The serialized type of any other node is "void 0". - // - // For rules on serializing type annotations, see `serializeTypeNode`. - switch (node.kind) { - case 212 /* ClassDeclaration */: - write("Function"); - return; - case 139 /* PropertyDeclaration */: - emitSerializedTypeNode(node.type); - return; - case 136 /* Parameter */: - emitSerializedTypeNode(node.type); - return; - case 143 /* GetAccessor */: - emitSerializedTypeNode(node.type); - return; - case 144 /* SetAccessor */: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 101 /* VoidKeyword */: - write("void 0"); - return; - case 158 /* ParenthesizedType */: - emitSerializedTypeNode(node.type); - return; - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - write("Function"); - return; - case 154 /* ArrayType */: - case 155 /* TupleType */: - write("Array"); - return; - case 148 /* TypePredicate */: - case 118 /* BooleanKeyword */: - write("Boolean"); - return; - case 128 /* StringKeyword */: - case 9 /* StringLiteral */: - write("String"); - return; - case 126 /* NumberKeyword */: - write("Number"); - return; - case 129 /* SymbolKeyword */: - write("Symbol"); - return; - case 149 /* TypeReference */: - emitSerializedTypeReferenceNode(node); - return; - case 152 /* TypeQuery */: - case 153 /* TypeLiteral */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 115 /* AnyKeyword */: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - // Clone the type name and parent it to a location outside of the current declaration. - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0 /* Auto */); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, /*useFallback*/ true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, /*useFallback*/ false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2 /* ES6 */) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ - function emitSerializedParameterTypesOfNode(node) { - // serialization of parameter types uses the following rules: - // - // * If the declaration is a class, the parameters of the first constructor with a body are used. - // * If the declaration is function-like and has a body, the parameters of the function are used. - // - // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. - if (node) { - var valueDeclaration; - if (node.kind === 212 /* ClassDeclaration */) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; - if (parameterCount > 0) { - for (var i = 0; i < parameterCount; i++) { - if (i > 0) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType.kind === 154 /* ArrayType */) { - parameterType = parameterType.elementType; - } - else if (parameterType.kind === 149 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - /** Serializes the return type of function. Used by the __metadata decorator for a method. */ - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node) && node.type) { - emitSerializedTypeNode(node.type); - return; - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - // This method emits the serialized type metadata for a decorator target. - // The caller should have already tested whether the node has decorators. - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitCommentsOnNotEmittedNode(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - // const enums are completely erased during compilation. - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - scopeEmitStart(node); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { - // write the call to exporter for enum - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); - } - function emitModuleDeclaration(node) { - // Emit only if this module is non-ambient. - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitCommentsOnNotEmittedNode(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - if (node.body.kind === 217 /* ModuleBlock */) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - scopeEmitStart(node); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); - scopeEmitEnd(); - } - write(")("); - // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 67 /* Identifier */ && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - /* - * Some bundlers (SystemJS builder) sometimes want to rename dependencies. - * Here we check if alternative name was provided for a given moduleName and return it if possible. - */ - function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9 /* StringLiteral */) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18 /* CloseParenToken */, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 219 /* ImportEqualsDeclaration */) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222 /* NamespaceImport */) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 220 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - return emitExternalImportDeclaration(node); - } - // ES6 import - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 219 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (compilerOptions.module !== 2 /* AMD */) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - // import x = require("foo") - // import * as x from "foo" - if (!isExportedImport) - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - // import "foo" - // import x from "foo" - // import { x, y } from "foo" - // import d, * as x from "foo" - // import d, { x, y } from "foo" - var isNakedImport = 220 /* ImportDeclaration */ && !node.importClause; - if (!isNakedImport) { - write("var "); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when - // - current file is not external module - // - import declaration is top level and target is value imported by entity name - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - // variable declaration for import-equals declaration can be hoisted in system modules - // in this case 'var' should be omitted and emit should contain only initialization - var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); - // is it top level export import v = a.b.c in system module? - // if yes - it needs to be rewritten as exporter('v', v = a.b.c) - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1 /* Export */)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(compilerOptions.module !== 4 /* System */); - if (languageVersion < 2 /* ES6 */) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - // export { x, y, ... } from "foo" - if (compilerOptions.module !== 2 /* AMD */) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - // export * from "foo" - writeLine(); - write("__export("); - if (compilerOptions.module !== 2 /* AMD */) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - // export { x, y, ... } - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(languageVersion >= 2 /* ES6 */); - var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= 2 /* ES6 */) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 211 /* FunctionDeclaration */ && - expression.kind !== 212 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4 /* System */) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = {}; - exportEquals = undefined; - hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 220 /* ImportDeclaration */: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { - // import "mod" - // import x from "mod" where x is referenced - // import * as x from "mod" where x is referenced - // import { x, y } from "mod" where at least one import is referenced - externalImports.push(node); - } - break; - case 219 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 230 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { - // import x = require("mod") where x is referenced - externalImports.push(node); - } - break; - case 226 /* ExportDeclaration */: - if (node.moduleSpecifier) { - if (!node.exportClause) { - // export * from "mod" - externalImports.push(node); - hasExportStars = true; - } - else if (resolver.isValueAliasDeclaration(node)) { - // export { x, y } from "mod" where at least one export is a value symbol - externalImports.push(node); - } - } - else { - // export { x, y } - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_24 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_24] || (exportSpecifiers[name_24] = [])).push(specifier); - } - } - break; - case 225 /* ExportAssignment */: - if (node.isExportEquals && !exportEquals) { - // export = x - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStars) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - if (node.kind === 220 /* ImportDeclaration */ && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 226 /* ExportDeclaration */ && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9 /* StringLiteral */) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; - // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 226 /* ExportDeclaration */ || - (importNode.kind === 220 /* ImportDeclaration */ && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - // when resolving exports local exported entries/indirect exported entries in the module - // should always win over entries with similar names that were added via star exports - // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - if (!hasExportStars) { - // local names set is needed only in presence of star exports - return undefined; - } - // local names set should only be added if we have anything exported - if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { - // no exported declarations (export var ...) or export specifiers (export {x}) - // check if we have any non star export declarations. - var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; - if (externalImport.kind === 226 /* ExportDeclaration */ && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - // we still need to emit exportStar helper - return emitExportStarFunction(/*localNames*/ undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { - // write name of exported declaration, i.e 'export var x...' - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - // write name of export specified, i.e. 'export {x}' - writeExportedName(specifier.name); - } - } - } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; - if (externalImport.kind !== 226 /* ExportDeclaration */) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - // export * from ... - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - // write name of indirectly exported entry, i.e. 'export {x} from ...' - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - // define an export star helper function - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - // do not record default exports - // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 67 /* Identifier */ && node.flags & 1024 /* Default */) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 67 /* Identifier */) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - // per ES6 spec: - // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method - // - var declarations are initialized to undefined - 14.a.ii - // - function/generator declarations are instantiated - 16.a.iv - // this means that after module is instantiated but before its evaluation - // exported functions are already accessible at import sites - // in theory we should hoist only exported functions and its dependencies - // in practice to simplify things we'll hoist all source level functions and variable declaration - // including variables declarations for module and class declarations - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { - var local = hoistedVars[i]; - var name_25 = local.kind === 67 /* Identifier */ - ? local - : local.name; - if (name_25) { - // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_25.text); - if (ts.hasProperty(seen, text)) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 212 /* ClassDeclaration */ || local.kind === 216 /* ModuleDeclaration */ || local.kind === 215 /* EnumDeclaration */) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 67 /* Identifier */ ? local.parent : local); - if (flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; - writeLine(); - emit(f); - if (f.flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2 /* Ambient */) { - return; - } - if (node.kind === 211 /* FunctionDeclaration */) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 212 /* ClassDeclaration */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 215 /* EnumDeclaration */) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 216 /* ModuleDeclaration */) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { - if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_26 = node.name; - if (name_26.kind === 67 /* Identifier */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_26); - } - else { - ts.forEachChild(name_26, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - // hoist variable if - // - it is not block scoped - // - it is top level block scoped - // if block scoped variables are nested in some another block then - // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 246 /* SourceFile */; - } - function isCurrentFileSystemExternalModule() { - return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - // shape of the body in system modules: - // function (exports) { - // - // - // - // return { - // setters: [ - // - // ], - // execute: function() { - // - // } - // } - // - // } - // I.e: - // import {x} from 'file1' - // var y = 1; - // export function foo() { return y + x(); } - // console.log(y); - // will be transformed to - // function(exports) { - // var file1; // local alias - // var y; - // function foo() { return y + file1.x(); } - // exports("foo", foo); - // return { - // setters: [ - // function(v) { file1 = v } - // ], - // execute(): function() { - // y = 1; - // console.log(y); - // } - // }; - // } - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); // return - emitTempDeclarations(/*newLine*/ true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - // derive a unique name for parameter from the first named entry in the group - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 220 /* ImportDeclaration */: - if (!entry.importClause) { - // 'import "..."' case - // module is imported only for side-effects, no emit required - break; - } - // fall-through - case 219 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - // save import into the local - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 226 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - // export {a, b as c} from 'foo' - // emit as: - // exports_({ - // "a": _["a"], - // "c": _["b"] - // }); - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_2]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - writeLine(); - // export * from 'foo' - // emit as: - // exportStar(_foo); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { - var statement = node.statements[i]; - switch (statement.kind) { - // - function declarations are not emitted because they were already hoisted - // - import declarations are not emitted since they are already handled in setters - // - export declarations with module specifiers are not emitted since they were already written in setters - // - export declarations without module specifiers are emitted preserving the order - case 211 /* FunctionDeclaration */: - case 220 /* ImportDeclaration */: - continue; - case 226 /* ExportDeclaration */: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - // write call to exporter function for every export specifier in exports list - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 219 /* ImportEqualsDeclaration */: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - // - import equals declarations that import external modules are not emitted - continue; - } - // fall-though for import declarations that import internal modules - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); // execute - } - function emitSystemModule(node, startIndex) { - collectExternalModuleInfo(node); - // System modules has the following shape - // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) - // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. - // 'exports' returns its 'value' argument so in most cases expressions - // that mutate exported values can be rewritten as: - // expr -> exports('name', expr). - // The only exception in this rule is postfix unary operators, - // see comment to 'emitPostfixUnaryExpression' for more details - ts.Debug.assert(!exportFunctionForFile); - // make sure that name of 'exports' function does not conflict with existing identifiers - exportFunctionForFile = makeUniqueName("exports"); - writeLine(); - write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - write("["); - var groupIndices = {}; - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ") {"); - writeLine(); - increaseIndent(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitAMDDependencies(node, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list - // names of modules with corresponding parameter in the factory function - var aliasedModuleNames = []; - // names of modules with no corresponding parameters in factory function - var unaliasedModuleNames = []; - var importAliasNames = []; // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding - // module names in aliasedModuleNames. - // Fill in amd-dependency tags - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); - } - } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; - // Find the name of the external module - var externalModuleName = getExternalModuleNameText(importNode); - // Find the name of the module alias, if there is one - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - write("[\"require\", \"exports\""); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } - write("], function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - } - function emitAMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ false); - } - function emitUMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - // Module is detected first to support Browserify users that load into a browser with an AMD loader - writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); - emitAMDDependencies(node, false); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node, startIndex) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - // Emit exportDefault if it exists will happen as part - // or normal statement emit. - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); - } - } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - jsxEmitReact(node); - break; - case 1 /* Preserve */: - // Fall back to preserve if None was specified (we'll error earlier) - default: - jsxEmitPreserve(node); - break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpace(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - if (result) { - // Replace entities like   - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); - } - else { - return s; - } - }); - } - return result; - } - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1 /* Preserve */: - default: - return ts.getTextOfNode(node, /*includeTrivia*/ true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - write("\""); - write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); - break; - case 1 /* Preserve */: - default: - writer.writeLiteral(ts.getTextOfNode(node, /*includeTrivia*/ true)); - break; - } - } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1 /* Preserve */: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2 /* React */: - emit(node.expression); - break; - } - } - } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - // return index of the first non prologue directive - return i; - } - } - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - // Only emit helpers if the user did not say otherwise. - if (!compilerOptions.noEmitHelpers) { - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - // Start new file on new line - writeLine(); - emitShebang(); - emitDetachedComments(node); - // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= 2 /* ES6 */) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === 2 /* AMD */) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === 4 /* System */) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === 3 /* UMD */) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } - } - else { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - } - emitLeadingComments(node.endOfFileToken); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2 /* Ambient */) { - return emitCommentsOnNotEmittedNode(node); - } - if (isSpecializedCommentHandling(node)) { - // This is the node that will handle its own comments and sourcemap - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - // All of these entities are emitted in a specialized fashion. As such, we allow - // the specialized methods for each to handle the comments on the nodes. - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 225 /* ExportAssignment */: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 191 /* VariableStatement */: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 216 /* ModuleDeclaration */: - // Only emit the leading/trailing comments for a module if we're actually - // emitting the module as well. - return shouldEmitModuleDeclaration(node); - case 215 /* EnumDeclaration */: - // Only emit the leading/trailing comments for an enum if we're actually - // emitting the module as well. - return shouldEmitEnumDeclaration(node); - } - // If the node is emitted in specialized fashion, dont emit comments as this node will handle - // emitting comments when emitting itself - ts.Debug.assert(!isSpecializedCommentHandling(node)); - // If this is the expression body of an arrow function that we're down-leveling, - // then we don't want to emit comments when we emit the body. It will have already - // been taken care of when we emitted the 'return' statement for the function - // expression body. - if (node.kind !== 190 /* Block */ && - node.parent && - node.parent.kind === 172 /* ArrowFunction */ && - node.parent.body === node && - compilerOptions.target <= 1 /* ES5 */) { - return false; - } - // Emit comments for everything else. - return true; - } - function emitJavaScriptWorker(node) { - // Check if the node can be emitted regardless of the ScriptTarget - switch (node.kind) { - case 67 /* Identifier */: - return emitIdentifier(node); - case 136 /* Parameter */: - return emitParameter(node); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - return emitMethod(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - return emitAccessor(node); - case 95 /* ThisKeyword */: - return emitThis(node); - case 93 /* SuperKeyword */: - return emitSuper(node); - case 91 /* NullKeyword */: - return write("null"); - case 97 /* TrueKeyword */: - return write("true"); - case 82 /* FalseKeyword */: - return write("false"); - case 8 /* NumericLiteral */: - case 9 /* StringLiteral */: - case 10 /* RegularExpressionLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 12 /* TemplateHead */: - case 13 /* TemplateMiddle */: - case 14 /* TemplateTail */: - return emitLiteral(node); - case 181 /* TemplateExpression */: - return emitTemplateExpression(node); - case 188 /* TemplateSpan */: - return emitTemplateSpan(node); - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - return emitJsxElement(node); - case 234 /* JsxText */: - return emitJsxText(node); - case 238 /* JsxExpression */: - return emitJsxExpression(node); - case 133 /* QualifiedName */: - return emitQualifiedName(node); - case 159 /* ObjectBindingPattern */: - return emitObjectBindingPattern(node); - case 160 /* ArrayBindingPattern */: - return emitArrayBindingPattern(node); - case 161 /* BindingElement */: - return emitBindingElement(node); - case 162 /* ArrayLiteralExpression */: - return emitArrayLiteral(node); - case 163 /* ObjectLiteralExpression */: - return emitObjectLiteral(node); - case 243 /* PropertyAssignment */: - return emitPropertyAssignment(node); - case 244 /* ShorthandPropertyAssignment */: - return emitShorthandPropertyAssignment(node); - case 134 /* ComputedPropertyName */: - return emitComputedPropertyName(node); - case 164 /* PropertyAccessExpression */: - return emitPropertyAccess(node); - case 165 /* ElementAccessExpression */: - return emitIndexedAccess(node); - case 166 /* CallExpression */: - return emitCallExpression(node); - case 167 /* NewExpression */: - return emitNewExpression(node); - case 168 /* TaggedTemplateExpression */: - return emitTaggedTemplateExpression(node); - case 169 /* TypeAssertionExpression */: - return emit(node.expression); - case 187 /* AsExpression */: - return emit(node.expression); - case 170 /* ParenthesizedExpression */: - return emitParenExpression(node); - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - return emitFunctionDeclaration(node); - case 173 /* DeleteExpression */: - return emitDeleteExpression(node); - case 174 /* TypeOfExpression */: - return emitTypeOfExpression(node); - case 175 /* VoidExpression */: - return emitVoidExpression(node); - case 176 /* AwaitExpression */: - return emitAwaitExpression(node); - case 177 /* PrefixUnaryExpression */: - return emitPrefixUnaryExpression(node); - case 178 /* PostfixUnaryExpression */: - return emitPostfixUnaryExpression(node); - case 179 /* BinaryExpression */: - return emitBinaryExpression(node); - case 180 /* ConditionalExpression */: - return emitConditionalExpression(node); - case 183 /* SpreadElementExpression */: - return emitSpreadElementExpression(node); - case 182 /* YieldExpression */: - return emitYieldExpression(node); - case 185 /* OmittedExpression */: - return; - case 190 /* Block */: - case 217 /* ModuleBlock */: - return emitBlock(node); - case 191 /* VariableStatement */: - return emitVariableStatement(node); - case 192 /* EmptyStatement */: - return write(";"); - case 193 /* ExpressionStatement */: - return emitExpressionStatement(node); - case 194 /* IfStatement */: - return emitIfStatement(node); - case 195 /* DoStatement */: - return emitDoStatement(node); - case 196 /* WhileStatement */: - return emitWhileStatement(node); - case 197 /* ForStatement */: - return emitForStatement(node); - case 199 /* ForOfStatement */: - case 198 /* ForInStatement */: - return emitForInOrForOfStatement(node); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: - return emitBreakOrContinueStatement(node); - case 202 /* ReturnStatement */: - return emitReturnStatement(node); - case 203 /* WithStatement */: - return emitWithStatement(node); - case 204 /* SwitchStatement */: - return emitSwitchStatement(node); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - return emitCaseOrDefaultClause(node); - case 205 /* LabeledStatement */: - return emitLabelledStatement(node); - case 206 /* ThrowStatement */: - return emitThrowStatement(node); - case 207 /* TryStatement */: - return emitTryStatement(node); - case 242 /* CatchClause */: - return emitCatchClause(node); - case 208 /* DebuggerStatement */: - return emitDebuggerStatement(node); - case 209 /* VariableDeclaration */: - return emitVariableDeclaration(node); - case 184 /* ClassExpression */: - return emitClassExpression(node); - case 212 /* ClassDeclaration */: - return emitClassDeclaration(node); - case 213 /* InterfaceDeclaration */: - return emitInterfaceDeclaration(node); - case 215 /* EnumDeclaration */: - return emitEnumDeclaration(node); - case 245 /* EnumMember */: - return emitEnumMember(node); - case 216 /* ModuleDeclaration */: - return emitModuleDeclaration(node); - case 220 /* ImportDeclaration */: - return emitImportDeclaration(node); - case 219 /* ImportEqualsDeclaration */: - return emitImportEqualsDeclaration(node); - case 226 /* ExportDeclaration */: - return emitExportDeclaration(node); - case 225 /* ExportAssignment */: - return emitExportAssignment(node); - case 246 /* SourceFile */: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } - /** - * Determine if the given comment is a triple-slash - * - * @return true if the comment is a triple-slash comment else false - **/ - function isTripleSlashComment(comment) { - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text - // so that we don't end up computing comment string and doing match for all // comments - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; - } - function getLeadingCommentsToEmit(node) { - // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 246 /* SourceFile */ || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - // get comments without detached comments - return getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - } - } - } - function getTrailingCommentsToEmit(node) { - // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 246 /* SourceFile */ || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - } - } - } - /** - * Emit comments associated with node that will not be emitted into JS file - */ - function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); - } - function emitLeadingCommentsWorker(node, isEmittedNode) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (isEmittedNode) { - leadingComments = getLeadingCommentsToEmit(node); - } - else { - // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, - // unless it is a triple slash comment at the top of the file. - // For Example: - // /// - // declare var x; - // /// - // interface F {} - // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted - if (node.pos === 0) { - leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); - } - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); - } - function emitTrailingComments(node) { - if (compilerOptions.removeComments) { - return; - } - // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = getTrailingCommentsToEmit(node); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); - } - /** - * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: - * x, /comment1/ y - * ^ => pos; the function will emit "comment1" in the emitJS - */ - function emitTrailingCommentsOfPosition(pos) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitLeadingCommentsOfPositionWorker(pos) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (hasDetachedComments(pos)) { - // get comments without detached comments - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - // removeComments is true, only reserve pinned comment at the top of file - // For example: - // /*! Pinned Comment */ - // - // var x = 10; - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); - } - } - else { - // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - // Valid detachedComments - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - } - } - function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); - if (shebang) { - write(shebang); - } - } - } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); - } - } - } - ts.emitFiles = emitFiles; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -35261,6 +29422,6531 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }; + // Flags enum to track count of temp variables and a few dedicated names + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature + function emitFiles(resolver, host, targetSourceFile) { + // emit output for the __extends helper function + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + // emit output for the __decorate helper function + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + // emit output for the __metadata helper function + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + // emit output for the __param helper function + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; + var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + else { + // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) + if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + // Sort and make the unique list of diagnostics + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + // We conservatively include alias symbols to cover cases where they're emitted as locals + if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + return false; + } + } + } + return true; + } + function emitJavaScript(jsFilePath, root) { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + // name of an exporter function if file is a System external module + // System.register([...], function () {...}) + // exporting in System modules looks like: + // export var x; ... x = 1 + // => + // var x;... exporter("x", x = 1) + var exportFunctionForFile; + var generatedNameSet = {}; + var nodeToGeneratedName = []; + var computedPropertyNamesToGeneratedNames; + var extendsEmitted = false; + var decorateEmitted = false; + var paramEmitted = false; + var awaiterEmitted = false; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStars; + /** Write emitted output to disk */ + var writeEmittedFiles = writeJavaScriptFile; + var detachedCommentsInfo; + var writeComment = ts.writeCommentRange; + /** Emit a node */ + var emit = emitNodeWithCommentsAndWithoutSourcemap; + /** Called just before starting emit of a node */ + var emitStart = function (node) { }; + /** Called once the emit of the node is done */ + var emitEnd = function (node) { }; + /** Emit the text for the given token that comes after startPos + * This by default writes the text provided with the given tokenKind + * but if optional emitFn callback is provided the text is emitted using the callback instead of default text + * @param tokenKind the kind of the token to search and emit + * @param startPos the position in the source to start searching for the token + * @param emitFn if given will be invoked to emit the text instead of actual token emit */ + var emitToken = emitTokenText; + /** Called to before starting the lexical scopes as in function/class in the emitted code because of node + * @param scopeDeclaration node that starts the lexical scope + * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + /** Called after coming out of the scope */ + var scopeEmitEnd = function () { }; + /** Sourcemap data that will get encoded */ + var sourceMapData; + /** If removeComments is true, no leading-comments needed to be emitted **/ + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var moduleEmitDelegates = (_a = {}, + _a[5 /* ES6 */] = emitES6Module, + _a[2 /* AMD */] = emitAMDModule, + _a[4 /* System */] = emitSystemModule, + _a[3 /* UMD */] = emitUMDModule, + _a[1 /* CommonJS */] = emitCommonJSModule, + _a + ); + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); + return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + emit(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + // Return the next available name in the pattern _a ... _z, _0, _1, ... + // TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. + // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_19)) { + tempFlags |= flags; + return name_19; + } + } + while (true) { + var count = tempFlags & 268435455 /* CountMask */; + tempFlags++; + // Skip over 'i' and 'n' + if (count !== 8 && count !== 13) { + var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_20)) { + return name_20; + } + } + } + } + // Generate a name that is unique within the current file and doesn't conflict with any names + // in global scope. The name is formed by adding an '_n' suffix to the specified base name, + // where n is a positive integer. Note that names generated by makeTempVariableName and + // makeUniqueName are guaranteed to never conflict. + function makeUniqueName(baseName) { + // Find the first unique 'name_n', where n is a positive number + if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + // Use module/enum name itself if it is unique, otherwise make a unique variation + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 /* StringLiteral */ ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69 /* Identifier */: + return makeUniqueName(node.text); + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + return generateNameForModuleOrEnum(node); + case 222 /* ImportDeclaration */: + case 228 /* ExportDeclaration */: + return generateNameForImportOrExportDeclaration(node); + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + case 227 /* ExportAssignment */: + return generateNameForExportDefault(); + case 186 /* ClassExpression */: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function initializeEmitterWithSourceMaps() { + var sourceMapDir; // The directory in which sourcemap will be + // Current source map file and its index in the sources list + var sourceMapSourceIndex = -1; + // Names and its index map + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + } + // Last recorded and encoded spans + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + // Encoding for sourcemap span + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Line/Comma delimiters + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + // Emit comma to separate the entry + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + // Emit line delimiters + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + // 1. Relative Column 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + // 3. Relative sourceLine 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + // 4. Relative sourceColumn 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + // 5. Relative namePosition 0 based + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + // Add a new least significant bit that has the sign of the value. + // if negative number the least significant bit that gets added to the number has value 1 + // else least significant bit value that gets added is 0 + // eg. -1 changes to binary : 01 [1] => 3 + // +1 changes to binary : 01 [0] => 2 + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + // Encode 5 bits at a time starting from least significant bits + var encodedStr = ""; + do { + var currentDigit = inValue & 31; // 11111 + inValue = inValue >> 5; + if (inValue > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + // If this location wasn't recorded or the location in source is going backwards, record the span + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + // Encode the last recordedSpan before assigning new + encodeLastRecordedSourceMapSpan(); + // New span + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + // Take the new pos instead since there is no change in emittedLine and column since last location + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + // Get the token pos after skipping to the token (ignoring the leading trivia) + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + // Add the file to tsFilePaths + // If sourceroot option: Use the relative path corresponding to the common directory path + // otherwise source locations relative to map file location + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + // The one that can be used from program to get the actual source file + sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + // Child scopes are always shown with a dot (even if they have no name), + // unless it is a computed property. Then it is shown with brackets, + // but the brackets are included in the name. + var name_21 = node.name; + if (!name_21 || name_21.kind !== 136 /* ComputedPropertyName */) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + // The scope was already given a name use it + recordScopeNameStart(scopeName); + } + else if (node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */ || + node.kind === 142 /* MethodSignature */ || + node.kind === 145 /* GetAccessor */ || + node.kind === 146 /* SetAccessor */ || + node.kind === 218 /* ModuleDeclaration */ || + node.kind === 214 /* ClassDeclaration */ || + node.kind === 217 /* EnumDeclaration */) { + // Declaration and has associated name use it + if (node.name) { + var name_22 = node.name; + // For computed property names, the text will include the brackets + scopeName = name_22.kind === 136 /* ComputedPropertyName */ + ? ts.getTextOfNode(name_22) + : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + // Block just use the name from upper level scope + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { + if (typeof JSON !== "undefined") { + var map_1 = { + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); + sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + // Write source map file + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + // Write sourcemap url to the js file and write the js file + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + } + // Initialize source map data + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: undefined, + sourceMapDecodedMappings: [] + }; + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // relative paths of the sources list in the sourcemap + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + // For modules or multiple emit files the mapRoot will have directory structure like the sources + // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + // The relative paths are relative to the common directory + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithSourceMap(node) { + if (node) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind !== 248 /* SourceFile */) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMap(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNodeWithoutSourceMap(node); + } + } + } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithCommentsAndWithSourcemap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + // Create a temporary variable with a unique unused name. + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69 /* Identifier */); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + // This emitting is to make sure we emit following comment properly + // ...(x, /*comment1*/ y)... + // ^ => node.pos + // "comment1" is not considered leading comment for "y" but rather + // considered as trailing comment of the previous node. + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, /*startIndex*/ 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98 /* b */: + case 66 /* B */: + case 111 /* o */: + case 79 /* O */: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + // Any template literal or string literal with an extended escape + // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. + if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText("\"", node.text, "\""); + } + // If we don't need to downlevel and we can reach the original source text using + // the node's parent reference, then simply get the text as it was originally written. + if (node.parent) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + // If we can't reach the original source text, use the canonical form if it's a number, + // or an escaped quoted form of the original text if it's string-like. + switch (node.kind) { + case 9 /* StringLiteral */: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11 /* NoSubstitutionTemplateLiteral */: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12 /* TemplateHead */: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13 /* TemplateMiddle */: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14 /* TemplateTail */: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8 /* NumericLiteral */: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + // Find original source text, since we need to emit the raw strings of the tagged template. + // The raw strings contain the (escaped) strings of what the user wrote. + // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // thus we need to remove those characters. + // First template piece starts with "`", others with "}" + // Last template piece ends with "`", others with "${" + var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + // Newline normalization: + // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's + // and LineTerminatorSequences are normalized to for both TV and TRV. + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0 /* Auto */); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + // Now we emit the expressions + if (node.template.kind === 183 /* TemplateExpression */) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 181 /* BinaryExpression */ + && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + // In ES6 mode and above, we can simply emit each portion of a template in order, but in + // ES3 & ES5 we must convert the template expression into a series of string concatenations. + if (languageVersion >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + // Check if the expression has operands and binds its operands less closely than binary '+'. + // If it does, we need to wrap the expression in parentheses. Otherwise, something like + // `abc${ 1 << 2 }` + // becomes + // "abc" + 1 << 2 + "" + // which is really + // ("abc" + 1) << (2 + "") + // rather than + // "abc" + (1 << 2) + "" + var needsParens = templateSpan.expression.kind !== 172 /* ParenthesizedExpression */ + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + if (i > 0 || headEmitted) { + // If this is the first span and the head was not emitted, then this templateSpan's + // expression will be the first to be emitted. Don't emit the preceding ' + ' in that + // case. + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + // Only emit if the literal is non-empty. + // The binary '+' operator is left-associative, so the first string concatenation + // with the head will force the result up to this point to be a string. + // Emitting a '+ ""' has no semantic effect for middles and tails. + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + // If this expression has an empty head literal and the first template span has a non-empty + // literal, then emitting the empty head literal is not necessary. + // `${ foo } and ${ bar }` + // can be emitted as + // foo + " and " + bar + // This is because it is only required that one of the first two operands in the emit + // output must be a string literal, so that the other operand and all following operands + // are forced into strings. + // + // If the first template span has an empty literal, then the head must still be emitted. + // `${ foo }${ bar }` + // must still be emitted as + // "" + foo + bar + // There is always atleast one templateSpan in this code path, since + // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 168 /* CallExpression */: + case 169 /* NewExpression */: + return parent.expression === template; + case 170 /* TaggedTemplateExpression */: + case 172 /* ParenthesizedExpression */: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; + } + } + /** + * Returns whether the expression has lesser, greater, + * or equal precedence to the binary '+' operator + */ + function comparePrecedenceToBinaryPlus(expression) { + // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' + // which have greater precedence and '-' which has equal precedence. + // All unary operators have a higher precedence apart from yield. + // Arrow functions and conditionals have a lower precedence, + // although we convert the former into regular function expressions in ES5 mode, + // and in ES6 mode this function won't get called anyway. + // + // TODO (drosen): Note that we need to account for the upcoming 'yield' and + // spread ('...') unary operators that are anticipated for ES6. + switch (expression.kind) { + case 181 /* BinaryExpression */: + switch (expression.operatorToken.kind) { + case 37 /* AsteriskToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: + return 1 /* GreaterThan */; + case 35 /* PlusToken */: + case 36 /* MinusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 184 /* YieldExpression */: + case 182 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + /// Emit a tag name, which is either '"div"' for lower-cased names, or + /// 'Div' for upper-cased or dotted names + function emitTagName(name) { + if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + /// Emit an attribute name, which is quoted if it needs to be quoted. Because + /// these emit into an object literal property name, we don't need to be worried + /// about keywords, just non-identifier characters + function emitAttributeName(name) { + if (/[A-Za-z_]+[\w*]/.test(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + /// Emit an name/value pair for an attribute (e.g. "x: 3") + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69 /* Identifier */); + syntheticReactRef.text = "React"; + syntheticReactRef.parent = openingNode; + // Call React.createElement(tag, ... + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + // Attribute list + if (openingNode.attributes.length === 0) { + // When there are no attributes, React wants "null" + write("null"); + } + else { + // Either emit one big object literal (no spread attribs), or + // a call to React.__spread + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 239 /* JsxSpreadAttribute */; })) { + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); + var haveOpenedObjectLiteral = false; + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 239 /* JsxSpreadAttribute */) { + // If this is the first argument, we need to emit a {} as the first argument + if (i_1 === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i_1 > 0) { + write(", "); + } + emit(attrs[i_1].expression); + } + else { + ts.Debug.assert(attrs[i_1].kind === 238 /* JsxAttribute */); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i_1 > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i_1]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); // closing paren to React.__spread( + } + else { + // One object literal with all the attributes in them + write("{"); + for (var i = 0; i < attrs.length; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + // Children + if (children) { + for (var i = 0; i < children.length; i++) { + // Don't emit empty expressions + if (children[i].kind === 240 /* JsxExpression */ && !(children[i].expression)) { + continue; + } + // Don't emit empty strings + if (children[i].kind === 236 /* JsxText */) { + var text = getTextToEmit(children[i]); + if (text !== undefined) { + write(", \""); + write(text); + write("\""); + } + } + else { + write(", "); + emit(children[i]); + } + } + } + // Closing paren + write(")"); // closes "React.createElement(" + emitTrailingComments(openingNode); + } + if (node.kind === 233 /* JsxElement */) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 239 /* JsxSpreadAttribute */) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 238 /* JsxAttribute */); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 234 /* JsxSelfClosingElement */)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 234 /* JsxSelfClosingElement */) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 233 /* JsxElement */) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + emitJsxOpeningOrSelfClosingElement(node); + } + } + // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. + // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. + // For example, this is utilized when feeding in a result to Object.defineProperty. + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 163 /* BindingElement */); + if (node.kind === 9 /* StringLiteral */) { + emitLiteral(node); + } + else if (node.kind === 136 /* ComputedPropertyName */) { + // if this is a decorated computed property, we will need to capture the result + // of the property expression so that we can apply decorators later. This is to ensure + // we don't introduce unintended side effects: + // + // class C { + // [_a = x]() { } + // } + // + // The emit for the decorated computed property decorator is: + // + // __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)); + // + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + // we have already generated a variable for this node, write that value instead. + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0 /* Auto */).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write("\""); + if (node.kind === 8 /* NumericLiteral */) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 164 /* ArrayLiteralExpression */: + case 189 /* AsExpression */: + case 181 /* BinaryExpression */: + case 168 /* CallExpression */: + case 241 /* CaseClause */: + case 136 /* ComputedPropertyName */: + case 182 /* ConditionalExpression */: + case 139 /* Decorator */: + case 175 /* DeleteExpression */: + case 197 /* DoStatement */: + case 167 /* ElementAccessExpression */: + case 227 /* ExportAssignment */: + case 195 /* ExpressionStatement */: + case 188 /* ExpressionWithTypeArguments */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 196 /* IfStatement */: + case 234 /* JsxSelfClosingElement */: + case 235 /* JsxOpeningElement */: + case 239 /* JsxSpreadAttribute */: + case 240 /* JsxExpression */: + case 169 /* NewExpression */: + case 172 /* ParenthesizedExpression */: + case 180 /* PostfixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: + case 204 /* ReturnStatement */: + case 246 /* ShorthandPropertyAssignment */: + case 185 /* SpreadElementExpression */: + case 206 /* SwitchStatement */: + case 170 /* TaggedTemplateExpression */: + case 190 /* TemplateSpan */: + case 208 /* ThrowStatement */: + case 171 /* TypeAssertionExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 184 /* YieldExpression */: + return true; + case 163 /* BindingElement */: + case 247 /* EnumMember */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 211 /* VariableDeclaration */: + return parent.initializer === node; + case 166 /* PropertyAccessExpression */: + return parent.expression === node; + case 174 /* ArrowFunction */: + case 173 /* FunctionExpression */: + return parent.body === node; + case 221 /* ImportEqualsDeclaration */: + return parent.moduleReference === node; + case 135 /* QualifiedName */: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { + write("_arguments"); + return; + } + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 248 /* SourceFile */) { + // Identifier references module export + if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + write("exports."); + } + } + else { + // Identifier references namespace export + write(getGeneratedNameForNode(container)); + write("."); + } + } + else if (modulekind !== 5 /* ES6 */) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 223 /* ImportClause */) { + // Identifier references default import + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + return; + } + else if (declaration.kind === 226 /* ImportSpecifier */) { + // Identifier references named import + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_23 = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + if (languageVersion === 0 /* ES3 */ && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } + return; + } + } + declaration = resolver.getReferencedNestedRedeclaration(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function isNameOfNestedRedeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + var parent_6 = node.parent; + switch (parent_6.kind) { + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 211 /* VariableDeclaration */: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + } + } + return false; + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedRedeclaration(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2 /* ES6 */) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256 /* SuperInstance */) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114 /* YieldKeyword */)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114 /* YieldKeyword */)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 181 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 182 /* ConditionalExpression */ && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 164 /* ArrayLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 172 /* ParenthesizedExpression */: + // This list is not exhaustive and only includes those cases that are relevant + // to the check in emitArrayLiteral. More cases can be added as needed. + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + // Emit using the pattern .concat(, , ...) + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 185 /* SpreadElementExpression */) { + e = e.expression; + emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164 /* ArrayLiteralExpression */) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 185 /* SpreadElementExpression */) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 185 /* SpreadElementExpression */; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); + write("]"); + } + else { + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + // If we are not doing a downlevel transformation for object literals, + // then try to preserve the original shape of the object literal. + // Otherwise just try to preserve the formatting. + if (numElements === properties.length) { + emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); + } + else { + var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createAndRecordTempVariable(0 /* Auto */); + // Write out the first non-computed properties + // (or all properties if none of them are computed), + // then emit the rest through indexing on the temp variable. + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 145 /* GetAccessor */ || property.kind === 146 /* SetAccessor */) { + // TODO (drosen): Reconcile with 'emitMemberFunctions'. + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 245 /* PropertyAssignment */) { + emit(property.initializer); + } + else if (property.kind === 246 /* ShorthandPropertyAssignment */) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 143 /* MethodDeclaration */) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2 /* ES6 */) { + var numProperties = properties.length; + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 136 /* ComputedPropertyName */) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + // Ordinary case: either the object has no computed properties + // or we're compiling with an ES6+ target. + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(181 /* BinaryExpression */, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(166 /* PropertyAccessExpression */); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(167 /* ElementAccessExpression */); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + // When diagnosing whether the expression needs parentheses, the decision should be based + // on the innermost expression in a chain of nested type assertions. + while (expr.kind === 171 /* TypeAssertionExpression */ || expr.kind === 189 /* AsExpression */) { + expr = expr.expression; + } + // isLeftHandSideExpression is almost the correct criterion for when it is not necessary + // to parenthesize the expression before a dot. The known exceptions are: + // + // NewExpression: + // new C.x -> not the same as (new C).x + // NumberLiteral + // 1.x -> not the same as (1).x + // + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 169 /* NewExpression */ && + expr.kind !== 8 /* NumericLiteral */) { + return expr; + } + var node = ts.createSynthesizedNode(172 /* ParenthesizedExpression */); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2 /* ES6 */) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "comment1" is not considered to be leading comment for node.initializer + // but rather a trailing comment on the previous node. + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + // Return true if identifier resolves to an exported member of a namespace + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 248 /* SourceFile */; + } + function emitShorthandPropertyAssignment(node) { + // The name property of a short-hand property assignment is considered an expression position, so here + // we manually emit the identifier to avoid rewriting. + writeTextOfNode(currentSourceFile, node.name); + // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, + // we emit a normal property assignment. For example: + // module m { + // export let y; + // } + // module m { + // let obj = { y }; + // } + // Here we need to emit obj = { y : m.y } regardless of the output target. + if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { + // Emit identifier as an identifier + write(": "); + emit(node.name); + } + if (languageVersion >= 2 /* ES6 */ && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 166 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 166 /* PropertyAccessExpression */ || node.kind === 167 /* ElementAccessExpression */ + ? resolver.getConstantValue(node) + : undefined; + } + // Returns 'true' if the code was actually indented, false otherwise. + // If the code is not indented, an optional valueToWriteWhenNotIndenting will be + // emitted instead. + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + // Always use a newline for synthesized code if the synthesizer desires it. + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + // 1 .toString is a valid property access, emit a space after the literal + // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal + var shouldEmitSpace; + if (!indentedBeforeDot) { + if (node.expression.kind === 8 /* NumericLiteral */) { + // check if numeric literal was originally written with a dot + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; + } + else { + // check if constant enum value is integer + var constantValue = tryGetConstEnumValue(node.expression); + // isFinite handles cases when constantValue is undefined + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69 /* Identifier */) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0 /* Auto */); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, /*useFallback*/ true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, /*useFallback*/ false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69 /* Identifier */: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 135 /* QualifiedName */: + emitQualifiedNameAsExpression(node, useFallback); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 185 /* SpreadElementExpression */; }); + } + function skipParentheses(node) { + while (node.kind === 172 /* ParenthesizedExpression */ || node.kind === 171 /* TypeAssertionExpression */ || node.kind === 189 /* AsExpression */) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || node.kind === 95 /* SuperKeyword */) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0 /* Auto */); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 166 /* PropertyAccessExpression */) { + // Target will be emitted as "this" argument + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 167 /* ElementAccessExpression */) { + // Target will be emitted as "this" argument + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95 /* SuperKeyword */) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95 /* SuperKeyword */) { + // Calls of form super(...) and super.foo(...) + emitThis(target); + } + else { + // Calls of form obj.foo(...) + emit(target); + } + } + else { + // Calls of form foo(...) + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 95 /* SuperKeyword */) { + emitSuper(node.expression); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 166 /* PropertyAccessExpression */ && node.expression.expression.kind === 95 /* SuperKeyword */; + } + if (superCall && languageVersion < 2 /* ES6 */) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + // Spread operator logic is supported in new expressions in ES5 using a combination + // of Function.prototype.bind() and Function.prototype.apply(). + // + // Example: + // + // var args = [1, 2, 3, 4, 5]; + // new Array(...args); + // + // is compiled into the following ES5: + // + // var args = [1, 2, 3, 4, 5]; + // new (Array.bind.apply(Array, [void 0].concat(args))); + // + // The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new', + // Thus, we set it to undefined ('void 0'). + if (languageVersion === 1 /* ES5 */ && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2 /* ES6 */) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + // If the node is synthesized, it means the emitter put the parentheses there, + // not the user. If we didn't want them, the emitter would not have put them + // there. + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174 /* ArrowFunction */) { + if (node.expression.kind === 171 /* TypeAssertionExpression */ || node.expression.kind === 189 /* AsExpression */) { + var operand = node.expression.expression; + // Make sure we consider all nested cast expressions, e.g.: + // (-A).x; + while (operand.kind === 171 /* TypeAssertionExpression */ || operand.kind === 189 /* AsExpression */) { + operand = operand.expression; + } + // We have an expression of the form: (SubExpr) + // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. + // Omitting the parentheses, however, could cause change in the semantics of the generated + // code if the casted expression has a lower precedence than the rest of the expression, e.g.: + // (new A).foo should be emitted as (new A).foo and not new A.foo + // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() + // new (A()) should be emitted as new (A()) and not new A() + // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () + if (operand.kind !== 179 /* PrefixUnaryExpression */ && + operand.kind !== 177 /* VoidExpression */ && + operand.kind !== 176 /* TypeOfExpression */ && + operand.kind !== 175 /* DeleteExpression */ && + operand.kind !== 180 /* PostfixUnaryExpression */ && + operand.kind !== 169 /* NewExpression */ && + !(operand.kind === 168 /* CallExpression */ && node.parent.kind === 169 /* NewExpression */) && + !(operand.kind === 173 /* FunctionExpression */ && node.parent.kind === 168 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 166 /* PropertyAccessExpression */)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78 /* DeleteKeyword */)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103 /* VoidKeyword */)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101 /* TypeOfKeyword */)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 /* VariableDeclaration */ || node.parent.kind === 163 /* BindingElement */); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // emit + // ++x + // as + // exports('x', ++x) + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + // In some cases, we need to emit a space between the operator and the operand. One obvious case + // is when the operator is an identifier, like delete or typeof. We also need to do this for plus + // and minus expressions in certain cases. Specifically, consider the following two cases (parens + // are just for clarity of exposition, and not part of the source code): + // + // (+(+1)) + // (+(++1)) + // + // We need to emit a space in both cases. In the first case, the absence of a space will make + // the resulting expression a prefix increment operation. And in the second, it will make the resulting + // expression a prefix increment whose operand is a plus expression - (++(+x)) + // The same is true of minus of course. + if (node.operand.kind === 179 /* PrefixUnaryExpression */) { + var operand = node.operand; + if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { + write(" "); + } + else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 42 /* MinusMinusToken */)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // export function returns the value that was passes as the second argument + // however for postfix unary expressions result value should be the value before modification. + // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41 /* PlusPlusToken */) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); + } + /* + * Checks if given node is a source file level declaration (not nested in module/function). + * If 'isExported' is true - then declaration must also be exported. + * This function is used in two cases: + * - check if node is a exported source file level value to determine + * if we should also export the value after its it changed + * - check if node is a source level declaration to emit it differently, + * i.e non-exported variable statement 'var x = 1' is hoisted so + * we we emit variable statement 'var' should be dropped. + */ + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 248 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { + return false; + } + else { + current = current.parent; + } + } + } + /** + * Emit ES7 exponentiation operator downlevel using Math.pow + * @param node a binary expression node containing exponentiationOperator (**, **=) + */ + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { + var synthesizedLHS; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(167 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && + leftHandSideExpression.argumentExpression.kind !== 9 /* StringLiteral */) { + var tempArgumentExpression = createAndRecordTempVariable(268435456 /* _i */); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(166 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && + (node.left.kind === 165 /* ObjectLiteralExpression */ || node.left.kind === 164 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 195 /* ExpressionStatement */); + } + else { + var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && + node.operatorToken.kind <= 68 /* LastAssignment */ && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + // emit assignment 'x y' as 'exports("x", x y)' + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 /* AsteriskAsteriskToken */ || node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { + // Downleveled emit exponentiation operator using Math.pow + emitExponentiationOperator(node); + } + else { + emit(node.left); + // Add indentation before emit the operator if the operator is on different line + // For example: + // 3 + // + 2; + // emitted as + // 3 + // + 2; + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + // Helper function to decrease the indent if we previously indented. Allows multiple + // previous indent values to be considered at a time. This also allows caller to just + // call this once, passing in all their appropriate indent values, instead of needing + // to call this helper function multiple times. + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 192 /* Block */) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15 /* OpenBraceToken */, node.pos); + write(" "); + emitToken(16 /* CloseBraceToken */, node.statements.end); + return; + } + emitToken(15 /* OpenBraceToken */, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 219 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 218 /* ModuleDeclaration */); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 219 /* ModuleBlock */) { + emitTempDeclarations(/*newLine*/ true); + } + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 192 /* Block */) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 174 /* ArrowFunction */); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88 /* IfKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + emit(node.expression); + emitToken(18 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 196 /* IfStatement */) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 192 /* Block */) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + /** + * Returns true if start of variable declaration list was emitted. + * Returns false if nothing was written - this can happen for source file level variable declarations + * in system modules where such variable declarations are hoisted. + */ + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { + // variables in variable declaration list were already hoisted + return false; + } + var tokenKind = 102 /* VarKeyword */; + if (decl && languageVersion >= 2 /* ES6 */) { + if (ts.isLet(decl)) { + tokenKind = 108 /* LetKeyword */; + } + else if (ts.isConst(decl)) { + tokenKind = 74 /* ConstKeyword */; + } + } + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + write(" "); + } + else { + switch (tokenKind) { + case 102 /* VarKeyword */: + write("var "); + break; + case 108 /* LetKeyword */: + write("let "); + break; + case 74 /* ConstKeyword */: + write("const "); + break; + } + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function emitForStatement(node) { + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* ForOfStatement */) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer.kind === 212 /* VariableDeclarationList */) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 200 /* ForInStatement */) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitDownLevelForOfStatement(node) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (let _i = 0, _a = expr; _i < _a.length; _i++) { + // let v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + // Do not emit the LHS let declaration yet, because it might contain destructuring. + // Do not call recordTempDeclaration because we are declaring the temps + // right here. Recording means they will be declared later. + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var rhsIsIdentifier = node.expression.kind === 69 /* Identifier */; + var counter = createTempVariable(268435456 /* _i */); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); + // This is the let keyword for the counter and rhsReference. The let keyword for + // the LHS will be emitted inside the body. + emitStart(node.expression); + write("var "); + // _i = 0 + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + // , _a = expr + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + // _i < _a.length; + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + // _i++) + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(18 /* CloseParenToken */, node.expression.end); + // Body + write(" {"); + writeLine(); + increaseIndent(); + // Initialize LHS + // let v = _a[_i]; + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 212 /* VariableDeclarationList */) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + // This works whether the declaration is a var, let, or const. + // It will use rhsIterationValue _a[_i] as the initializer. + emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); + } + else { + // The following call does not include the initializer, so we have + // to emit it separately. + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + // It's an empty declaration list. This can only happen in an error case, if the user wrote + // for (let of []) {} + emitNodeWithoutSourceMap(createTempVariable(0 /* Auto */)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + // Initializer is an expression. Emit the expression in the body, so that it's + // evaluated on every iteration. + var assignmentExpression = createBinaryExpression(node.initializer, 56 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); + if (node.initializer.kind === 164 /* ArrayLiteralExpression */ || node.initializer.kind === 165 /* ObjectLiteralExpression */) { + // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause + // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. + emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 192 /* Block */) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(94 /* ReturnKeyword */, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96 /* SwitchKeyword */, node.pos); + write(" "); + emitToken(17 /* OpenParenToken */, endPos); + emit(node.expression); + endPos = emitToken(18 /* CloseParenToken */, node.expression.end); + write(" "); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(15 /* OpenBraceToken */, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 241 /* CaseClause */) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72 /* CatchKeyword */, node.pos); + write(" "); + emitToken(17 /* OpenParenToken */, endPos); + emit(node.variableDeclaration); + emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76 /* DebuggerKeyword */, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 218 /* ModuleDeclaration */); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); + zero.text = "0"; + var result = ts.createSynthesizedNode(177 /* VoidExpression */); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 248 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 227 /* ExportAssignment */); + // only allow export default at a source file level + if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1 /* ES5 */) { + // default value of configurable, enumerable, writable are `false`. + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0 /* ES3 */) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + // emit call to exporter only for top level nodes + if (modulekind === 4 /* System */ && node.parent === currentSourceFile) { + // emit export default as + // export("default", ) + write(exportFunctionForFile + "(\""); + if (node.flags & 1024 /* Default */) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 1024 /* Default */) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0 /* ES3 */) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === 4 /* System */) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === 4 /* System */); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + /** + * Emit an assignment to a given identifier, 'name', with a given expression, 'value'. + * @param name an identifier as a left-hand-side operand of the assignment + * @param value an expression as a right-hand-side operand of the assignment + * @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma + */ + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 /* VariableDeclaration */ || name.parent.kind === 163 /* BindingElement */); + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + if (exportChanged) { + write(")"); + } + } + /** + * Create temporary variable, emit an assignment of the variable the given expression + * @param expression an expression to assign to the newly created temporary variable + * @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location + * @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma + */ + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + var identifier = createTempVariable(0 /* Auto */); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + return identifier; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + // An exported declaration is actually emitted as an assignment (to a property on the module object), so + // temporary variables in an exported declaration need to have real declarations elsewhere + // Also temporary variables should be explicitly allocated for source level declarations when module target is system + // because actual variable declarations are hoisted + var canDefineTempVariablesInPlace = false; + if (root.kind === 211 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 138 /* Parameter */) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 181 /* BinaryExpression */) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + emitBindingElement(root, value); + } + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * This function is useful to ensure that the expression's value can be read from in subsequent expressions. + * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. + * + * @param expr the expression whose value needs to be bound. + * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; + * false if it is necessary to always emit an identifier. + */ + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue) { + // The value expression will be evaluated twice, so for anything but a simple identifier + // we need to generate a temporary variable + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // Return the expression 'value === void 0 ? defaultValue : value' + var equals = ts.createSynthesizedNode(181 /* BinaryExpression */); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(182 /* ConditionalExpression */); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54 /* ColonToken */); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8 /* NumericLiteral */); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + // We create a synthetic copy of the identifier in order to avoid the rewriting that might + // otherwise occur when the identifier is emitted. + var syntheticName = ts.createSynthesizedNode(propName.kind); + syntheticName.text = propName.text; + if (syntheticName.kind !== 69 /* Identifier */) { + return createElementAccessExpression(object, syntheticName); + } + return createPropertyAccessExpression(object, syntheticName); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(168 /* CallExpression */); + var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + // For anything but a single element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + } + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { + var propName = p.name; + var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + // For anything but a single element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 187 /* OmittedExpression */) { + if (e.kind !== 185 /* SpreadElementExpression */) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 246 /* ShorthandPropertyAssignment */) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + } + target = target.name; + } + else if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 165 /* ObjectLiteralExpression */) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 164 /* ArrayLiteralExpression */) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + write("("); + } + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + // Combine value and initializer + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + // Use 'void 0' in absence of value and initializer + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 161 /* ObjectBindingPattern */) { + // Rewrite element to a declaration with an initializer that fetches property + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 187 /* OmittedExpression */) { + if (!element.dotDotDotToken) { + // Rewrite element to a declaration that accesses array element at index i + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2 /* ES6 */) { + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + var initializer = node.initializer; + if (!initializer && languageVersion < 2 /* ES6 */) { + // downlevel emit for non-initialized let bindings defined in loops + // for (...) { let x; } + // should be + // for (...) { var = void 0; } + // this is necessary to preserve ES6 semantic in scenarios like + // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && + (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); + // NOTE: default initialization should not be added to let bindings in for-in\for-of statements + if (isUninitializedLet && + node.parent.parent.kind !== 200 /* ForInStatement */ && + node.parent.parent.kind !== 201 /* ForOfStatement */) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 187 /* OmittedExpression */) { + return; + } + var name = node.name; + if (name.kind === 69 /* Identifier */) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function getCombinedFlagsForIdentifier(node) { + if (!node.parent || (node.parent.kind !== 211 /* VariableDeclaration */ && node.parent.kind !== 163 /* BindingElement */)) { + return 0; + } + return ts.getCombinedNodeFlags(node.parent); + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1 /* Export */) && + modulekind === 5 /* ES6 */ && + node.parent.kind === 248 /* SourceFile */; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + // If we're not exporting the variables, there's nothing special here. + // Always emit comments for these nodes. + if (!(node.flags & 1 /* Export */)) { + return true; + } + // If we are exporting, but it's a top-level ES6 module exports, + // we'll emit the declaration list verbatim, so emit comments too. + if (isES6ExportedDeclaration(node)) { + return true; + } + // Otherwise, only emit if we have at least one initializer present. + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2 /* ES6 */) { + if (ts.isBindingPattern(node.name)) { + var name_24 = createTempVariable(0 /* Auto */); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_24); + emit(name_24); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2 /* ES6 */) { + var tempIndex = 0; + ts.forEach(node.parameters, function (parameter) { + // A rest parameter cannot have a binding pattern or an initializer, + // so let's just ignore it. + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + // In cases where a binding pattern is simply '[]' or '{}', + // we usually don't want to emit a var declaration; however, in the presence + // of an initializer, we must emit that expression to preserve side effects. + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); + } + else { + emit(tempParameters[tempIndex]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456 /* _i */).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 145 /* GetAccessor */ ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 174 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 173 /* FunctionExpression */) { + // Emit name if one is present + return !!node.name; + } + if (node.kind === 213 /* FunctionDeclaration */) { + // Emit name if one is present, or emit generated name in down-level case (for export default case) + return !!node.name || languageVersion < 2 /* ES6 */; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + // TODO (yuisu) : we should not have special cases to condition emitting comments + // but have one place to fix check for these conditions. + if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */ && + node.parent && node.parent.kind !== 245 /* PropertyAssignment */ && + node.parent.kind !== 168 /* CallExpression */) { + // 1. Methods will emit the comments as part of emitting method declaration + // 2. If the function is a property of object literal, emitting leading-comments + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // For example: + // var obj = { + // id: + // /*comment*/ () => void + // } + // 3. If the function is an argument in call expression, emitting of comments will be + // taken care of in emit list of arguments inside of emitCallexpression + emitLeadingComments(node); + } + emitStart(node); + // For targeting below es6, emit functions-like declaration including arrow function using function keyword. + // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024 /* Default */) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== 5 /* ES6 */ && node.kind === 213 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + // Check whether the parameter list needs parentheses and preserve no-parenthesis + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 174 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; + var args; + // An async function is emit as an outer function that calls an inner + // generator function. To preserve lexical bindings, we pass the current + // `this` and `arguments` objects to `__awaiter`. The generator function + // passed to `__awaiter` is executed inside of the callback to the + // promise constructor. + // + // The emit for an async arrow without a lexical `arguments` binding might be: + // + // // input + // let a = async (b) => { await b; } + // + // // output + // let a = (b) => __awaiter(this, void 0, void 0, function* () { + // yield b; + // }); + // + // The emit for an async arrow with a lexical `arguments` binding might be: + // + // // input + // let a = async (b) => { await arguments[0]; } + // + // // output + // let a = (b) => __awaiter(this, arguments, void 0, function* (arguments) { + // yield arguments[0]; + // }); + // + // The emit for an async function expression without a lexical `arguments` binding + // might be: + // + // // input + // let a = async function (b) { + // await b; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, void 0, void 0, function* () { + // yield b; + // }); + // } + // + // The emit for an async function expression with a lexical `arguments` binding + // might be: + // + // // input + // let a = async function (b) { + // await arguments[0]; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, arguments, void 0, function* (_arguments) { + // yield _arguments[0]; + // }); + // } + // + // The emit for an async function expression with a lexical `arguments` binding + // and a return type annotation might be: + // + // // input + // let a = async function (b): MyPromise { + // await arguments[0]; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, arguments, MyPromise, function* (_arguments) { + // yield _arguments[0]; + // }); + // } + // + // If this is not an async arrow, emit the opening brace of the function body + // and the start of the return statement. + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments"); + } + else { + write(", void 0"); + } + if (promiseConstructor) { + write(", "); + emitNodeWithoutSourceMap(promiseConstructor); + } + else { + write(", Promise"); + } + // Emit the call to __awaiter. + if (hasLexicalArguments) { + write(", function* (_arguments)"); + } + else { + write(", function* ()"); + } + // Emit the signature and body for the inner generator function. + emitFunctionBody(node); + write(")"); + // If this is not an async arrow, emit the closing brace of the outer function body. + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + // There can be no body when there are parse errors. Just emit an empty block + // in that case. + write(" { }"); + } + else { + if (node.body.kind === 192 /* Block */) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + // When targeting ES6, emit arrow function natively in ES6 + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync && languageVersion === 2 /* ES6 */) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + // For es6 and higher we can emit the expression as is. However, in the case + // where the expression might end up looking like a block when emitted, we'll + // also wrap it in parentheses first. For example if you have: a => {} + // then we need to generate: a => ({}) + write(" "); + // Unwrap all type assertions. + var current = body; + while (current.kind === 171 /* TypeAssertionExpression */) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 165 /* ObjectLiteralExpression */); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + // If we didn't have to emit any preamble code, then attempt to keep the arrow + // function on one line. + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16 /* CloseBraceToken */, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 195 /* ExpressionStatement */) { + var expr = statement.expression; + if (expr && expr.kind === 168 /* CallExpression */) { + var func = expr.expression; + if (func && func.kind === 95 /* SuperKeyword */) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x + if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 136 /* ComputedPropertyName */) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0; _a < properties.length; _a++) { + var property = properties[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 128 /* Static */) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 191 /* SemicolonClassElement */) { + writeLine(); + write(";"); + } + else if (member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 143 /* MethodDeclaration */ || + member.kind === 145 /* GetAccessor */ || + member.kind === 146 /* SetAccessor */) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 128 /* Static */) { + write("static "); + } + if (member.kind === 145 /* GetAccessor */) { + write("get "); + } + else if (member.kind === 146 /* SetAccessor */) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 191 /* SemicolonClassElement */) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + // Check if we have property assignment inside class declaration. + // If there is property assignment, we need to emit constructor whether users define it or not + // If there is no property assignment, we can omit constructor if users do not define it + var hasInstancePropertyWithInitializer = false; + // Emit the constructor overload pinned comments + ts.forEach(node.members, function (member) { + if (member.kind === 144 /* Constructor */ && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + // Check if there is any non-static property assignment + if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + // For target ES6 and above, if there is no user-defined constructor and there is no property assignment + // do not emit constructor in class declaration. + if (languageVersion >= 2 /* ES6 */ && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2 /* ES6 */) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + // Based on EcmaScript6 section 14.5.14: Runtime Semantics: ClassDefinitionEvaluation. + // If constructor is empty, then, + // If ClassHeritageopt is present, then + // Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition. + // Else, + // Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2 /* ES6 */) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(/*newLine*/ true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var thisNodeIsDecorated = ts.nodeIsDecorated(node); + if (node.kind === 214 /* ClassDeclaration */) { + if (thisNodeIsDecorated) { + // To preserve the correct runtime semantics when decorators are applied to the class, + // the emit needs to follow one of the following rules: + // + // * For a local class declaration: + // + // @dec class C { + // } + // + // The emit should be: + // + // let C = class { + // }; + // C = __decorate([dec], C); + // + // * For an exported class declaration: + // + // @dec export class C { + // } + // + // The emit should be: + // + // export let C = class { + // }; + // C = __decorate([dec], C); + // + // * For a default export of a class declaration with a name: + // + // @dec default export class C { + // } + // + // The emit should be: + // + // let C = class { + // } + // C = __decorate([dec], C); + // export default C; + // + // * For a default export of a class declaration without a name: + // + // @dec default export class { + // } + // + // The emit should be: + // + // let _default = class { + // } + // _default = __decorate([dec], _default); + // export default _default; + // + if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024 /* Default */) { + write("default "); + } + } + } + // If the class has static properties, and it's a class expression, then we'll need + // to specialize the emit a bit. for a class expression of the form: + // + // class C { static a = 1; static b = 2; ... } + // + // We'll emit: + // + // (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp) + // + // This keeps the expression as an expression, while ensuring that the static parts + // of it have been initialized by the time it is used. + var staticProperties = getInitializedProperties(node, /*static:*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186 /* ClassExpression */; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0 /* Auto */); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + // emit name if + // - node has a name + // - this is default export with static initializers + if ((node.name || (node.flags & 1024 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + scopeEmitStart(node); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. + // For a decorated class, we need to assign its name (if it has one). This is because we emit + // the class as a class expression to avoid the double-binding of the identifier: + // + // let C = class { + // } + // Object.defineProperty(C, "name", { value: "C", configurable: true }); + // + if (thisNodeIsDecorated) { + write(";"); + } + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + if (isClassExpressionWithStaticProperties) { + for (var _a = 0; _a < staticProperties.length; _a++) { + var property = staticProperties[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node); + } + // If this is an exported class, but not on the top level (i.e. on an internal + // module), export it + if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { + // if this is a top level default export of decorated class, write the export after the declaration. + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 214 /* ClassDeclaration */) { + // source file level classes in system modules are hoisted so 'var's for them are already defined + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); + writeLine(); + emitDecoratorsOfClass(node); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(/*newLine*/ true); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 214 /* ClassDeclaration */) { + write(";"); + } + emitEnd(node); + if (node.kind === 214 /* ClassDeclaration */) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node) { + emitDecoratorsOfMembers(node, /*staticFlag*/ 0); + emitDecoratorsOfMembers(node, 128 /* Static */); + emitDecoratorsOfConstructor(node); + } + function emitDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + // skip decoration of the constructor if neither it nor its parameters are decorated + if (!decorators && !hasDecoratedParameters) { + return; + } + // Emit the call to __decorate. Given the class: + // + // @dec + // class C { + // } + // + // The emit for the class is: + // + // C = __decorate([dec], C); + // + writeLine(); + emitStart(node); + emitDeclarationName(node); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(");"); + emitEnd(node); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + // only emit members in the correct group + if ((member.flags & 128 /* Static */) !== staticFlag) { + continue; + } + // skip members that cannot be decorated (such as the constructor) + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + // skip a member if it or any of its parameters are not decorated + if (!ts.nodeOrChildIsDecorated(member)) { + continue; + } + // skip an accessor declaration if it is not the first accessor + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + // get the decorators from the first accessor with decorators + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + // we only decorate parameters of the set accessor + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + // we only decorate the parameters here if this is a method + if (member.kind === 143 /* MethodDeclaration */) { + functionLikeMember = member; + } + } + // Emit the call to __decorate. Given the following: + // + // class C { + // @dec method(@dec2 x) {} + // @dec get accessor() {} + // @dec prop; + // } + // + // The emit for a method is: + // + // __decorate([ + // dec, + // __param(0, dec2), + // __metadata("design:type", Function), + // __metadata("design:paramtypes", [Object]), + // __metadata("design:returntype", void 0) + // ], C.prototype, "method", undefined); + // + // The emit for an accessor is: + // + // __decorate([ + // dec + // ], C.prototype, "accessor", undefined); + // + // The emit for a property is: + // + // __decorate([ + // dec + // ], C.prototype, "prop"); + // + writeLine(); + emitStart(member); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + if (languageVersion > 0 /* ES3 */) { + if (member.kind !== 141 /* PropertyDeclaration */) { + // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly. + // We have this extra argument here so that we can inject an explicit property descriptor at a later date. + write(", null"); + } + else { + // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it + // should not invoke `Object.getOwnPropertyDescriptor`. + write(", void 0"); + } + } + write(");"); + emitEnd(member); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + write("__param(" + parameterIndex + ", "); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + // This method determines whether to emit the "design:type" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + // This method determines whether to emit the "design:returntype" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 143 /* MethodDeclaration */: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 214 /* ClassDeclaration */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: + return true; + } + return false; + } + /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ + function emitSerializedTypeOfNode(node) { + // serialization of the type of a declaration uses the following rules: + // + // * The serialized type of a ClassDeclaration is "Function" + // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. + // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. + // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. + // * The serialized type of any other FunctionLikeDeclaration is "Function". + // * The serialized type of any other node is "void 0". + // + // For rules on serializing type annotations, see `serializeTypeNode`. + switch (node.kind) { + case 214 /* ClassDeclaration */: + write("Function"); + return; + case 141 /* PropertyDeclaration */: + emitSerializedTypeNode(node.type); + return; + case 138 /* Parameter */: + emitSerializedTypeNode(node.type); + return; + case 145 /* GetAccessor */: + emitSerializedTypeNode(node.type); + return; + case 146 /* SetAccessor */: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103 /* VoidKeyword */: + write("void 0"); + return; + case 160 /* ParenthesizedType */: + emitSerializedTypeNode(node.type); + return; + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + write("Function"); + return; + case 156 /* ArrayType */: + case 157 /* TupleType */: + write("Array"); + return; + case 150 /* TypePredicate */: + case 120 /* BooleanKeyword */: + write("Boolean"); + return; + case 130 /* StringKeyword */: + case 9 /* StringLiteral */: + write("String"); + return; + case 128 /* NumberKeyword */: + write("Number"); + return; + case 131 /* SymbolKeyword */: + write("Symbol"); + return; + case 151 /* TypeReference */: + emitSerializedTypeReferenceNode(node); + return; + case 154 /* TypeQuery */: + case 155 /* TypeLiteral */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: + case 117 /* AnyKeyword */: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + // Clone the type name and parent it to a location outside of the current declaration. + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0 /* Auto */); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, /*useFallback*/ true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, /*useFallback*/ false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2 /* ES6 */) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ + function emitSerializedParameterTypesOfNode(node) { + // serialization of parameter types uses the following rules: + // + // * If the declaration is a class, the parameters of the first constructor with a body are used. + // * If the declaration is function-like and has a body, the parameters of the function are used. + // + // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. + if (node) { + var valueDeclaration; + if (node.kind === 214 /* ClassDeclaration */) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 156 /* ArrayType */) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 151 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + /** Serializes the return type of function. Used by the __metadata decorator for a method. */ + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + // This method emits the serialized type metadata for a decorator target. + // The caller should have already tested whether the node has decorators. + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + // const enums are completely erased during compilation. + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); + } + function emitModuleDeclaration(node) { + // Emit only if this module is non-ambient. + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 219 /* ModuleBlock */) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + // write moduleDecl = containingModule.m only if it is not exported es6 module member + if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { + if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + /* + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9 /* StringLiteral */) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18 /* CloseParenToken */, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224 /* NamespaceImport */) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 222 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== 5 /* ES6 */) { + return emitExternalImportDeclaration(node); + } + // ES6 import + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (modulekind !== 2 /* AMD */) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + // import x = require("foo") + // import * as x from "foo" + if (!isExportedImport) + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + // import "foo" + // import x from "foo" + // import { x, y } from "foo" + // import d, * as x from "foo" + // import d, { x, y } from "foo" + var isNakedImport = 222 /* ImportDeclaration */ && !node.importClause; + if (!isNakedImport) { + write("var "); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + // import d, * as x from "foo" + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + // import d, * as x from "foo" + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when + // - current file is not external module + // - import declaration is top level and target is value imported by entity name + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + // variable declaration for import-equals declaration can be hoisted in system modules + // in this case 'var' should be omitted and emit should contain only initialization + var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + // is it top level export import v = a.b.c in system module? + // if yes - it needs to be rewritten as exporter('v', v = a.b.c) + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1 /* Export */)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== 4 /* System */); + if (modulekind !== 5 /* ES6 */) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + // export { x, y, ... } from "foo" + if (modulekind !== 2 /* AMD */) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + // export * from "foo" + writeLine(); + write("__export("); + if (modulekind !== 2 /* AMD */) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + // export { x, y, ... } + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === 5 /* ES6 */); + var needsComma = false; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === 5 /* ES6 */) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 213 /* FunctionDeclaration */ && + expression.kind !== 214 /* ClassDeclaration */) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === 4 /* System */) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0 /* ES3 */) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStars = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 222 /* ImportDeclaration */: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { + // import "mod" + // import x from "mod" where x is referenced + // import * as x from "mod" where x is referenced + // import { x, y } from "mod" where at least one import is referenced + externalImports.push(node); + } + break; + case 221 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 232 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + // import x = require("mod") where x is referenced + externalImports.push(node); + } + break; + case 228 /* ExportDeclaration */: + if (node.moduleSpecifier) { + if (!node.exportClause) { + // export * from "mod" + externalImports.push(node); + hasExportStars = true; + } + else if (resolver.isValueAliasDeclaration(node)) { + // export { x, y } from "mod" where at least one export is a value symbol + externalImports.push(node); + } + } + else { + // export { x, y } + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_25 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_25] || (exportSpecifiers[name_25] = [])).push(specifier); + } + } + break; + case 227 /* ExportAssignment */: + if (node.isExportEquals && !exportEquals) { + // export = x + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStars) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 228 /* ExportDeclaration */ && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9 /* StringLiteral */) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + // do not create variable declaration for exports and imports that lack import clause + var skipNode = importNode.kind === 228 /* ExportDeclaration */ || + (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + if (!hasExportStars) { + // local names set is needed only in presence of star exports + return undefined; + } + // local names set should only be added if we have anything exported + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + return emitExportStarFunction(/*localNames*/ undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + // write name of exported declaration, i.e 'export var x...' + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + // write name of export specified, i.e. 'export {x}' + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 228 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + // define an export star helper function + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + // do not record default exports + // they are local to module and never overwritten (explicitly skipped) by star export + if (node.kind !== 69 /* Identifier */ && node.flags & 1024 /* Default */) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69 /* Identifier */) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + // per ES6 spec: + // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method + // - var declarations are initialized to undefined - 14.a.ii + // - function/generator declarations are instantiated - 16.a.iv + // this means that after module is instantiated but before its evaluation + // exported functions are already accessible at import sites + // in theory we should hoist only exported functions and its dependencies + // in practice to simplify things we'll hoist all source level functions and variable declaration + // including variables declarations for module and class declarations + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + var name_26 = local.kind === 69 /* Identifier */ + ? local + : local.name; + if (name_26) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_26.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 214 /* ClassDeclaration */ || local.kind === 218 /* ModuleDeclaration */ || local.kind === 217 /* EnumDeclaration */) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); + if (flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } + if (node.kind === 213 /* FunctionDeclaration */) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 214 /* ClassDeclaration */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 217 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { + var name_27 = node.name; + if (name_27.kind === 69 /* Identifier */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_27); + } + else { + ts.forEachChild(name_27, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + // hoist variable if + // - it is not block scoped + // - it is top level block scoped + // if block scoped variables are nested in some another block then + // no other functions can use them except ones that are defined at least in the same block + return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; + } + function isCurrentFileSystemExternalModule() { + return modulekind === 4 /* System */ && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + // shape of the body in system modules: + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } + // I.e: + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); + // will be transformed to + // function(exports) { + // var file1; // local alias + // var y; + // function foo() { return y + file1.x(); } + // exports("foo", foo); + // return { + // setters: [ + // function(v) { file1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); // return + emitTempDeclarations(/*newLine*/ true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + // derive a unique name for parameter from the first named entry in the group + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 222 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // fall-through + case 221 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 228 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + // - function declarations are not emitted because they were already hoisted + // - import declarations are not emitted since they are already handled in setters + // - export declarations with module specifiers are not emitted since they were already written in setters + // - export declarations without module specifiers are emitted preserving the order + case 213 /* FunctionDeclaration */: + case 222 /* ImportDeclaration */: + continue; + case 228 /* ExportDeclaration */: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + // write call to exporter function for every export specifier in exports list + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 221 /* ImportEqualsDeclaration */: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + // - import equals declarations that import external modules are not emitted + continue; + } + // fall-though for import declarations that import internal modules + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); // execute + } + function emitSystemModule(node) { + collectExternalModuleInfo(node); + // System modules has the following shape + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. + // 'exports' returns its 'value' argument so in most cases expressions + // that mutate exported values can be rewritten as: + // expr -> exports('name', expr). + // The only exception in this rule is postfix unary operators, + // see comment to 'emitPostfixUnaryExpression' for more details + ts.Debug.assert(!exportFunctionForFile); + // make sure that name of 'exports' function does not conflict with existing identifiers + exportFunctionForFile = makeUniqueName("exports"); + writeLine(); + write("System.register("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + // deduplicate/group entries in dependency list by the dependency name + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies) { + // names of modules with corresponding parameter in the factory function + var aliasedModuleNames = []; + // names of modules with no corresponding parameters in factory function + var unaliasedModuleNames = []; + var importAliasNames = []; // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding + // module names in aliasedModuleNames. + // Fill in amd-dependency tags + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push("\"" + amdDependency.path + "\""); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + } + } + for (var _c = 0; _c < externalImports.length; _c++) { + var importNode = externalImports[_c]; + // Find the name of the external module + var externalModuleName = getExternalModuleNameText(importNode); + // Find the name of the module alias, if there is one + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies) { + // An AMD define function has the following shape: + // define(id?, dependencies?, factory); + // + // This has the shape of + // define(name, ["module1", "module2"], function (module1Alias) { + // The location of the alias in the parameter list in the factory function needs to + // match the position of the module name in the dependency list. + // + // To ensure this is true in cases of modules with no aliases, e.g.: + // `import "module"` or `` + // we need to add modules without alias names to the end of the dependencies list + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write("[\"require\", \"exports\""); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ false); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false); + // Module is detected first to support Browserify users that load into a browser with an AMD loader + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + // Emit exportDefault if it exists will happen as part + // or normal statement emit. + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + jsxEmitReact(node); + break; + case 1 /* Preserve */: + // Fall back to preserve if None was specified (we'll error earlier) + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, /*includeTrivia*/ true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + // JSX trims whitespace at the end and beginning of lines, except that the + // start/end of a tag is considered a start/end of a line only if that line is + // on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + // Replace entities like   + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; + } + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1 /* Preserve */: + default: + return ts.getTextOfNode(node, /*includeTrivia*/ true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); + break; + case 1 /* Preserve */: + default: + writer.writeLiteral(ts.getTextOfNode(node, /*includeTrivia*/ true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1 /* Preserve */: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2 /* React */: + emit(node.expression); + break; + } + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + // return index of the first non prologue directive + return i; + } + } + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + // Only emit helpers if the user did not say otherwise. + if (!compilerOptions.noEmitHelpers) { + // Only Emit __extends function when target ES5. + // For target ES6 and above, we can emit classDeclaration as is. + if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + // Start new file on new line + writeLine(); + emitShebang(); + emitDetachedComments(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + emitModule(node); + } + else { + // emit prologue directives prior to __extends + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2 /* Ambient */) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + // All of these entities are emitted in a specialized fashion. As such, we allow + // the specialized methods for each to handle the comments on the nodes. + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 227 /* ExportAssignment */: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 193 /* VariableStatement */: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 218 /* ModuleDeclaration */: + // Only emit the leading/trailing comments for a module if we're actually + // emitting the module as well. + return shouldEmitModuleDeclaration(node); + case 217 /* EnumDeclaration */: + // Only emit the leading/trailing comments for an enum if we're actually + // emitting the module as well. + return shouldEmitEnumDeclaration(node); + } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + ts.Debug.assert(!isSpecializedCommentHandling(node)); + // If this is the expression body of an arrow function that we're down-leveling, + // then we don't want to emit comments when we emit the body. It will have already + // been taken care of when we emitted the 'return' statement for the function + // expression body. + if (node.kind !== 192 /* Block */ && + node.parent && + node.parent.kind === 174 /* ArrowFunction */ && + node.parent.body === node && + compilerOptions.target <= 1 /* ES5 */) { + return false; + } + // Emit comments for everything else. + return true; + } + function emitJavaScriptWorker(node) { + // Check if the node can be emitted regardless of the ScriptTarget + switch (node.kind) { + case 69 /* Identifier */: + return emitIdentifier(node); + case 138 /* Parameter */: + return emitParameter(node); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + return emitMethod(node); + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + return emitAccessor(node); + case 97 /* ThisKeyword */: + return emitThis(node); + case 95 /* SuperKeyword */: + return emitSuper(node); + case 93 /* NullKeyword */: + return write("null"); + case 99 /* TrueKeyword */: + return write("true"); + case 84 /* FalseKeyword */: + return write("false"); + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 10 /* RegularExpressionLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 13 /* TemplateMiddle */: + case 14 /* TemplateTail */: + return emitLiteral(node); + case 183 /* TemplateExpression */: + return emitTemplateExpression(node); + case 190 /* TemplateSpan */: + return emitTemplateSpan(node); + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + return emitJsxElement(node); + case 236 /* JsxText */: + return emitJsxText(node); + case 240 /* JsxExpression */: + return emitJsxExpression(node); + case 135 /* QualifiedName */: + return emitQualifiedName(node); + case 161 /* ObjectBindingPattern */: + return emitObjectBindingPattern(node); + case 162 /* ArrayBindingPattern */: + return emitArrayBindingPattern(node); + case 163 /* BindingElement */: + return emitBindingElement(node); + case 164 /* ArrayLiteralExpression */: + return emitArrayLiteral(node); + case 165 /* ObjectLiteralExpression */: + return emitObjectLiteral(node); + case 245 /* PropertyAssignment */: + return emitPropertyAssignment(node); + case 246 /* ShorthandPropertyAssignment */: + return emitShorthandPropertyAssignment(node); + case 136 /* ComputedPropertyName */: + return emitComputedPropertyName(node); + case 166 /* PropertyAccessExpression */: + return emitPropertyAccess(node); + case 167 /* ElementAccessExpression */: + return emitIndexedAccess(node); + case 168 /* CallExpression */: + return emitCallExpression(node); + case 169 /* NewExpression */: + return emitNewExpression(node); + case 170 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 171 /* TypeAssertionExpression */: + return emit(node.expression); + case 189 /* AsExpression */: + return emit(node.expression); + case 172 /* ParenthesizedExpression */: + return emitParenExpression(node); + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + return emitFunctionDeclaration(node); + case 175 /* DeleteExpression */: + return emitDeleteExpression(node); + case 176 /* TypeOfExpression */: + return emitTypeOfExpression(node); + case 177 /* VoidExpression */: + return emitVoidExpression(node); + case 178 /* AwaitExpression */: + return emitAwaitExpression(node); + case 179 /* PrefixUnaryExpression */: + return emitPrefixUnaryExpression(node); + case 180 /* PostfixUnaryExpression */: + return emitPostfixUnaryExpression(node); + case 181 /* BinaryExpression */: + return emitBinaryExpression(node); + case 182 /* ConditionalExpression */: + return emitConditionalExpression(node); + case 185 /* SpreadElementExpression */: + return emitSpreadElementExpression(node); + case 184 /* YieldExpression */: + return emitYieldExpression(node); + case 187 /* OmittedExpression */: + return; + case 192 /* Block */: + case 219 /* ModuleBlock */: + return emitBlock(node); + case 193 /* VariableStatement */: + return emitVariableStatement(node); + case 194 /* EmptyStatement */: + return write(";"); + case 195 /* ExpressionStatement */: + return emitExpressionStatement(node); + case 196 /* IfStatement */: + return emitIfStatement(node); + case 197 /* DoStatement */: + return emitDoStatement(node); + case 198 /* WhileStatement */: + return emitWhileStatement(node); + case 199 /* ForStatement */: + return emitForStatement(node); + case 201 /* ForOfStatement */: + case 200 /* ForInStatement */: + return emitForInOrForOfStatement(node); + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: + return emitBreakOrContinueStatement(node); + case 204 /* ReturnStatement */: + return emitReturnStatement(node); + case 205 /* WithStatement */: + return emitWithStatement(node); + case 206 /* SwitchStatement */: + return emitSwitchStatement(node); + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + return emitCaseOrDefaultClause(node); + case 207 /* LabeledStatement */: + return emitLabelledStatement(node); + case 208 /* ThrowStatement */: + return emitThrowStatement(node); + case 209 /* TryStatement */: + return emitTryStatement(node); + case 244 /* CatchClause */: + return emitCatchClause(node); + case 210 /* DebuggerStatement */: + return emitDebuggerStatement(node); + case 211 /* VariableDeclaration */: + return emitVariableDeclaration(node); + case 186 /* ClassExpression */: + return emitClassExpression(node); + case 214 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 215 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 217 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 247 /* EnumMember */: + return emitEnumMember(node); + case 218 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 222 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 221 /* ImportEqualsDeclaration */: + return emitImportEqualsDeclaration(node); + case 228 /* ExportDeclaration */: + return emitExportDeclaration(node); + case 227 /* ExportAssignment */: + return emitExportAssignment(node); + case 248 /* SourceFile */: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + // get the leading comments from detachedPos + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + /** + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(comment) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments + if (node.parent) { + if (node.parent.kind === 248 /* SourceFile */ || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + // get comments without detached comments + return getLeadingCommentsWithoutDetachedComments(); + } + else { + // get the leading comments from the node + return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + } + } + } + function getTrailingCommentsToEmit(node) { + // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments + if (node.parent) { + if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + } + } + } + /** + * Emit comments associated with node that will not be emitted into JS file + */ + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + // Emit the trailing comments only if the parent's end doesn't match + var trailingComments = getTrailingCommentsToEmit(node); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + } + /** + * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: + * x, /comment1/ y + * ^ => pos; the function will emit "comment1" in the emitJS + */ + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + // get comments without detached comments + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + // get the leading comments from the node + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + } + function emitDetachedComments(node) { + var leadingComments; + if (compilerOptions.removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + // There was a blank line between the last comment and this comment. This + // comment is not part of the copyright comments. Return what we have so + // far. + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + // All comments look like they could have been part of the copyright header. Make + // sure there is at least one blank line between it and the node. If not, it's not + // a copyright header. + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + // Valid detachedComments + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } + var _a; + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + } + } + } + ts.emitFiles = emitFiles; })(ts || (ts = {})); /// /// @@ -35311,11 +35997,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -35325,13 +36011,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, loadOnlyDts, failedLookupLocation, host) { - if (loadOnlyDts) { - return tryLoad(".d.ts"); - } - else { - return ts.forEach(ts.supportedExtensions, tryLoad); - } + function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { + return ts.forEach(ts.supportedJsExtensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -35343,7 +36024,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, loadOnlyDts, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -35356,7 +36037,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -35366,7 +36047,7 @@ var ts; // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -35376,11 +36057,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -35399,16 +36080,17 @@ var ts; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk - if (moduleName.indexOf('!') != -1) { + if (moduleName.indexOf("!") != -1) { return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { // resolve .tsx files only if jsx support is enabled // 'logical not' handles both undefined and None cases @@ -35746,7 +36428,9 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(fileName); + // first try to use file name as is to find file + // then try to convert relative file name to absolute and use it to retrieve source file + return filesByName.get(fileName) || filesByName.get(ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory())); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -35842,13 +36526,18 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; + collect(node, /* allowRelativeModuleNames */ true); + } + file.imports = imports || emptyArray; + function collect(node, allowRelativeModuleNames) { switch (node.kind) { - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -35856,9 +36545,24 @@ var ts; if (!moduleNameExpr.text) { break; } - (imports || (imports = [])).push(moduleNameExpr); + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - case 216 /* ModuleDeclaration */: + case 168 /* CallExpression */: + if (isJavaScriptFile && ts.isRequireCall(node)) { + var jsImports = node.arguments; + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === 9 /* StringLiteral */) { + imports.push(jsImports[i]); + } + } + } + } + break; + case 218 /* ModuleDeclaration */: if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An AmbientExternalModuleDeclaration declares an external module. @@ -35866,22 +36570,18 @@ var ts; // The StringLiteral must specify a top - level external module name. // Relative external module names are not permitted ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9 /* StringLiteral */) { - var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - if (moduleName) { - (imports || (imports = [])).push(moduleName); - } - } + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + collect(node, /* allowRelativeModuleNames */ false); }); } break; } + if (ts.isSourceFileJavaScript(file)) { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames); }); + } } - file.imports = imports || emptyArray; } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; @@ -35925,52 +36625,52 @@ var ts; } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); - if (filesByName.contains(canonicalName)) { + if (filesByName.contains(fileName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); + return getSourceFileFromCache(fileName, /*useAbsolutePath*/ false); } - else { - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); - if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); - } - // We haven't looked for this file, do so now and cache result - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(canonicalName, file); - if (file) { - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - // Set the source file for normalized absolute path - filesByName.set(canonicalAbsolutePath, file); - var basePath = ts.getDirectoryPath(fileName); - if (!options.noResolve) { - processReferencedFiles(file, basePath); - } - // always process imported modules to record module name resolutions - processImportedModules(file, basePath); - if (isDefaultLib) { - file.isDefaultLib = true; - files.unshift(file); - } - else { - files.push(file); - } - } - return file; + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + if (filesByName.contains(normalizedAbsolutePath)) { + var file_1 = getSourceFileFromCache(normalizedAbsolutePath, /*useAbsolutePath*/ true); + // we don't have resolution for this relative file name but the match was found by absolute file name + // store resolution for relative name as well + filesByName.set(fileName, file_1); + return file_1; } - function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName.get(canonicalName); + // We haven't looked for this file, do so now and cache result + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(fileName, file); + if (file) { + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + // Set the source file for normalized absolute path + filesByName.set(normalizedAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath); + } + // always process imported modules to record module name resolutions + processImportedModules(file, basePath); + if (isDefaultLib) { + file.isDefaultLib = true; + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + function getSourceFileFromCache(fileName, useAbsolutePath) { + var file = filesByName.get(fileName); if (file && host.useCaseSensitiveFileNames()) { var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; - if (canonicalName !== sourceFileName) { + if (ts.normalizeSlashes(fileName) !== ts.normalizeSlashes(sourceFileName)) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } @@ -36138,9 +36838,9 @@ var ts; var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - // Cannot specify module gen target when in es6 or above - if (options.module && languageVersion >= 2 /* ES6 */) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + // Cannot specify module gen target of es6 when below es6 + if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -36181,10 +36881,6 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.experimentalAsyncFunctions && - options.target !== 2 /* ES6 */) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); - } } } ts.createProgram = createProgram; @@ -36266,11 +36962,12 @@ var ts; "commonjs": 1 /* CommonJS */, "amd": 2 /* AMD */, "system": 4 /* System */, - "umd": 3 /* UMD */ + "umd": 3 /* UMD */, + "es6": 5 /* ES6 */ }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", @@ -36412,11 +37109,6 @@ var ts; type: "boolean", description: ts.Diagnostics.Watch_input_files }, - { - name: "experimentalAsyncFunctions", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions - }, { name: "experimentalDecorators", type: "boolean", @@ -36622,6 +37314,9 @@ var ts; } if (opt.isFilePath) { value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } options[opt.name] = value; } @@ -36650,20 +37345,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_27 = sysFiles[i]; - if (ts.fileExtensionIs(name_27, ".d.ts")) { - var baseName = name_27.substr(0, name_27.length - ".d.ts".length); + var name_28 = sysFiles[i]; + if (ts.fileExtensionIs(name_28, ".d.ts")) { + var baseName = name_28.substr(0, name_28.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_27); + fileNames.push(name_28); } } - else if (ts.fileExtensionIs(name_27, ".ts")) { - if (!ts.contains(sysFiles, name_27 + "x")) { - fileNames.push(name_27); + else if (ts.fileExtensionIs(name_28, ".ts")) { + if (!ts.contains(sysFiles, name_28 + "x")) { + fileNames.push(name_28); } } else { - fileNames.push(name_27); + fileNames.push(name_28); } } } @@ -36744,7 +37439,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 172 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 174 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -36756,7 +37451,7 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 190 /* Block */: + case 192 /* Block */: if (!ts.isFunctionBlock(n)) { var parent_7 = n.parent; var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); @@ -36764,18 +37459,18 @@ var ts; // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_7.kind === 195 /* DoStatement */ || - parent_7.kind === 198 /* ForInStatement */ || - parent_7.kind === 199 /* ForOfStatement */ || - parent_7.kind === 197 /* ForStatement */ || - parent_7.kind === 194 /* IfStatement */ || - parent_7.kind === 196 /* WhileStatement */ || - parent_7.kind === 203 /* WithStatement */ || - parent_7.kind === 242 /* CatchClause */) { + if (parent_7.kind === 197 /* DoStatement */ || + parent_7.kind === 200 /* ForInStatement */ || + parent_7.kind === 201 /* ForOfStatement */ || + parent_7.kind === 199 /* ForStatement */ || + parent_7.kind === 196 /* IfStatement */ || + parent_7.kind === 198 /* WhileStatement */ || + parent_7.kind === 205 /* WithStatement */ || + parent_7.kind === 244 /* CatchClause */) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 207 /* TryStatement */) { + if (parent_7.kind === 209 /* TryStatement */) { // Could be the try-block, or the finally-block. var tryStatement = parent_7; if (tryStatement.tryBlock === n) { @@ -36783,7 +37478,7 @@ var ts; break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -36802,23 +37497,23 @@ var ts; break; } // Fallthrough. - case 217 /* ModuleBlock */: { + case 219 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 163 /* ObjectLiteralExpression */: - case 218 /* CaseBlock */: { + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 165 /* ObjectLiteralExpression */: + case 220 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -36846,12 +37541,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_28 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_28); + for (var name_29 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_29); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_28); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_29); if (!matches) { continue; } @@ -36864,14 +37559,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_28); + matches = patternMatcher.getMatches(containers, name_29); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_28, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_29, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -36895,7 +37590,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 /* Identifier */ || + if (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -36909,7 +37604,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 134 /* ComputedPropertyName */) { + else if (declaration.name.kind === 136 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); } else { @@ -36930,7 +37625,7 @@ var ts; } return true; } - if (expression.kind === 164 /* PropertyAccessExpression */) { + if (expression.kind === 166 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -36943,7 +37638,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (declaration.name.kind === 136 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { return undefined; } @@ -37019,17 +37714,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 216 /* ModuleDeclaration */); + } while (current.kind === 218 /* ModuleDeclaration */); // fall through - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -37040,21 +37735,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -37066,7 +37761,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -37075,21 +37770,21 @@ var ts; } } break; - case 161 /* BindingElement */: - case 209 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 211 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 211 /* FunctionDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 213 /* FunctionDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: childNodes.push(node); break; } @@ -37137,17 +37832,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -37158,12 +37853,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 211 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 213 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 190 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 192 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -37223,7 +37918,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 136 /* Parameter */: + case 138 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -37231,36 +37926,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145 /* CallSignature */: + case 147 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: var variableDeclarationNode; - var name_29; - if (node.kind === 161 /* BindingElement */) { - name_29 = node.name; + var name_30; + if (node.kind === 163 /* BindingElement */) { + name_30 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 209 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 211 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -37268,24 +37963,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_29 = node.name; + name_30 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.variableElement); } - case 142 /* Constructor */: + case 144 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 228 /* ExportSpecifier */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: + case 230 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -37315,17 +38010,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 246 /* SourceFile */: + case 248 /* SourceFile */: return createSourceFileItem(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return createClassItem(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return createEnumItem(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return createModuleItem(node); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -37337,7 +38032,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -37349,7 +38044,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 190 /* Block */) { + if (node.body && node.body.kind === 192 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -37370,7 +38065,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 142 /* Constructor */ && member; + return member.kind === 144 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -37394,7 +38089,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -37403,13 +38098,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 216 /* ModuleDeclaration */) { + while (node.body.kind === 218 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 246 /* SourceFile */ + return node.kind === 248 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -38197,22 +38892,22 @@ var ts; if (!candidates.length) { // We didn't have any sig help items produced by the TS compiler. If this is a JS // file, then see if we can figure out anything better. - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 166 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 168 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 67 /* Identifier */ + var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 164 /* PropertyAccessExpression */ + : expression.kind === 166 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -38245,7 +38940,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 166 /* CallExpression */ || node.parent.kind === 167 /* NewExpression */) { + if (node.parent.kind === 168 /* CallExpression */ || node.parent.kind === 169 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -38298,25 +38993,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 170 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 170 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 188 /* TemplateSpan */ && node.parent.parent.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 190 /* TemplateSpan */ && node.parent.parent.parent.kind === 170 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -38434,7 +39129,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 181 /* TemplateExpression */) { + if (template.kind === 183 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -38443,7 +39138,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 246 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 248 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -38643,40 +39338,40 @@ var ts; return false; } switch (n.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 163 /* ObjectLiteralExpression */: - case 159 /* ObjectBindingPattern */: - case 153 /* TypeLiteral */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 218 /* CaseBlock */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 165 /* ObjectLiteralExpression */: + case 161 /* ObjectBindingPattern */: + case 155 /* TypeLiteral */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 220 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 167 /* NewExpression */: + case 169 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 166 /* CallExpression */: - case 170 /* ParenthesizedExpression */: - case 158 /* ParenthesizedType */: + case 168 /* CallExpression */: + case 172 /* ParenthesizedExpression */: + case 160 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 172 /* ArrowFunction */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 174 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -38686,63 +39381,64 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 194 /* IfStatement */: + case 196 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 193 /* ExpressionStatement */: - return isCompletedNode(n.expression, sourceFile); - case 162 /* ArrayLiteralExpression */: - case 160 /* ArrayBindingPattern */: - case 165 /* ElementAccessExpression */: - case 134 /* ComputedPropertyName */: - case 155 /* TupleType */: + case 195 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 23 /* SemicolonToken */); + case 164 /* ArrayLiteralExpression */: + case 162 /* ArrayBindingPattern */: + case 167 /* ElementAccessExpression */: + case 136 /* ComputedPropertyName */: + case 157 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 195 /* DoStatement */: + case 197 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, 102 /* WhileKeyword */, sourceFile); + var hasWhileKeyword = findChildOfKind(n, 104 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 174 /* TypeOfExpression */: - case 173 /* DeleteExpression */: - case 175 /* VoidExpression */: - case 182 /* YieldExpression */: - case 183 /* SpreadElementExpression */: + case 176 /* TypeOfExpression */: + case 175 /* DeleteExpression */: + case 177 /* VoidExpression */: + case 184 /* YieldExpression */: + case 185 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -38798,7 +39494,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 269 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 271 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -38904,7 +39600,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 234 /* JsxText */) { + if (isToken(n) || n.kind === 236 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38912,7 +39608,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 234 /* JsxText */) { + if (isToken(n) || n.kind === 236 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38926,10 +39622,10 @@ var ts; // if no - position is in the node itself so we should recurse in it. // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). // if this is the case - then we should assume that token in question is located in previous child. - if (position < child.end && (nodeHasTokens(child) || child.kind === 234 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 236 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 234 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 236 /* JsxText */ && start === child.end); // whitespace only JsxText if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); @@ -38941,7 +39637,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 246 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 248 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -39016,9 +39712,9 @@ var ts; var node = ts.getTokenAtPosition(sourceFile, position); if (isToken(node)) { switch (node.kind) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: // if the current token is var, let or const, skip the VariableDeclarationList node = node.parent === undefined ? undefined : node.parent.parent; break; @@ -39067,21 +39763,21 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 149 /* TypeReference */ || node.kind === 166 /* CallExpression */) { + if (node.kind === 151 /* TypeReference */ || node.kind === 168 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 212 /* ClassDeclaration */ || node.kind === 213 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 214 /* ClassDeclaration */ || node.kind === 215 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 132 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 134 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { - return kind === 67 /* Identifier */ || ts.isKeyword(kind); + return kind === 69 /* Identifier */ || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { @@ -39091,8 +39787,17 @@ var ts; return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 /* StringLiteral */ + || kind === 10 /* RegularExpressionLiteral */ + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; function isPunctuation(kind) { - return 15 /* FirstPunctuation */ <= kind && kind <= 66 /* LastPunctuation */; + return 15 /* FirstPunctuation */ <= kind && kind <= 68 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -39102,9 +39807,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: return true; } return false; @@ -39132,7 +39837,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -39154,7 +39859,8 @@ var ts; increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; function writeIndent() { if (lineStart) { @@ -39319,7 +40025,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 224 /* ImportSpecifier */ || location.parent.kind === 228 /* ExportSpecifier */) && + (location.parent.kind === 226 /* ImportSpecifier */ || location.parent.kind === 230 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -39347,7 +40053,12 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); + var standardScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); + var jsxScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); + /** + * Scanner that is currently used for formatting + */ + var scanner; var ScanAction; (function (ScanAction) { ScanAction[ScanAction["Scan"] = 0] = "Scan"; @@ -39357,6 +40068,8 @@ var ts; ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; })(ScanAction || (ScanAction = {})); function getFormattingScanner(sourceFile, startPos, endPos) { + ts.Debug.assert(scanner === undefined); + scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; scanner.setText(sourceFile.text); scanner.setTextPos(startPos); var wasNewLine = true; @@ -39371,11 +40084,14 @@ var ts; isOnToken: isOnToken, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; scanner.setText(undefined); + scanner = undefined; } }; function advance() { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; var isStarted = scanner.getStartPos() !== startPos; if (isStarted) { @@ -39419,10 +40135,10 @@ var ts; if (node) { switch (node.kind) { case 29 /* GreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanToken */: return true; } } @@ -39431,11 +40147,11 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 236 /* JsxAttribute */: - case 233 /* JsxOpeningElement */: - case 235 /* JsxClosingElement */: - case 232 /* JsxSelfClosingElement */: - return node.kind === 67 /* Identifier */; + case 238 /* JsxAttribute */: + case 235 /* JsxOpeningElement */: + case 237 /* JsxClosingElement */: + case 234 /* JsxSelfClosingElement */: + return node.kind === 69 /* Identifier */; } } return false; @@ -39448,9 +40164,10 @@ var ts; container.kind === 14 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 38 /* SlashToken */ || t === 59 /* SlashEqualsToken */; + return t === 39 /* SlashToken */ || t === 61 /* SlashEqualsToken */; } function readTokenInfo(n) { + ts.Debug.assert(scanner !== undefined); if (!isOnToken()) { // scanner is not on the token (either advance was not called yet or scanner is already past the end position) return { @@ -39500,7 +40217,7 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } - else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 67 /* Identifier */) { + else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 69 /* Identifier */) { currentToken = scanner.scanJsxIdentifier(); lastScanAction = 4 /* RescanJsxIdentifier */; } @@ -39544,6 +40261,7 @@ var ts; return fixTokenKind(lastTokenInfo, n); } function isOnToken() { + ts.Debug.assert(scanner !== undefined); var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); @@ -39822,17 +40540,17 @@ var ts; this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Space after }. this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 78 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 102 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); @@ -39844,10 +40562,10 @@ var ts; this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */, 71 /* ClassKeyword */]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 3 /* MultiLineCommentTrivia */, 73 /* ClassKeyword */]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 79 /* DoKeyword */, 100 /* TryKeyword */, 85 /* FinallyKeyword */, 80 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); @@ -39861,55 +40579,55 @@ var ts; // Prefix operators generally shouldn't have a space between // them and their target unary expression. this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */, 117 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 77 /* DoKeyword */, 78 /* ElseKeyword */, 69 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98 /* TryKeyword */, 83 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121 /* GetKeyword */, 127 /* SetKeyword */]), 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 129 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 127 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */, 130 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 129 /* SetKeyword */, 113 /* StaticKeyword */, 132 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); // generics and type assertions this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); @@ -39920,17 +40638,20 @@ var ts; // Remove spaces in empty interface literals. e.g.: x: {} this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 67 /* Identifier */, 80 /* ExportKeyword */, 75 /* DefaultKeyword */, 71 /* ClassKeyword */, 111 /* StaticKeyword */, 110 /* PublicKeyword */, 108 /* PrivateKeyword */, 109 /* ProtectedKeyword */, 121 /* GetKeyword */, 127 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 129 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // template string - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39957,8 +40678,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -40026,14 +40747,14 @@ var ts; this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space after function keyword for anonymous functions - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_30 in o) { - if (o[name_30] === rule) { - return name_30; + for (var name_31 in o) { + if (o[name_31] === rule) { + return name_31; } } throw new Error("Unknown rule"); @@ -40042,40 +40763,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 197 /* ForStatement */; + return context.contextNode.kind === 199 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 187 /* AsExpression */: - case 148 /* TypePredicate */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 189 /* AsExpression */: + case 150 /* TypePredicate */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 161 /* BindingElement */: + case 163 /* BindingElement */: // equals in type X = ... - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: // equal in p = 0; - case 136 /* Parameter */: - case 245 /* EnumMember */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - return context.currentTokenSpan.kind === 55 /* EqualsToken */ || context.nextTokenSpan.kind === 55 /* EqualsToken */; + case 138 /* Parameter */: + case 247 /* EnumMember */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 198 /* ForInStatement */: - return context.currentTokenSpan.kind === 88 /* InKeyword */ || context.nextTokenSpan.kind === 88 /* InKeyword */; + case 200 /* ForInStatement */: + return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 199 /* ForOfStatement */: - return context.currentTokenSpan.kind === 132 /* OfKeyword */ || context.nextTokenSpan.kind === 132 /* OfKeyword */; + case 201 /* ForOfStatement */: + return context.currentTokenSpan.kind === 134 /* OfKeyword */ || context.nextTokenSpan.kind === 134 /* OfKeyword */; } return false; }; @@ -40083,7 +40804,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 180 /* ConditionalExpression */; + return context.contextNode.kind === 182 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -40127,93 +40848,93 @@ var ts; return true; } switch (node.kind) { - case 190 /* Block */: - case 218 /* CaseBlock */: - case 163 /* ObjectLiteralExpression */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 220 /* CaseBlock */: + case 165 /* ObjectLiteralExpression */: + case 219 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 145 /* CallSignature */: - case 171 /* FunctionExpression */: - case 142 /* Constructor */: - case 172 /* ArrowFunction */: + case 147 /* CallSignature */: + case 173 /* FunctionExpression */: + case 144 /* Constructor */: + case 174 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 211 /* FunctionDeclaration */ || context.contextNode.kind === 171 /* FunctionExpression */; + return context.contextNode.kind === 213 /* FunctionDeclaration */ || context.contextNode.kind === 173 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 153 /* TypeLiteral */: - case 216 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 218 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 212 /* ClassDeclaration */: - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - case 190 /* Block */: - case 242 /* CatchClause */: - case 217 /* ModuleBlock */: - case 204 /* SwitchStatement */: + case 214 /* ClassDeclaration */: + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + case 192 /* Block */: + case 244 /* CatchClause */: + case 219 /* ModuleBlock */: + case 206 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 194 /* IfStatement */: - case 204 /* SwitchStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: - case 207 /* TryStatement */: - case 195 /* DoStatement */: - case 203 /* WithStatement */: + case 196 /* IfStatement */: + case 206 /* SwitchStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 209 /* TryStatement */: + case 197 /* DoStatement */: + case 205 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 242 /* CatchClause */: + case 244 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 163 /* ObjectLiteralExpression */; + return context.contextNode.kind === 165 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 166 /* CallExpression */; + return context.contextNode.kind === 168 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 167 /* NewExpression */; + return context.contextNode.kind === 169 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -40221,6 +40942,9 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 174 /* ArrowFunction */; + }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); }; @@ -40237,41 +40961,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 137 /* Decorator */; + return node.kind === 139 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 210 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 212 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 216 /* ModuleDeclaration */; + return context.contextNode.kind === 218 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 153 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 155 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 149 /* TypeReference */: - case 169 /* TypeAssertionExpression */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 186 /* ExpressionWithTypeArguments */: + case 151 /* TypeReference */: + case 171 /* TypeAssertionExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 188 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -40282,13 +41006,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 169 /* TypeAssertionExpression */; + return context.contextNode.kind === 171 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 101 /* VoidKeyword */ && context.currentTokenParent.kind === 175 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 177 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 182 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 184 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -40312,7 +41036,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 132 /* LastToken */ + 1; + this.mapRowLength = 134 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -40507,7 +41231,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 132 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 134 /* LastToken */; token++) { result.push(token); } return result; @@ -40549,17 +41273,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(68 /* FirstKeyword */, 132 /* LastKeyword */); - TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 66 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88 /* InKeyword */, 89 /* InstanceOfKeyword */, 132 /* OfKeyword */, 114 /* AsKeyword */, 122 /* IsKeyword */]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40 /* PlusPlusToken */, 41 /* MinusMinusToken */, 49 /* TildeToken */, 48 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 67 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 134 /* LastKeyword */); + TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 134 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41 /* PlusPlusToken */, 42 /* MinusMinusToken */, 50 /* TildeToken */, 49 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 69 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([67 /* Identifier */, 126 /* NumberKeyword */, 128 /* StringKeyword */, 118 /* BooleanKeyword */, 129 /* SymbolKeyword */, 101 /* VoidKeyword */, 115 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 128 /* NumberKeyword */, 130 /* StringKeyword */, 120 /* BooleanKeyword */, 131 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -40773,17 +41497,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 190 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 246 /* SourceFile */: - case 190 /* Block */: - case 217 /* ModuleBlock */: + return body && body.kind === 192 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 248 /* SourceFile */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -40956,9 +41680,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 246 /* SourceFile */ || - parent.kind === 239 /* CaseClause */ || - parent.kind === 240 /* DefaultClause */) { + parent.kind === 248 /* SourceFile */ || + parent.kind === 241 /* CaseClause */ || + parent.kind === 242 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -40994,19 +41718,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 212 /* ClassDeclaration */: return 71 /* ClassKeyword */; - case 213 /* InterfaceDeclaration */: return 105 /* InterfaceKeyword */; - case 211 /* FunctionDeclaration */: return 85 /* FunctionKeyword */; - case 215 /* EnumDeclaration */: return 215 /* EnumDeclaration */; - case 143 /* GetAccessor */: return 121 /* GetKeyword */; - case 144 /* SetAccessor */: return 127 /* SetKeyword */; - case 141 /* MethodDeclaration */: + case 214 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 215 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 213 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 217 /* EnumDeclaration */: return 217 /* EnumDeclaration */; + case 145 /* GetAccessor */: return 123 /* GetKeyword */; + case 146 /* SetAccessor */: return 129 /* SetKeyword */; + case 143 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: return node.name.kind; } } @@ -41040,9 +41764,9 @@ var ts; case 20 /* CloseBracketToken */: case 17 /* OpenParenToken */: case 18 /* CloseParenToken */: - case 78 /* ElseKeyword */: - case 102 /* WhileKeyword */: - case 54 /* AtToken */: + case 80 /* ElseKeyword */: + case 104 /* WhileKeyword */: + case 55 /* AtToken */: return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation @@ -41142,7 +41866,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 137 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 139 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -41399,8 +42123,8 @@ var ts; for (var line = line1; line < line2; ++line) { var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); var lineEndPosition = ts.getEndLinePosition(line, sourceFile); - // do not trim whitespaces in comments - if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + // do not trim whitespaces in comments or template expression + if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } var pos = lineEndPosition; @@ -41466,20 +42190,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 142 /* Constructor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 172 /* ArrowFunction */: + case 144 /* Constructor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 174 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -41487,8 +42211,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -41496,7 +42220,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 149 /* TypeReference */: + case 151 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -41580,22 +42304,39 @@ var ts; if (position > sourceFile.text.length) { return 0; // past EOF } + // no indentation when the indent style is set to none, + // so we can return fast + if (options.IndentStyle === ts.IndentStyle.None) { + return 0; + } var precedingToken = ts.findPrecedingToken(position, sourceFile); if (!precedingToken) { return 0; } // no indentation in string \regex\template literals - var precedingTokenIsLiteral = precedingToken.kind === 9 /* StringLiteral */ || - precedingToken.kind === 10 /* RegularExpressionLiteral */ || - precedingToken.kind === 11 /* NoSubstitutionTemplateLiteral */ || - precedingToken.kind === 12 /* TemplateHead */ || - precedingToken.kind === 13 /* TemplateMiddle */ || - precedingToken.kind === 14 /* TemplateTail */; + var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 179 /* BinaryExpression */) { + // indentation is first non-whitespace character in a previous line + // for block indentation, we should look for a line which contains something that's not + // whitespace. + if (options.IndentStyle === ts.IndentStyle.Block) { + // move backwards until we find a line with a non-whitespace character, + // then find the first non-whitespace character for that line. + var current_1 = position; + while (current_1 > 0) { + var char = sourceFile.text.charCodeAt(current_1); + if (!ts.isWhiteSpace(char) && !ts.isLineBreak(char)) { + break; + } + current_1--; + } + var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); + return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); + } + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 181 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -41714,7 +42455,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 246 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 248 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -41747,8 +42488,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 194 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 78 /* ElseKeyword */, sourceFile); + if (parent.kind === 196 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -41759,23 +42500,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 149 /* TypeReference */: + case 151 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return node.parent.properties; - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return node.parent.elements; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: { + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -41786,8 +42527,8 @@ var ts; } break; } - case 167 /* NewExpression */: - case 166 /* CallExpression */: { + case 169 /* NewExpression */: + case 168 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -41817,8 +42558,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 166 /* CallExpression */ || - node.parent.kind === 167 /* NewExpression */) && + if (node.parent && (node.parent.kind === 168 /* CallExpression */ || + node.parent.kind === 169 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -41836,10 +42577,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: node = node.expression; break; default: @@ -41904,42 +42645,43 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 162 /* ArrayLiteralExpression */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 163 /* ObjectLiteralExpression */: - case 153 /* TypeLiteral */: - case 155 /* TupleType */: - case 218 /* CaseBlock */: - case 240 /* DefaultClause */: - case 239 /* CaseClause */: - case 170 /* ParenthesizedExpression */: - case 164 /* PropertyAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 191 /* VariableStatement */: - case 209 /* VariableDeclaration */: - case 225 /* ExportAssignment */: - case 202 /* ReturnStatement */: - case 180 /* ConditionalExpression */: - case 160 /* ArrayBindingPattern */: - case 159 /* ObjectBindingPattern */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 136 /* Parameter */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 158 /* ParenthesizedType */: - case 168 /* TaggedTemplateExpression */: - case 176 /* AwaitExpression */: + case 195 /* ExpressionStatement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 164 /* ArrayLiteralExpression */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 165 /* ObjectLiteralExpression */: + case 155 /* TypeLiteral */: + case 157 /* TupleType */: + case 220 /* CaseBlock */: + case 242 /* DefaultClause */: + case 241 /* CaseClause */: + case 172 /* ParenthesizedExpression */: + case 166 /* PropertyAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 193 /* VariableStatement */: + case 211 /* VariableDeclaration */: + case 227 /* ExportAssignment */: + case 204 /* ReturnStatement */: + case 182 /* ConditionalExpression */: + case 162 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 138 /* Parameter */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 160 /* ParenthesizedType */: + case 170 /* TaggedTemplateExpression */: + case 178 /* AwaitExpression */: return true; } return false; @@ -41949,20 +42691,20 @@ var ts; return true; } switch (parent) { - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 194 /* IfStatement */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 172 /* ArrowFunction */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - return child !== 190 /* Block */; + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 196 /* IfStatement */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 174 /* ArrowFunction */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + return child !== 192 /* Block */; default: return false; } @@ -42104,7 +42846,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(269 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -42123,7 +42865,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 133 /* FirstNode */) { + if (this.kind >= 135 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -42170,7 +42912,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 133 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 135 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -42178,7 +42920,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 133 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 135 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -42227,7 +42969,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 136 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 138 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -42236,15 +42978,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 216 /* ModuleDeclaration */ && declaration.body.kind === 216 /* ModuleDeclaration */) { + if (declaration.kind === 218 /* ModuleDeclaration */ && declaration.body.kind === 218 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 216 /* ModuleDeclaration */ && declaration.parent.kind === 216 /* ModuleDeclaration */) { + while (declaration.kind === 218 /* ModuleDeclaration */ && declaration.parent.kind === 218 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -42588,9 +43330,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (declaration.name.kind === 136 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 164 /* PropertyAccessExpression */) { + if (expr.kind === 166 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -42600,7 +43342,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 /* Identifier */ || + if (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -42610,9 +43352,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -42632,60 +43374,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: - case 216 /* ModuleDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 228 /* ExportSpecifier */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 153 /* TypeLiteral */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: + case 218 /* ModuleDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 230 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 155 /* TypeLiteral */: addDeclaration(node); // fall through - case 142 /* Constructor */: - case 191 /* VariableStatement */: - case 210 /* VariableDeclarationList */: - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 217 /* ModuleBlock */: + case 144 /* Constructor */: + case 193 /* VariableStatement */: + case 212 /* VariableDeclarationList */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 219 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 136 /* Parameter */: + case 138 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 245 /* EnumMember */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 247 /* EnumMember */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: addDeclaration(node); break; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -42697,7 +43439,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -42724,6 +43466,12 @@ var ts; HighlightSpanKind.reference = "reference"; HighlightSpanKind.writtenReference = "writtenReference"; })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(ts.IndentStyle || (ts.IndentStyle = {})); + var IndentStyle = ts.IndentStyle; (function (SymbolDisplayPartKind) { SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; @@ -42901,16 +43649,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 171 /* FunctionExpression */) { + if (declaration.kind === 173 /* FunctionExpression */) { return true; } - if (declaration.kind !== 209 /* VariableDeclaration */ && declaration.kind !== 211 /* FunctionDeclaration */) { + if (declaration.kind !== 211 /* VariableDeclaration */ && declaration.kind !== 213 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { // Reached source file or module block - if (parent_8.kind === 246 /* SourceFile */ || parent_8.kind === 217 /* ModuleBlock */) { + if (parent_8.kind === 248 /* SourceFile */ || parent_8.kind === 219 /* ModuleBlock */) { return false; } } @@ -43047,8 +43795,8 @@ var ts; // We are not doing a full typecheck, we are not resolving the whole context, // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; - // Parse - var inputFileName = transpileOptions.fileName || "module.ts"; + // if jsx is specified then treat file as .tsx + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; @@ -43260,8 +44008,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -43295,9 +44044,207 @@ var ts; end: pos + importPath.length }); } - function processImport() { + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122 /* DeclareKeyword */) { + // declare module "mod" + token = scanner.scan(); + if (token === 125 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + else if (token === 24 /* CommaToken */) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + return true; + } + } + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 116 /* AsKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82 /* ExportKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17 /* OpenParenToken */) { + return true; + } + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // looks like define ("modname", ... - skip string literal and comma + token = scanner.scan(); + if (token === 24 /* CommaToken */) { + token = scanner.scan(); + } + else { + // unexpected token + return true; + } + } + // should be start of dependency list + if (token !== 19 /* OpenBracketToken */) { + return true; + } + // skip open bracket + token = scanner.scan(); + var i = 0; + // scan until ']' or EOF + while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + // record string literals as module names + if (token === 9 /* StringLiteral */) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { scanner.setText(sourceText); - var token = scanner.scan(); + scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -43309,152 +44256,26 @@ var ts; // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") - while (token !== 1 /* EndOfFileToken */) { - if (token === 120 /* DeclareKeyword */) { - // declare module "mod" - token = scanner.scan(); - if (token === 123 /* ModuleKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - recordAmbientExternalModule(); - continue; - } - } + // (for JavaScript files) require("mod") + while (true) { + if (scanner.getToken() === 1 /* EndOfFileToken */) { + break; } - else if (token === 87 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import "mod"; - recordModuleName(); - continue; - } - else { - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import d from "mod"; - recordModuleName(); - continue; - } - } - else if (token === 55 /* EqualsToken */) { - token = scanner.scan(); - if (token === 125 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import i = require("mod"); - recordModuleName(); - continue; - } - } - } - } - else if (token === 24 /* CommaToken */) { - // consume comma and keep going - token = scanner.scan(); - } - else { - // unknown syntax - continue; - } - } - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 114 /* AsKeyword */) { - token = scanner.scan(); - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + continue; } - else if (token === 80 /* ExportKeyword */) { - token = scanner.scan(); - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === 87 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 55 /* EqualsToken */) { - token = scanner.scan(); - if (token === 125 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export import i = require("mod"); - recordModuleName(); - } - } - } - } - } - } + else { + scanner.scan(); } - token = scanner.scan(); } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -43463,7 +44284,7 @@ var ts; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 205 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 207 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -43471,13 +44292,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 67 /* Identifier */ && - (node.parent.kind === 201 /* BreakStatement */ || node.parent.kind === 200 /* ContinueStatement */) && + return node.kind === 69 /* Identifier */ && + (node.parent.kind === 203 /* BreakStatement */ || node.parent.kind === 202 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 67 /* Identifier */ && - node.parent.kind === 205 /* LabeledStatement */ && + return node.kind === 69 /* Identifier */ && + node.parent.kind === 207 /* LabeledStatement */ && node.parent.label === node; } /** @@ -43485,7 +44306,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 205 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 207 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -43496,49 +44317,49 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 216 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 218 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { - return (node.kind === 67 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 243 /* PropertyAssignment */ || node.parent.kind === 244 /* ShorthandPropertyAssignment */) && node.parent.name === node; + return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + (node.parent.kind === 245 /* PropertyAssignment */ || node.parent.kind === 246 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 245 /* EnumMember */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 216 /* ModuleDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 247 /* EnumMember */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 218 /* ModuleDeclaration */: return node.parent.name === node; - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -43597,7 +44418,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 68 /* FirstKeyword */; i <= 132 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 134 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -43612,17 +44433,17 @@ var ts; return undefined; } switch (node.kind) { - case 246 /* SourceFile */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 216 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 218 /* ModuleDeclaration */: return node; } } @@ -43630,38 +44451,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 216 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 212 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 213 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 214 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 215 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 209 /* VariableDeclaration */: + case 218 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 214 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 215 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 216 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 217 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 211 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 211 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 143 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 144 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 145 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 146 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 147 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 146 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 145 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 142 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 135 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 245 /* EnumMember */: return ScriptElementKind.variableElement; - case 136 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 221 /* ImportClause */: - case 228 /* ExportSpecifier */: - case 222 /* NamespaceImport */: + case 149 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 148 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 147 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 247 /* EnumMember */: return ScriptElementKind.variableElement; + case 138 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 223 /* ImportClause */: + case 230 /* ExportSpecifier */: + case 224 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -43885,7 +44706,7 @@ var ts; // For JavaScript files, we don't want to report the normal typescript semantic errors. // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. @@ -43907,44 +44728,44 @@ var ts; return false; } switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 241 /* HeritageClause */: + case 243 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 104 /* ImplementsKeyword */) { + if (heritageClause.token === 106 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 211 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -43952,20 +44773,20 @@ var ts; return true; } break; - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -43973,7 +44794,7 @@ var ts; return true; } break; - case 136 /* Parameter */: + case 138 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -43989,17 +44810,17 @@ var ts; return true; } break; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 137 /* Decorator */: + case 139 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -44025,18 +44846,18 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 120 /* DeclareKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 122 /* DeclareKeyword */: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; // These are all legal modifiers. - case 111 /* StaticKeyword */: - case 80 /* ExportKeyword */: - case 72 /* ConstKeyword */: - case 75 /* DefaultKeyword */: - case 113 /* AbstractKeyword */: + case 113 /* StaticKeyword */: + case 82 /* ExportKeyword */: + case 74 /* ConstKeyword */: + case 77 /* DefaultKeyword */: + case 115 /* AbstractKeyword */: } } } @@ -44097,7 +44918,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -44122,9 +44943,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 267 /* JSDocTypeTag */: - case 265 /* JSDocParameterTag */: - case 266 /* JSDocReturnTag */: + case 269 /* JSDocTypeTag */: + case 267 /* JSDocParameterTag */: + case 268 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -44161,6 +44982,7 @@ var ts; var node = currentToken; var isRightOfDot = false; var isRightOfOpenTag = false; + var isStartingCloseTag = false; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { // Bail out if this is a known invalid completion location @@ -44170,11 +44992,11 @@ var ts; } var parent_9 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_9.kind === 164 /* PropertyAccessExpression */) { + if (parent_9.kind === 166 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 133 /* QualifiedName */) { + else if (parent_9.kind === 135 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -44184,9 +45006,14 @@ var ts; return undefined; } } - else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { - isRightOfOpenTag = true; - location = contextToken; + else if (sourceFile.languageVariant === 1 /* JSX */) { + if (kind === 25 /* LessThanToken */) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) { + isStartingCloseTag = true; + } } } var semanticStart = new Date().getTime(); @@ -44207,6 +45034,12 @@ var ts; isMemberCompletion = true; isNewIdentifierLocation = false; } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + symbols = [typeChecker.getSymbolAtLocation(tagName)]; + isMemberCompletion = true; + isNewIdentifierLocation = false; + } else { // For JavaScript or TypeScript, if we're not after a dot, then just try to get the // global symbols in scope. These results should be valid for either language as @@ -44221,7 +45054,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -44277,7 +45110,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 232 /* JsxSelfClosingElement */) || (jsxContainer.kind === 233 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 234 /* JsxSelfClosingElement */) || (jsxContainer.kind === 235 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -44343,49 +45176,64 @@ var ts; var start = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || isSolelyIdentifierDefinitionLocation(contextToken) || - isDotOfNumericLiteral(contextToken); + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } + function isInJsxText(contextToken) { + if (contextToken.kind === 236 /* JsxText */) { + return true; + } + if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { + if (contextToken.parent.kind === 235 /* JsxOpeningElement */) { + return true; + } + if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */; + } + } + return false; + } function isNewIdentifierDefinitionLocation(previousToken) { if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 166 /* CallExpression */ // func( a, | - || containingNodeKind === 142 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 167 /* NewExpression */ // new C(a, | - || containingNodeKind === 162 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 179 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 150 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 168 /* CallExpression */ // func( a, | + || containingNodeKind === 144 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 169 /* NewExpression */ // new C(a, | + || containingNodeKind === 164 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 181 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 152 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 166 /* CallExpression */ // func( | - || containingNodeKind === 142 /* Constructor */ // constructor( | - || containingNodeKind === 167 /* NewExpression */ // new C(a| - || containingNodeKind === 170 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 158 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 168 /* CallExpression */ // func( | + || containingNodeKind === 144 /* Constructor */ // constructor( | + || containingNodeKind === 169 /* NewExpression */ // new C(a| + || containingNodeKind === 172 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 160 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 162 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 147 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 134 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 123 /* ModuleKeyword */: // module | - case 124 /* NamespaceKeyword */: + return containingNodeKind === 164 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 149 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 136 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 125 /* ModuleKeyword */: // module | + case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 216 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 218 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 212 /* ClassDeclaration */; // class A{ | - case 55 /* EqualsToken */: - return containingNodeKind === 209 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 179 /* BinaryExpression */; // x = a| + return containingNodeKind === 214 /* ClassDeclaration */; // class A{ | + case 56 /* EqualsToken */: + return containingNodeKind === 211 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 181 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 181 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 183 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 188 /* TemplateSpan */; // `aa ${10} dd ${| - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - return containingNodeKind === 139 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 190 /* TemplateSpan */; // `aa ${10} dd ${| + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + return containingNodeKind === 141 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -44428,14 +45276,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 163 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 165 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 159 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 161 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -44481,9 +45329,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 223 /* NamedImports */ ? - 220 /* ImportDeclaration */ : - 226 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 225 /* NamedImports */ ? + 222 /* ImportDeclaration */ : + 228 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -44509,7 +45357,7 @@ var ts; case 15 /* OpenBraceToken */: // let x = { | case 24 /* CommaToken */: var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 163 /* ObjectLiteralExpression */ || parent_10.kind === 159 /* ObjectBindingPattern */)) { + if (parent_10 && (parent_10.kind === 165 /* ObjectLiteralExpression */ || parent_10.kind === 161 /* ObjectBindingPattern */)) { return parent_10; } break; @@ -44527,8 +45375,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 223 /* NamedImports */: - case 227 /* NamedExports */: + case 225 /* NamedImports */: + case 229 /* NamedExports */: return contextToken.parent; } } @@ -44540,30 +45388,33 @@ var ts; var parent_11 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: - case 38 /* SlashToken */: - case 67 /* Identifier */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - if (parent_11 && (parent_11.kind === 232 /* JsxSelfClosingElement */ || parent_11.kind === 233 /* JsxOpeningElement */)) { + case 39 /* SlashToken */: + case 69 /* Identifier */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + if (parent_11 && (parent_11.kind === 234 /* JsxSelfClosingElement */ || parent_11.kind === 235 /* JsxOpeningElement */)) { return parent_11; } + else if (parent_11.kind === 238 /* JsxAttribute */) { + return parent_11.parent; + } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_11 && ((parent_11.kind === 236 /* JsxAttribute */) || (parent_11.kind === 237 /* JsxSpreadAttribute */))) { + if (parent_11 && ((parent_11.kind === 238 /* JsxAttribute */) || (parent_11.kind === 239 /* JsxSpreadAttribute */))) { return parent_11.parent; } break; case 16 /* CloseBraceToken */: if (parent_11 && - parent_11.kind === 238 /* JsxExpression */ && + parent_11.kind === 240 /* JsxExpression */ && parent_11.parent && - (parent_11.parent.kind === 236 /* JsxAttribute */)) { + (parent_11.parent.kind === 238 /* JsxAttribute */)) { return parent_11.parent.parent; } - if (parent_11 && parent_11.kind === 237 /* JsxSpreadAttribute */) { + if (parent_11 && parent_11.kind === 239 /* JsxSpreadAttribute */) { return parent_11.parent; } break; @@ -44573,16 +45424,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return true; } return false; @@ -44594,78 +45445,84 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 209 /* VariableDeclaration */ || - containingNodeKind === 210 /* VariableDeclarationList */ || - containingNodeKind === 191 /* VariableStatement */ || - containingNodeKind === 215 /* EnumDeclaration */ || + return containingNodeKind === 211 /* VariableDeclaration */ || + containingNodeKind === 212 /* VariableDeclarationList */ || + containingNodeKind === 193 /* VariableStatement */ || + containingNodeKind === 217 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 212 /* ClassDeclaration */ || - containingNodeKind === 184 /* ClassExpression */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 160 /* ArrayBindingPattern */ || - containingNodeKind === 214 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 214 /* ClassDeclaration */ || + containingNodeKind === 186 /* ClassExpression */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* ArrayBindingPattern */ || + containingNodeKind === 216 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 160 /* ArrayBindingPattern */; // var [.| - case 53 /* ColonToken */: - return containingNodeKind === 161 /* BindingElement */; // var {x :html| + return containingNodeKind === 162 /* ArrayBindingPattern */; // var [.| + case 54 /* ColonToken */: + return containingNodeKind === 163 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 160 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 162 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 242 /* CatchClause */ || + return containingNodeKind === 244 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 215 /* EnumDeclaration */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 153 /* TypeLiteral */; // let x : { | + return containingNodeKind === 217 /* EnumDeclaration */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 155 /* TypeLiteral */; // let x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 138 /* PropertySignature */ && + return containingNodeKind === 140 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 213 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 153 /* TypeLiteral */); // let x : { a; | + (contextToken.parent.parent.kind === 215 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 155 /* TypeLiteral */); // let x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 212 /* ClassDeclaration */ || - containingNodeKind === 184 /* ClassExpression */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 214 /* TypeAliasDeclaration */ || + return containingNodeKind === 214 /* ClassDeclaration */ || + containingNodeKind === 186 /* ClassExpression */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 216 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); - case 111 /* StaticKeyword */: - return containingNodeKind === 139 /* PropertyDeclaration */; + case 113 /* StaticKeyword */: + return containingNodeKind === 141 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 136 /* Parameter */ || + return containingNodeKind === 138 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 160 /* ArrayBindingPattern */); // var [...z| - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - return containingNodeKind === 136 /* Parameter */; - case 114 /* AsKeyword */: - containingNodeKind === 224 /* ImportSpecifier */ || - containingNodeKind === 228 /* ExportSpecifier */ || - containingNodeKind === 222 /* NamespaceImport */; - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: - case 105 /* InterfaceKeyword */: - case 85 /* FunctionKeyword */: - case 100 /* VarKeyword */: - case 121 /* GetKeyword */: - case 127 /* SetKeyword */: - case 87 /* ImportKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: - case 112 /* YieldKeyword */: - case 130 /* TypeKeyword */: + contextToken.parent.parent.kind === 162 /* ArrayBindingPattern */); // var [...z| + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + return containingNodeKind === 138 /* Parameter */; + case 116 /* AsKeyword */: + return containingNodeKind === 226 /* ImportSpecifier */ || + containingNodeKind === 230 /* ExportSpecifier */ || + containingNodeKind === 224 /* NamespaceImport */; + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: + case 107 /* InterfaceKeyword */: + case 87 /* FunctionKeyword */: + case 102 /* VarKeyword */: + case 123 /* GetKeyword */: + case 129 /* SetKeyword */: + case 89 /* ImportKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: + case 114 /* YieldKeyword */: + case 132 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. switch (contextToken.getText()) { + case "abstract": + case "async": case "class": - case "interface": + case "const": + case "declare": case "enum": case "function": - case "var": - case "static": + case "interface": case "let": - case "const": + case "private": + case "protected": + case "public": + case "static": + case "var": case "yield": return true; } @@ -44695,8 +45552,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_31 = element.propertyName || element.name; - exisingImportsOrExports[name_31.text] = true; + var name_32 = element.propertyName || element.name; + exisingImportsOrExports[name_32.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -44717,9 +45574,9 @@ var ts; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 243 /* PropertyAssignment */ && - m.kind !== 244 /* ShorthandPropertyAssignment */ && - m.kind !== 161 /* BindingElement */) { + if (m.kind !== 245 /* PropertyAssignment */ && + m.kind !== 246 /* ShorthandPropertyAssignment */ && + m.kind !== 163 /* BindingElement */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -44727,7 +45584,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 161 /* BindingElement */ && m.propertyName) { + if (m.kind === 163 /* BindingElement */ && m.propertyName) { existingName = m.propertyName.text; } else { @@ -44754,7 +45611,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 236 /* JsxAttribute */) { + if (attr.kind === 238 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -44768,46 +45625,43 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_32 in nameTable) { - if (!allNames[name_32]) { - allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, /*performCharacterChecks:*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_33 in nameTable) { + if (!uniqueNames[name_33]) { + uniqueNames[name_33] = name_33; + var displayName = getCompletionEntryDisplayName(name_33, target, /*performCharacterChecks:*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -44845,25 +45699,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -44906,7 +45759,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -45008,7 +45861,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 164 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 166 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -45017,7 +45870,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 166 /* CallExpression */ || location.kind === 167 /* NewExpression */) { + if (location.kind === 168 /* CallExpression */ || location.kind === 169 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -45030,10 +45883,11 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 167 /* NewExpression */ || callExpression.expression.kind === 93 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 169 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); - if (!ts.contains(allSignatures, signature.target || signature)) { - // Get the first signature if there + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { + // Get the first signature if there is one -- allSignatures may contain + // either the original signature or its target, so check for either signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -45047,7 +45901,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -45063,10 +45917,10 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(53 /* ColonToken */)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536 /* Anonymous */)) { @@ -45082,24 +45936,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 119 /* ConstructorKeyword */ && location.parent.kind === 142 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 144 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 142 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 144 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 142 /* Constructor */) { + if (functionDeclaration.kind === 144 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -45108,7 +45962,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -45116,7 +45970,7 @@ var ts; } else { // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(71 /* ClassKeyword */)); + displayParts.push(ts.keywordPart(73 /* ClassKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -45124,37 +45978,37 @@ var ts; } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(105 /* InterfaceKeyword */)); + displayParts.push(ts.keywordPart(107 /* InterfaceKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384 /* Enum */) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(72 /* ConstKeyword */)); + displayParts.push(ts.keywordPart(74 /* ConstKeyword */)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(79 /* EnumKeyword */)); + displayParts.push(ts.keywordPart(81 /* EnumKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 216 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 67 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 124 /* NamespaceKeyword */ : 123 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 218 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -45166,7 +46020,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(88 /* InKeyword */)); + displayParts.push(ts.keywordPart(90 /* InKeyword */)); displayParts.push(ts.spacePart()); if (symbol.parent) { // Class/Interface type parameter @@ -45177,13 +46031,13 @@ var ts; // Method/function type parameter var container = ts.getContainingFunction(location); if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 146 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + if (signatureDeclaration.kind === 148 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 145 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 147 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -45192,8 +46046,8 @@ var ts; // Type aliash type parameter // For example // type list = T[]; // Both T will go through same code path - var declaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; - displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; + displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -45203,11 +46057,11 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 245 /* EnumMember */) { + if (declaration.kind === 247 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -45215,17 +46069,17 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(87 /* ImportKeyword */)); + displayParts.push(ts.keywordPart(89 /* ImportKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 219 /* ImportEqualsDeclaration */) { + if (declaration.kind === 221 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(125 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(127 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); @@ -45234,7 +46088,7 @@ var ts; var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -45251,7 +46105,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(53 /* ColonToken */)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { @@ -45351,11 +46205,11 @@ var ts; if (!symbol) { // Try getting just type at this position and show switch (node.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -45408,7 +46262,7 @@ var ts; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (isNewExpressionTarget(location) || location.kind === 119 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 121 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { // Find the first class-like declaration and try to get the construct signature. for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { @@ -45433,8 +46287,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 142 /* Constructor */) || - (!selectConstructors && (d.kind === 211 /* FunctionDeclaration */ || d.kind === 141 /* MethodDeclaration */ || d.kind === 140 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 144 /* Constructor */) || + (!selectConstructors && (d.kind === 213 /* FunctionDeclaration */ || d.kind === 143 /* MethodDeclaration */ || d.kind === 142 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -45494,7 +46348,7 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 67 /* Identifier */ && node.parent === declaration) { + if (node.kind === 69 /* Identifier */ && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -45503,7 +46357,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 244 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 246 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -45577,9 +46431,9 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 67 /* Identifier */ || - node.kind === 95 /* ThisKeyword */ || - node.kind === 93 /* SuperKeyword */ || + if (node.kind === 69 /* Identifier */ || + node.kind === 97 /* ThisKeyword */ || + node.kind === 95 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); @@ -45630,77 +46484,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 86 /* IfKeyword */: - case 78 /* ElseKeyword */: - if (hasKind(node.parent, 194 /* IfStatement */)) { + case 88 /* IfKeyword */: + case 80 /* ElseKeyword */: + if (hasKind(node.parent, 196 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; - case 92 /* ReturnKeyword */: - if (hasKind(node.parent, 202 /* ReturnStatement */)) { + case 94 /* ReturnKeyword */: + if (hasKind(node.parent, 204 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; - case 96 /* ThrowKeyword */: - if (hasKind(node.parent, 206 /* ThrowStatement */)) { + case 98 /* ThrowKeyword */: + if (hasKind(node.parent, 208 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; - case 70 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 207 /* TryStatement */)) { + case 72 /* CatchKeyword */: + if (hasKind(parent(parent(node)), 209 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 98 /* TryKeyword */: - case 83 /* FinallyKeyword */: - if (hasKind(parent(node), 207 /* TryStatement */)) { + case 100 /* TryKeyword */: + case 85 /* FinallyKeyword */: + if (hasKind(parent(node), 209 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; - case 94 /* SwitchKeyword */: - if (hasKind(node.parent, 204 /* SwitchStatement */)) { + case 96 /* SwitchKeyword */: + if (hasKind(node.parent, 206 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 69 /* CaseKeyword */: - case 75 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 204 /* SwitchStatement */)) { + case 71 /* CaseKeyword */: + case 77 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 206 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 68 /* BreakKeyword */: - case 73 /* ContinueKeyword */: - if (hasKind(node.parent, 201 /* BreakStatement */) || hasKind(node.parent, 200 /* ContinueStatement */)) { + case 70 /* BreakKeyword */: + case 75 /* ContinueKeyword */: + if (hasKind(node.parent, 203 /* BreakStatement */) || hasKind(node.parent, 202 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 84 /* ForKeyword */: - if (hasKind(node.parent, 197 /* ForStatement */) || - hasKind(node.parent, 198 /* ForInStatement */) || - hasKind(node.parent, 199 /* ForOfStatement */)) { + case 86 /* ForKeyword */: + if (hasKind(node.parent, 199 /* ForStatement */) || + hasKind(node.parent, 200 /* ForInStatement */) || + hasKind(node.parent, 201 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 102 /* WhileKeyword */: - case 77 /* DoKeyword */: - if (hasKind(node.parent, 196 /* WhileStatement */) || hasKind(node.parent, 195 /* DoStatement */)) { + case 104 /* WhileKeyword */: + case 79 /* DoKeyword */: + if (hasKind(node.parent, 198 /* WhileStatement */) || hasKind(node.parent, 197 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 119 /* ConstructorKeyword */: - if (hasKind(node.parent, 142 /* Constructor */)) { + case 121 /* ConstructorKeyword */: + if (hasKind(node.parent, 144 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; - case 121 /* GetKeyword */: - case 127 /* SetKeyword */: - if (hasKind(node.parent, 143 /* GetAccessor */) || hasKind(node.parent, 144 /* SetAccessor */)) { + case 123 /* GetKeyword */: + case 129 /* SetKeyword */: + if (hasKind(node.parent, 145 /* GetAccessor */) || hasKind(node.parent, 146 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 191 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 193 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -45716,10 +46570,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 206 /* ThrowStatement */) { + if (node.kind === 208 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 207 /* TryStatement */) { + else if (node.kind === 209 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -45748,12 +46602,12 @@ var ts; var child = throwStatement; while (child.parent) { var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246 /* SourceFile */) { + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248 /* SourceFile */) { return parent_12; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_12.kind === 207 /* TryStatement */) { + if (parent_12.kind === 209 /* TryStatement */) { var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -45768,7 +46622,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 201 /* BreakStatement */ || node.kind === 200 /* ContinueStatement */) { + if (node.kind === 203 /* BreakStatement */ || node.kind === 202 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -45784,16 +46638,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 204 /* SwitchStatement */: - if (statement.kind === 200 /* ContinueStatement */) { + case 206 /* SwitchStatement */: + if (statement.kind === 202 /* ContinueStatement */) { continue; } // Fall through. - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: - case 195 /* DoStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 197 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -45812,24 +46666,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 212 /* ClassDeclaration */ || - container.kind === 184 /* ClassExpression */ || - (declaration.kind === 136 /* Parameter */ && hasKind(container, 142 /* Constructor */)))) { + if (!(container.kind === 214 /* ClassDeclaration */ || + container.kind === 186 /* ClassExpression */ || + (declaration.kind === 138 /* Parameter */ && hasKind(container, 144 /* Constructor */)))) { return undefined; } } - else if (modifier === 111 /* StaticKeyword */) { - if (!(container.kind === 212 /* ClassDeclaration */ || container.kind === 184 /* ClassExpression */)) { + else if (modifier === 113 /* StaticKeyword */) { + if (!(container.kind === 214 /* ClassDeclaration */ || container.kind === 186 /* ClassExpression */)) { return undefined; } } - else if (modifier === 80 /* ExportKeyword */ || modifier === 120 /* DeclareKeyword */) { - if (!(container.kind === 217 /* ModuleBlock */ || container.kind === 246 /* SourceFile */)) { + else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { + if (!(container.kind === 219 /* ModuleBlock */ || container.kind === 248 /* SourceFile */)) { return undefined; } } - else if (modifier === 113 /* AbstractKeyword */) { - if (!(container.kind === 212 /* ClassDeclaration */ || declaration.kind === 212 /* ClassDeclaration */)) { + else if (modifier === 115 /* AbstractKeyword */) { + if (!(container.kind === 214 /* ClassDeclaration */ || declaration.kind === 214 /* ClassDeclaration */)) { return undefined; } } @@ -45841,8 +46695,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 217 /* ModuleBlock */: - case 246 /* SourceFile */: + case 219 /* ModuleBlock */: + case 248 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 256 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -45851,17 +46705,17 @@ var ts; nodes = container.statements; } break; - case 142 /* Constructor */: + case 144 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 142 /* Constructor */ && member; + return member.kind === 144 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -45882,19 +46736,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 110 /* PublicKeyword */: + case 112 /* PublicKeyword */: return 16 /* Public */; - case 108 /* PrivateKeyword */: + case 110 /* PrivateKeyword */: return 32 /* Private */; - case 109 /* ProtectedKeyword */: + case 111 /* ProtectedKeyword */: return 64 /* Protected */; - case 111 /* StaticKeyword */: + case 113 /* StaticKeyword */: return 128 /* Static */; - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: return 1 /* Export */; - case 120 /* DeclareKeyword */: + case 122 /* DeclareKeyword */: return 2 /* Ambient */; - case 113 /* AbstractKeyword */: + case 115 /* AbstractKeyword */: return 256 /* Abstract */; default: ts.Debug.fail(); @@ -45914,13 +46768,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 144 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 145 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 146 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121 /* GetKeyword */, 127 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 129 /* SetKeyword */); }); } } } @@ -45929,19 +46783,19 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 119 /* ConstructorKeyword */); + return pushKeywordIf(keywords, token, 121 /* ConstructorKeyword */); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84 /* ForKeyword */, 102 /* WhileKeyword */, 77 /* DoKeyword */)) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86 /* ForKeyword */, 104 /* WhileKeyword */, 79 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 195 /* DoStatement */) { + if (loopNode.kind === 197 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 102 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { break; } } @@ -45950,7 +46804,7 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */, 73 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */, 75 /* ContinueKeyword */); } }); return ts.map(keywords, getHighlightSpanForNode); @@ -45959,13 +46813,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -45973,14 +46827,14 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 94 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 96 /* SwitchKeyword */); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 69 /* CaseKeyword */, 75 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 71 /* CaseKeyword */, 77 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */); } }); }); @@ -45988,13 +46842,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 98 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 100 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 83 /* FinallyKeyword */); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 85 /* FinallyKeyword */); } return ts.map(keywords, getHighlightSpanForNode); } @@ -46005,13 +46859,13 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); }); // If the "owner" is a function, then we equate 'return' and 'throw' statements in their // ability to "jump out" of the function, and include occurrences for both. if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); }); } return ts.map(keywords, getHighlightSpanForNode); @@ -46019,36 +46873,36 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 190 /* Block */))) { + if (!(func && hasKind(func.body, 192 /* Block */))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); }); // Include 'throw' statements that do not occur within a try block. ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 194 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 196 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 86 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 88 /* IfKeyword */); // Generally the 'else' keyword is second-to-last, so we traverse backwards. for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 78 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 80 /* ElseKeyword */)) { break; } } - if (!hasKind(ifStatement.elseStatement, 194 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 196 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -46057,7 +46911,7 @@ var ts; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 78 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 80 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. var shouldCombindElseAndIf = true; @@ -46139,7 +46993,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 67 /* Identifier */ && + if (node.kind !== 69 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. //node.kind !== SyntaxKind.ThisKeyword && //node.kind !== SyntaxKind.SuperKeyword && @@ -46147,7 +47001,7 @@ var ts; !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -46165,10 +47019,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 95 /* ThisKeyword */) { + if (node.kind === 97 /* ThisKeyword */) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 93 /* SuperKeyword */) { + if (node.kind === 95 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -46228,7 +47082,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 228 /* ExportSpecifier */; + return declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 230 /* ExportSpecifier */; }); } function getInternedName(symbol, location, declarations) { @@ -46255,14 +47109,14 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 171 /* FunctionExpression */ || valueDeclaration.kind === 184 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 173 /* FunctionExpression */ || valueDeclaration.kind === 186 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 212 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -46288,7 +47142,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -46359,7 +47213,7 @@ var ts; if (node) { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: return node.getWidth() === searchSymbolName.length; case 9 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || @@ -46461,13 +47315,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -46480,7 +47334,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 93 /* SuperKeyword */) { + if (!node || node.kind !== 95 /* SuperKeyword */) { return; } var container = ts.getSuperContainer(node, /*includeFunctions*/ false); @@ -46499,27 +47353,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 246 /* SourceFile */: + case 248 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -46528,7 +47382,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 246 /* SourceFile */) { + if (searchSpaceNode.kind === 248 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -46554,33 +47408,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 95 /* ThisKeyword */) { + if (!node || node.kind !== 97 /* ThisKeyword */) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 246 /* SourceFile */: - if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { + case 248 /* SourceFile */: + if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -46634,11 +47488,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 212 /* ClassDeclaration */) { + if (declaration.kind === 214 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 213 /* InterfaceDeclaration */) { + else if (declaration.kind === 215 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -46699,19 +47553,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_33 = node.text; + var name_34 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_33); + var unionProperty = contextualType.getProperty(name_34); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_33); + var symbol = t.getProperty(name_34); if (symbol) { result_4.push(symbol); } @@ -46720,7 +47574,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_33); + var symbol_1 = contextualType.getProperty(name_34); if (symbol_1) { return [symbol_1]; } @@ -46773,17 +47627,17 @@ var ts; } /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node) { - if (node.kind === 67 /* Identifier */ && ts.isDeclarationName(node)) { + if (node.kind === 69 /* Identifier */ && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 178 /* PostfixUnaryExpression */ || parent.kind === 177 /* PrefixUnaryExpression */) { + if (parent.kind === 180 /* PostfixUnaryExpression */ || parent.kind === 179 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 179 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 181 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; - return 55 /* FirstAssignment */ <= operator && operator <= 66 /* LastAssignment */; + return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } } return false; @@ -46815,33 +47669,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 136 /* Parameter */: - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: - case 245 /* EnumMember */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 242 /* CatchClause */: + case 138 /* Parameter */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: + case 247 /* EnumMember */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 244 /* CatchClause */: return 1 /* Value */; - case 135 /* TypeParameter */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 153 /* TypeLiteral */: + case 137 /* TypeParameter */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 155 /* TypeLiteral */: return 2 /* Type */; - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (node.name.kind === 9 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } @@ -46851,15 +47705,15 @@ var ts; else { return 4 /* Namespace */; } - case 223 /* NamedImports */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 220 /* ImportDeclaration */: - case 225 /* ExportAssignment */: - case 226 /* ExportDeclaration */: + case 225 /* NamedImports */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 222 /* ImportDeclaration */: + case 227 /* ExportAssignment */: + case 228 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 246 /* SourceFile */: + case 248 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -46869,8 +47723,9 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 149 /* TypeReference */ || - (node.parent.kind === 186 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 151 /* TypeReference */ || + (node.parent.kind === 188 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -46878,50 +47733,50 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 164 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 164 /* PropertyAccessExpression */) { + if (root.parent.kind === 166 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 166 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 186 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 241 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 188 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 243 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 212 /* ClassDeclaration */ && root.parent.parent.token === 104 /* ImplementsKeyword */) || - (decl.kind === 213 /* InterfaceDeclaration */ && root.parent.parent.token === 81 /* ExtendsKeyword */); + return (decl.kind === 214 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 215 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 133 /* QualifiedName */) { - while (root.parent && root.parent.kind === 133 /* QualifiedName */) { + if (root.parent.kind === 135 /* QualifiedName */) { + while (root.parent && root.parent.kind === 135 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 149 /* TypeReference */ && !isLastClause; + return root.parent.kind === 151 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 133 /* QualifiedName */) { + while (node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 67 /* Identifier */); + ts.Debug.assert(node.kind === 69 /* Identifier */); // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 133 /* QualifiedName */ && + if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 219 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 221 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 225 /* ExportAssignment */) { + if (node.parent.kind === 227 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -46961,15 +47816,15 @@ var ts; return; } switch (node.kind) { - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: case 9 /* StringLiteral */: - case 82 /* FalseKeyword */: - case 97 /* TrueKeyword */: - case 91 /* NullKeyword */: - case 93 /* SuperKeyword */: - case 95 /* ThisKeyword */: - case 67 /* Identifier */: + case 84 /* FalseKeyword */: + case 99 /* TrueKeyword */: + case 93 /* NullKeyword */: + case 95 /* SuperKeyword */: + case 97 /* ThisKeyword */: + case 69 /* Identifier */: break; // Cant create the text span default: @@ -46985,7 +47840,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 216 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 218 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -47026,10 +47881,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -47083,7 +47938,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 216 /* ModuleDeclaration */ && + return declaration.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -47093,7 +47948,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 67 /* Identifier */ && !ts.nodeIsMissing(node)) { + if (kind === 69 /* Identifier */ && !ts.nodeIsMissing(node)) { var identifier = node; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run @@ -47238,16 +48093,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 265 /* JSDocParameterTag */: + case 267 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 268 /* JSDocTemplateTag */: + case 270 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 267 /* JSDocTypeTag */: + case 269 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 266 /* JSDocReturnTag */: + case 268 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -47336,18 +48191,18 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 55 /* EqualsToken */) { + if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 209 /* VariableDeclaration */ || - token.parent.kind === 139 /* PropertyDeclaration */ || - token.parent.kind === 136 /* Parameter */) { + if (token.parent.kind === 211 /* VariableDeclaration */ || + token.parent.kind === 141 /* PropertyDeclaration */ || + token.parent.kind === 138 /* Parameter */) { return 5 /* operator */; } } - if (token.parent.kind === 179 /* BinaryExpression */ || - token.parent.kind === 177 /* PrefixUnaryExpression */ || - token.parent.kind === 178 /* PostfixUnaryExpression */ || - token.parent.kind === 180 /* ConditionalExpression */) { + if (token.parent.kind === 181 /* BinaryExpression */ || + token.parent.kind === 179 /* PrefixUnaryExpression */ || + token.parent.kind === 180 /* PostfixUnaryExpression */ || + token.parent.kind === 182 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -47367,35 +48222,35 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 67 /* Identifier */) { + else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 136 /* Parameter */: + case 138 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -47507,8 +48362,12 @@ var ts; * Checks if position points to a valid position to add JSDoc comments, and if so, * returns the appropriate template. Otherwise returns an empty string. * Valid positions are - * - outside of comments, statements, and expressions, and - * - preceding a function declaration. + * - outside of comments, statements, and expressions, and + * - preceding a: + * - function/constructor/method declaration + * - class declarations + * - variable statements + * - namespace declarations * * Hosts should ideally check that: * - The line is all whitespace up to 'position' before performing the insertion. @@ -47532,23 +48391,48 @@ var ts; return undefined; } // TODO: add support for: - // - methods - // - constructors - // - class decls - var containingFunction = ts.getAncestor(tokenAtPos, 211 /* FunctionDeclaration */); - if (!containingFunction || containingFunction.getStart() < position) { + // - enums/enum members + // - interfaces + // - property declarations + // - potentially property assignments + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 144 /* Constructor */: + case 214 /* ClassDeclaration */: + case 193 /* VariableStatement */: + break findOwner; + case 248 /* SourceFile */: + return undefined; + case 218 /* ModuleDeclaration */: + // If in walking up the tree, we hit a a nested namespace declaration, + // then we must be somewhere within a dotted namespace name; however we don't + // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. + if (commentOwner.parent.kind === 218 /* ModuleDeclaration */) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { return undefined; } - var parameters = containingFunction.parameters; + var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); // TODO: call a helper method instead once PR #4133 gets merged in. var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; - var docParams = parameters.reduce(function (prev, cur, index) { - return prev + - indentationStr + " * @param " + (cur.name.kind === 67 /* Identifier */ ? cur.name.text : "param" + index) + newLine; - }, ""); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 69 /* Identifier */ ? + currentName.text : + "param" + i; + docParams += indentationStr + " * @param " + paramName + newLine; + } // A doc comment consists of the following // * The opening comment line // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) @@ -47564,6 +48448,46 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 193 /* VariableStatement */) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return emptyArray; + } + /** + * Digs into an an initializer or RHS operand of an assignment operation + * to get the parameters of an apt signature corresponding to a + * function expression or a class expression. + * + * @param rightHandSide the expression which may contain an appropriate set of parameters + * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. + */ + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 172 /* ParenthesizedExpression */) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + return rightHandSide.parameters; + case 186 /* ClassExpression */: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 144 /* Constructor */) { + return member.parameters; + } + } + break; + } + return emptyArray; + } function getTodoComments(fileName, descriptors) { // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call @@ -47694,7 +48618,7 @@ var ts; var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 67 /* Identifier */) { + if (node && node.kind === 69 /* Identifier */) { var symbol = typeChecker.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol) { @@ -47795,7 +48719,7 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: nameTable[node.text] = node.text; break; case 9 /* StringLiteral */: @@ -47805,7 +48729,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 230 /* ExternalModuleReference */ || + node.parent.kind === 232 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -47818,7 +48742,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 165 /* ElementAccessExpression */ && + node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -47829,18 +48753,18 @@ var ts; /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. var noRegexTable = []; - noRegexTable[67 /* Identifier */] = true; + noRegexTable[69 /* Identifier */] = true; noRegexTable[9 /* StringLiteral */] = true; noRegexTable[8 /* NumericLiteral */] = true; noRegexTable[10 /* RegularExpressionLiteral */] = true; - noRegexTable[95 /* ThisKeyword */] = true; - noRegexTable[40 /* PlusPlusToken */] = true; - noRegexTable[41 /* MinusMinusToken */] = true; + noRegexTable[97 /* ThisKeyword */] = true; + noRegexTable[41 /* PlusPlusToken */] = true; + noRegexTable[42 /* MinusMinusToken */] = true; noRegexTable[18 /* CloseParenToken */] = true; noRegexTable[20 /* CloseBracketToken */] = true; noRegexTable[16 /* CloseBraceToken */] = true; - noRegexTable[97 /* TrueKeyword */] = true; - noRegexTable[82 /* FalseKeyword */] = true; + noRegexTable[99 /* TrueKeyword */] = true; + noRegexTable[84 /* FalseKeyword */] = true; // Just a stack of TemplateHeads and OpenCurlyBraces, used to perform rudimentary (inexact) // classification on template strings. Because of the context free nature of templates, // the only precise way to classify a template portion would be by propagating the stack across @@ -47865,10 +48789,10 @@ var ts; /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 121 /* GetKeyword */ || - keyword2 === 127 /* SetKeyword */ || - keyword2 === 119 /* ConstructorKeyword */ || - keyword2 === 111 /* StaticKeyword */) { + if (keyword2 === 123 /* GetKeyword */ || + keyword2 === 129 /* SetKeyword */ || + keyword2 === 121 /* ConstructorKeyword */ || + keyword2 === 113 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; @@ -47998,22 +48922,22 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if ((token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { if (scanner.reScanSlashToken() === 10 /* RegularExpressionLiteral */) { token = 10 /* RegularExpressionLiteral */; } } else if (lastNonTriviaToken === 21 /* DotToken */ && isKeyword(token)) { - token = 67 /* Identifier */; + token = 69 /* Identifier */; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { // We have two keywords in a row. Only treat the second as a keyword if // it's a sequence that could legally occur in the language. Otherwise // treat it as an identifier. This way, if someone writes "private var" // we recognize that 'var' is actually an identifier here. - token = 67 /* Identifier */; + token = 69 /* Identifier */; } - else if (lastNonTriviaToken === 67 /* Identifier */ && + else if (lastNonTriviaToken === 69 /* Identifier */ && token === 25 /* LessThanToken */) { // Could be the start of something generic. Keep track of that by bumping // up the current count of generic contexts we may be in. @@ -48024,16 +48948,16 @@ var ts; // generic entity is complete. angleBracketStack--; } - else if (token === 115 /* AnyKeyword */ || - token === 128 /* StringKeyword */ || - token === 126 /* NumberKeyword */ || - token === 118 /* BooleanKeyword */ || - token === 129 /* SymbolKeyword */) { + else if (token === 117 /* AnyKeyword */ || + token === 130 /* StringKeyword */ || + token === 128 /* NumberKeyword */ || + token === 120 /* BooleanKeyword */ || + token === 131 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, // causing a noisy experience for the user. - token = 67 /* Identifier */; + token = 69 /* Identifier */; } } else if (token === 12 /* TemplateHead */) { @@ -48145,40 +49069,41 @@ var ts; function isBinaryExpressionOperatorToken(token) { switch (token) { case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: case 35 /* PlusToken */: case 36 /* MinusToken */: - case 42 /* LessThanLessThanToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* LessThanLessThanToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: case 25 /* LessThanToken */: case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - case 89 /* InstanceOfKeyword */: - case 88 /* InKeyword */: + case 91 /* InstanceOfKeyword */: + case 90 /* InKeyword */: + case 116 /* AsKeyword */: case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - case 45 /* AmpersandToken */: - case 47 /* CaretToken */: - case 46 /* BarToken */: - case 50 /* AmpersandAmpersandToken */: - case 51 /* BarBarToken */: - case 65 /* BarEqualsToken */: - case 64 /* AmpersandEqualsToken */: - case 66 /* CaretEqualsToken */: - case 61 /* LessThanLessThanEqualsToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 56 /* PlusEqualsToken */: - case 57 /* MinusEqualsToken */: - case 58 /* AsteriskEqualsToken */: - case 59 /* SlashEqualsToken */: - case 60 /* PercentEqualsToken */: - case 55 /* EqualsToken */: + case 46 /* AmpersandToken */: + case 48 /* CaretToken */: + case 47 /* BarToken */: + case 51 /* AmpersandAmpersandToken */: + case 52 /* BarBarToken */: + case 67 /* BarEqualsToken */: + case 66 /* AmpersandEqualsToken */: + case 68 /* CaretEqualsToken */: + case 63 /* LessThanLessThanEqualsToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 57 /* PlusEqualsToken */: + case 58 /* MinusEqualsToken */: + case 59 /* AsteriskEqualsToken */: + case 61 /* SlashEqualsToken */: + case 62 /* PercentEqualsToken */: + case 56 /* EqualsToken */: case 24 /* CommaToken */: return true; default: @@ -48189,17 +49114,17 @@ var ts; switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: return true; default: return false; } } function isKeyword(token) { - return token >= 68 /* FirstKeyword */ && token <= 132 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 134 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -48208,7 +49133,7 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; } - else if (token >= 15 /* FirstPunctuation */ && token <= 66 /* LastPunctuation */) { + else if (token >= 15 /* FirstPunctuation */ && token <= 68 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { @@ -48225,7 +49150,7 @@ var ts; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 67 /* Identifier */: + case 69 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -48257,7 +49182,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 246 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 248 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -48327,125 +49252,125 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 197 /* ForStatement */) { + if (node.parent.kind === 199 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 179 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { + if (node.parent.kind === 181 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node) { + if (node.parent.kind === 174 /* ArrowFunction */ && node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 209 /* VariableDeclaration */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 211 /* VariableDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return spanInVariableDeclaration(node); - case 136 /* Parameter */: + case 138 /* Parameter */: return spanInParameterDeclaration(node); - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 217 /* ModuleBlock */: + case 219 /* ModuleBlock */: return spanInBlock(node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return spanInBlock(node.block); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 195 /* DoStatement */: + case 197 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 208 /* DebuggerStatement */: + case 210 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 194 /* IfStatement */: + case 196 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return spanInForStatement(node); - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 207 /* TryStatement */: + case 209 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: // span on complete node return textSpan(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -48461,25 +49386,25 @@ var ts; return spanInOpenParenToken(node); case 18 /* CloseParenToken */: return spanInCloseParenToken(node); - case 53 /* ColonToken */: + case 54 /* ColonToken */: return spanInColonToken(node); case 27 /* GreaterThanToken */: case 25 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 102 /* WhileKeyword */: + case 104 /* WhileKeyword */: return spanInWhileKeyword(node); - case 78 /* ElseKeyword */: - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 80 /* ElseKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 243 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 245 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 169 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 171 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -48492,12 +49417,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 198 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 200 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -48551,7 +49476,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 212 /* ClassDeclaration */ && functionDeclaration.kind !== 142 /* Constructor */); + (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -48574,18 +49499,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 196 /* WhileStatement */: - case 194 /* IfStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 196 /* IfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 197 /* ForStatement */: + case 199 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -48593,7 +49518,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 210 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 212 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -48613,13 +49538,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -48627,25 +49552,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 217 /* ModuleBlock */: + case 219 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 215 /* EnumDeclaration */: - case 212 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 242 /* CatchClause */: + case 244 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -48659,7 +49584,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -48669,17 +49594,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 196 /* WhileStatement */: - case 195 /* DoStatement */: - case 197 /* ForStatement */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 198 /* WhileStatement */: + case 197 /* DoStatement */: + case 199 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -48690,19 +49615,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 243 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 245 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 169 /* TypeAssertionExpression */) { + if (node.parent.kind === 171 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -49339,7 +50264,8 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + // for now treat files as JavaScript + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); var convertResult = { referencedFiles: [], importedFiles: [], diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 761ce39d418..8e6c6a553a5 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -68,253 +68,255 @@ declare namespace ts { PlusToken = 35, MinusToken = 36, AsteriskToken = 37, - SlashToken = 38, - PercentToken = 39, - PlusPlusToken = 40, - MinusMinusToken = 41, - LessThanLessThanToken = 42, - GreaterThanGreaterThanToken = 43, - GreaterThanGreaterThanGreaterThanToken = 44, - AmpersandToken = 45, - BarToken = 46, - CaretToken = 47, - ExclamationToken = 48, - TildeToken = 49, - AmpersandAmpersandToken = 50, - BarBarToken = 51, - QuestionToken = 52, - ColonToken = 53, - AtToken = 54, - EqualsToken = 55, - PlusEqualsToken = 56, - MinusEqualsToken = 57, - AsteriskEqualsToken = 58, - SlashEqualsToken = 59, - PercentEqualsToken = 60, - LessThanLessThanEqualsToken = 61, - GreaterThanGreaterThanEqualsToken = 62, - GreaterThanGreaterThanGreaterThanEqualsToken = 63, - AmpersandEqualsToken = 64, - BarEqualsToken = 65, - CaretEqualsToken = 66, - Identifier = 67, - BreakKeyword = 68, - CaseKeyword = 69, - CatchKeyword = 70, - ClassKeyword = 71, - ConstKeyword = 72, - ContinueKeyword = 73, - DebuggerKeyword = 74, - DefaultKeyword = 75, - DeleteKeyword = 76, - DoKeyword = 77, - ElseKeyword = 78, - EnumKeyword = 79, - ExportKeyword = 80, - ExtendsKeyword = 81, - FalseKeyword = 82, - FinallyKeyword = 83, - ForKeyword = 84, - FunctionKeyword = 85, - IfKeyword = 86, - ImportKeyword = 87, - InKeyword = 88, - InstanceOfKeyword = 89, - NewKeyword = 90, - NullKeyword = 91, - ReturnKeyword = 92, - SuperKeyword = 93, - SwitchKeyword = 94, - ThisKeyword = 95, - ThrowKeyword = 96, - TrueKeyword = 97, - TryKeyword = 98, - TypeOfKeyword = 99, - VarKeyword = 100, - VoidKeyword = 101, - WhileKeyword = 102, - WithKeyword = 103, - ImplementsKeyword = 104, - InterfaceKeyword = 105, - LetKeyword = 106, - PackageKeyword = 107, - PrivateKeyword = 108, - ProtectedKeyword = 109, - PublicKeyword = 110, - StaticKeyword = 111, - YieldKeyword = 112, - AbstractKeyword = 113, - AsKeyword = 114, - AnyKeyword = 115, - AsyncKeyword = 116, - AwaitKeyword = 117, - BooleanKeyword = 118, - ConstructorKeyword = 119, - DeclareKeyword = 120, - GetKeyword = 121, - IsKeyword = 122, - ModuleKeyword = 123, - NamespaceKeyword = 124, - RequireKeyword = 125, - NumberKeyword = 126, - SetKeyword = 127, - StringKeyword = 128, - SymbolKeyword = 129, - TypeKeyword = 130, - FromKeyword = 131, - OfKeyword = 132, - QualifiedName = 133, - ComputedPropertyName = 134, - TypeParameter = 135, - Parameter = 136, - Decorator = 137, - PropertySignature = 138, - PropertyDeclaration = 139, - MethodSignature = 140, - MethodDeclaration = 141, - Constructor = 142, - GetAccessor = 143, - SetAccessor = 144, - CallSignature = 145, - ConstructSignature = 146, - IndexSignature = 147, - TypePredicate = 148, - TypeReference = 149, - FunctionType = 150, - ConstructorType = 151, - TypeQuery = 152, - TypeLiteral = 153, - ArrayType = 154, - TupleType = 155, - UnionType = 156, - IntersectionType = 157, - ParenthesizedType = 158, - ObjectBindingPattern = 159, - ArrayBindingPattern = 160, - BindingElement = 161, - ArrayLiteralExpression = 162, - ObjectLiteralExpression = 163, - PropertyAccessExpression = 164, - ElementAccessExpression = 165, - CallExpression = 166, - NewExpression = 167, - TaggedTemplateExpression = 168, - TypeAssertionExpression = 169, - ParenthesizedExpression = 170, - FunctionExpression = 171, - ArrowFunction = 172, - DeleteExpression = 173, - TypeOfExpression = 174, - VoidExpression = 175, - AwaitExpression = 176, - PrefixUnaryExpression = 177, - PostfixUnaryExpression = 178, - BinaryExpression = 179, - ConditionalExpression = 180, - TemplateExpression = 181, - YieldExpression = 182, - SpreadElementExpression = 183, - ClassExpression = 184, - OmittedExpression = 185, - ExpressionWithTypeArguments = 186, - AsExpression = 187, - TemplateSpan = 188, - SemicolonClassElement = 189, - Block = 190, - VariableStatement = 191, - EmptyStatement = 192, - ExpressionStatement = 193, - IfStatement = 194, - DoStatement = 195, - WhileStatement = 196, - ForStatement = 197, - ForInStatement = 198, - ForOfStatement = 199, - ContinueStatement = 200, - BreakStatement = 201, - ReturnStatement = 202, - WithStatement = 203, - SwitchStatement = 204, - LabeledStatement = 205, - ThrowStatement = 206, - TryStatement = 207, - DebuggerStatement = 208, - VariableDeclaration = 209, - VariableDeclarationList = 210, - FunctionDeclaration = 211, - ClassDeclaration = 212, - InterfaceDeclaration = 213, - TypeAliasDeclaration = 214, - EnumDeclaration = 215, - ModuleDeclaration = 216, - ModuleBlock = 217, - CaseBlock = 218, - ImportEqualsDeclaration = 219, - ImportDeclaration = 220, - ImportClause = 221, - NamespaceImport = 222, - NamedImports = 223, - ImportSpecifier = 224, - ExportAssignment = 225, - ExportDeclaration = 226, - NamedExports = 227, - ExportSpecifier = 228, - MissingDeclaration = 229, - ExternalModuleReference = 230, - JsxElement = 231, - JsxSelfClosingElement = 232, - JsxOpeningElement = 233, - JsxText = 234, - JsxClosingElement = 235, - JsxAttribute = 236, - JsxSpreadAttribute = 237, - JsxExpression = 238, - CaseClause = 239, - DefaultClause = 240, - HeritageClause = 241, - CatchClause = 242, - PropertyAssignment = 243, - ShorthandPropertyAssignment = 244, - EnumMember = 245, - SourceFile = 246, - JSDocTypeExpression = 247, - JSDocAllType = 248, - JSDocUnknownType = 249, - JSDocArrayType = 250, - JSDocUnionType = 251, - JSDocTupleType = 252, - JSDocNullableType = 253, - JSDocNonNullableType = 254, - JSDocRecordType = 255, - JSDocRecordMember = 256, - JSDocTypeReference = 257, - JSDocOptionalType = 258, - JSDocFunctionType = 259, - JSDocVariadicType = 260, - JSDocConstructorType = 261, - JSDocThisType = 262, - JSDocComment = 263, - JSDocTag = 264, - JSDocParameterTag = 265, - JSDocReturnTag = 266, - JSDocTypeTag = 267, - JSDocTemplateTag = 268, - SyntaxList = 269, - Count = 270, - FirstAssignment = 55, - LastAssignment = 66, - FirstReservedWord = 68, - LastReservedWord = 103, - FirstKeyword = 68, - LastKeyword = 132, - FirstFutureReservedWord = 104, - LastFutureReservedWord = 112, - FirstTypeNode = 149, - LastTypeNode = 158, + AsteriskAsteriskToken = 38, + SlashToken = 39, + PercentToken = 40, + PlusPlusToken = 41, + MinusMinusToken = 42, + LessThanLessThanToken = 43, + GreaterThanGreaterThanToken = 44, + GreaterThanGreaterThanGreaterThanToken = 45, + AmpersandToken = 46, + BarToken = 47, + CaretToken = 48, + ExclamationToken = 49, + TildeToken = 50, + AmpersandAmpersandToken = 51, + BarBarToken = 52, + QuestionToken = 53, + ColonToken = 54, + AtToken = 55, + EqualsToken = 56, + PlusEqualsToken = 57, + MinusEqualsToken = 58, + AsteriskEqualsToken = 59, + AsteriskAsteriskEqualsToken = 60, + SlashEqualsToken = 61, + PercentEqualsToken = 62, + LessThanLessThanEqualsToken = 63, + GreaterThanGreaterThanEqualsToken = 64, + GreaterThanGreaterThanGreaterThanEqualsToken = 65, + AmpersandEqualsToken = 66, + BarEqualsToken = 67, + CaretEqualsToken = 68, + Identifier = 69, + BreakKeyword = 70, + CaseKeyword = 71, + CatchKeyword = 72, + ClassKeyword = 73, + ConstKeyword = 74, + ContinueKeyword = 75, + DebuggerKeyword = 76, + DefaultKeyword = 77, + DeleteKeyword = 78, + DoKeyword = 79, + ElseKeyword = 80, + EnumKeyword = 81, + ExportKeyword = 82, + ExtendsKeyword = 83, + FalseKeyword = 84, + FinallyKeyword = 85, + ForKeyword = 86, + FunctionKeyword = 87, + IfKeyword = 88, + ImportKeyword = 89, + InKeyword = 90, + InstanceOfKeyword = 91, + NewKeyword = 92, + NullKeyword = 93, + ReturnKeyword = 94, + SuperKeyword = 95, + SwitchKeyword = 96, + ThisKeyword = 97, + ThrowKeyword = 98, + TrueKeyword = 99, + TryKeyword = 100, + TypeOfKeyword = 101, + VarKeyword = 102, + VoidKeyword = 103, + WhileKeyword = 104, + WithKeyword = 105, + ImplementsKeyword = 106, + InterfaceKeyword = 107, + LetKeyword = 108, + PackageKeyword = 109, + PrivateKeyword = 110, + ProtectedKeyword = 111, + PublicKeyword = 112, + StaticKeyword = 113, + YieldKeyword = 114, + AbstractKeyword = 115, + AsKeyword = 116, + AnyKeyword = 117, + AsyncKeyword = 118, + AwaitKeyword = 119, + BooleanKeyword = 120, + ConstructorKeyword = 121, + DeclareKeyword = 122, + GetKeyword = 123, + IsKeyword = 124, + ModuleKeyword = 125, + NamespaceKeyword = 126, + RequireKeyword = 127, + NumberKeyword = 128, + SetKeyword = 129, + StringKeyword = 130, + SymbolKeyword = 131, + TypeKeyword = 132, + FromKeyword = 133, + OfKeyword = 134, + QualifiedName = 135, + ComputedPropertyName = 136, + TypeParameter = 137, + Parameter = 138, + Decorator = 139, + PropertySignature = 140, + PropertyDeclaration = 141, + MethodSignature = 142, + MethodDeclaration = 143, + Constructor = 144, + GetAccessor = 145, + SetAccessor = 146, + CallSignature = 147, + ConstructSignature = 148, + IndexSignature = 149, + TypePredicate = 150, + TypeReference = 151, + FunctionType = 152, + ConstructorType = 153, + TypeQuery = 154, + TypeLiteral = 155, + ArrayType = 156, + TupleType = 157, + UnionType = 158, + IntersectionType = 159, + ParenthesizedType = 160, + ObjectBindingPattern = 161, + ArrayBindingPattern = 162, + BindingElement = 163, + ArrayLiteralExpression = 164, + ObjectLiteralExpression = 165, + PropertyAccessExpression = 166, + ElementAccessExpression = 167, + CallExpression = 168, + NewExpression = 169, + TaggedTemplateExpression = 170, + TypeAssertionExpression = 171, + ParenthesizedExpression = 172, + FunctionExpression = 173, + ArrowFunction = 174, + DeleteExpression = 175, + TypeOfExpression = 176, + VoidExpression = 177, + AwaitExpression = 178, + PrefixUnaryExpression = 179, + PostfixUnaryExpression = 180, + BinaryExpression = 181, + ConditionalExpression = 182, + TemplateExpression = 183, + YieldExpression = 184, + SpreadElementExpression = 185, + ClassExpression = 186, + OmittedExpression = 187, + ExpressionWithTypeArguments = 188, + AsExpression = 189, + TemplateSpan = 190, + SemicolonClassElement = 191, + Block = 192, + VariableStatement = 193, + EmptyStatement = 194, + ExpressionStatement = 195, + IfStatement = 196, + DoStatement = 197, + WhileStatement = 198, + ForStatement = 199, + ForInStatement = 200, + ForOfStatement = 201, + ContinueStatement = 202, + BreakStatement = 203, + ReturnStatement = 204, + WithStatement = 205, + SwitchStatement = 206, + LabeledStatement = 207, + ThrowStatement = 208, + TryStatement = 209, + DebuggerStatement = 210, + VariableDeclaration = 211, + VariableDeclarationList = 212, + FunctionDeclaration = 213, + ClassDeclaration = 214, + InterfaceDeclaration = 215, + TypeAliasDeclaration = 216, + EnumDeclaration = 217, + ModuleDeclaration = 218, + ModuleBlock = 219, + CaseBlock = 220, + ImportEqualsDeclaration = 221, + ImportDeclaration = 222, + ImportClause = 223, + NamespaceImport = 224, + NamedImports = 225, + ImportSpecifier = 226, + ExportAssignment = 227, + ExportDeclaration = 228, + NamedExports = 229, + ExportSpecifier = 230, + MissingDeclaration = 231, + ExternalModuleReference = 232, + JsxElement = 233, + JsxSelfClosingElement = 234, + JsxOpeningElement = 235, + JsxText = 236, + JsxClosingElement = 237, + JsxAttribute = 238, + JsxSpreadAttribute = 239, + JsxExpression = 240, + CaseClause = 241, + DefaultClause = 242, + HeritageClause = 243, + CatchClause = 244, + PropertyAssignment = 245, + ShorthandPropertyAssignment = 246, + EnumMember = 247, + SourceFile = 248, + JSDocTypeExpression = 249, + JSDocAllType = 250, + JSDocUnknownType = 251, + JSDocArrayType = 252, + JSDocUnionType = 253, + JSDocTupleType = 254, + JSDocNullableType = 255, + JSDocNonNullableType = 256, + JSDocRecordType = 257, + JSDocRecordMember = 258, + JSDocTypeReference = 259, + JSDocOptionalType = 260, + JSDocFunctionType = 261, + JSDocVariadicType = 262, + JSDocConstructorType = 263, + JSDocThisType = 264, + JSDocComment = 265, + JSDocTag = 266, + JSDocParameterTag = 267, + JSDocReturnTag = 268, + JSDocTypeTag = 269, + JSDocTemplateTag = 270, + SyntaxList = 271, + Count = 272, + FirstAssignment = 56, + LastAssignment = 68, + FirstReservedWord = 70, + LastReservedWord = 105, + FirstKeyword = 70, + LastKeyword = 134, + FirstFutureReservedWord = 106, + LastFutureReservedWord = 114, + FirstTypeNode = 151, + LastTypeNode = 160, FirstPunctuation = 15, - LastPunctuation = 66, + LastPunctuation = 68, FirstToken = 0, - LastToken = 132, + LastToken = 134, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -322,8 +324,8 @@ declare namespace ts { FirstTemplateToken = 11, LastTemplateToken = 14, FirstBinaryOperator = 25, - LastBinaryOperator = 66, - FirstNode = 133, + LastBinaryOperator = 68, + FirstNode = 135, } const enum NodeFlags { Export = 1, @@ -343,6 +345,7 @@ declare namespace ts { OctalLiteral = 65536, Namespace = 131072, ExportContext = 262144, + ContainsThis = 524288, Modifier = 2035, AccessibilityModifier = 112, BlockScoped = 49152, @@ -438,6 +441,8 @@ declare namespace ts { interface ShorthandPropertyAssignment extends ObjectLiteralElement { name: Identifier; questionToken?: Node; + equalsToken?: Node; + objectAssignmentInitializer?: Expression; } interface VariableLikeDeclaration extends Declaration { propertyName?: Identifier; @@ -530,18 +535,21 @@ declare namespace ts { interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } - interface PrefixUnaryExpression extends UnaryExpression { + interface IncrementExpression extends UnaryExpression { + _incrementExpressionBrand: any; + } + interface PrefixUnaryExpression extends IncrementExpression { operator: SyntaxKind; operand: UnaryExpression; } - interface PostfixUnaryExpression extends PostfixExpression { + interface PostfixUnaryExpression extends IncrementExpression { operand: LeftHandSideExpression; operator: SyntaxKind; } interface PostfixExpression extends UnaryExpression { _postfixExpressionBrand: any; } - interface LeftHandSideExpression extends PostfixExpression { + interface LeftHandSideExpression extends IncrementExpression { _leftHandSideExpressionBrand: any; } interface MemberExpression extends LeftHandSideExpression { @@ -566,7 +574,7 @@ declare namespace ts { asteriskToken?: Node; expression?: Expression; } - interface BinaryExpression extends Expression { + interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -610,7 +618,7 @@ declare namespace ts { interface ObjectLiteralExpression extends PrimaryExpression, Declaration { properties: NodeArray; } - interface PropertyAccessExpression extends MemberExpression { + interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; dotToken: Node; name: Identifier; @@ -1082,6 +1090,7 @@ declare namespace ts { decreaseIndent(): void; clear(): void; trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + reportInaccessibleThisError(): void; } const enum TypeFormatFlags { None = 0, @@ -1202,6 +1211,7 @@ declare namespace ts { Instantiated = 131072, ObjectLiteral = 524288, ESSymbol = 16777216, + ThisType = 33554432, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1223,6 +1233,7 @@ declare namespace ts { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; + thisType: TypeParameter; } interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; @@ -1337,7 +1348,6 @@ declare namespace ts { watch?: boolean; isolatedModules?: boolean; experimentalDecorators?: boolean; - experimentalAsyncFunctions?: boolean; emitDecoratorMetadata?: boolean; moduleResolution?: ModuleResolutionKind; [option: string]: string | number | boolean; @@ -1348,6 +1358,7 @@ declare namespace ts { AMD = 2, UMD = 3, System = 4, + ES6 = 5, } const enum JsxEmit { None = 0, @@ -1417,7 +1428,7 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: (path: string) => void): FileWatcher; + watchFile?(path: string, callback: (path: string, removed: boolean) => void): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; directoryExists(path: string): boolean; @@ -1775,6 +1786,12 @@ declare namespace ts { TabSize: number; NewLineCharacter: string; ConvertTabsToSpaces: boolean; + IndentStyle: IndentStyle; + } + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, } interface FormatCodeOptions extends EditorOptions { InsertSpaceAfterCommaDelimiter: boolean; @@ -2132,7 +2149,7 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; /** diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index a1f9651570e..d261ce125fc 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -62,279 +62,281 @@ var ts; SyntaxKind[SyntaxKind["PlusToken"] = 35] = "PlusToken"; SyntaxKind[SyntaxKind["MinusToken"] = 36] = "MinusToken"; SyntaxKind[SyntaxKind["AsteriskToken"] = 37] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 38] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 39] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 40] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 41] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 42] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 45] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 46] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 47] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 48] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 49] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 50] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 51] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 52] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 53] = "ColonToken"; - SyntaxKind[SyntaxKind["AtToken"] = 54] = "AtToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 38] = "AsteriskAsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 39] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 40] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 41] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 42] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 43] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 46] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 47] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 48] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 49] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 50] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 51] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 52] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 53] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 54] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 55] = "AtToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 55] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 56] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 57] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 58] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 59] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 60] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 61] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 63] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 64] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 65] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 66] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 56] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 57] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 58] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 59] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 60] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 61] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 62] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 63] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 64] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 66] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 67] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 68] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 67] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 69] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 68] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 69] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 70] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 71] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 72] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 73] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 74] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 75] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 76] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 77] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 78] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 79] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 80] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 81] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 82] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 83] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 84] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 85] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 86] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 87] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 88] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 89] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 90] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 91] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 92] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 93] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 94] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 95] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 96] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 97] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 98] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 99] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 100] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 101] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 102] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 103] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 70] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 71] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 72] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 73] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 74] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 75] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 76] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 77] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 78] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 79] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 80] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 81] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 82] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 83] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 84] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 85] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 86] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 87] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 88] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 89] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 90] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 91] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 92] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 93] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 94] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 95] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 96] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 97] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 98] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 99] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 100] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 101] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 102] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 103] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 104] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 105] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 104] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 105] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 106] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 107] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 108] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 109] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 110] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 111] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 112] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 106] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 107] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 108] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 109] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 110] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 111] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 112] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 113] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 114] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 113] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 114] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 115] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 116] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 117] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 118] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 119] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 120] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 121] = "GetKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 122] = "IsKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 123] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 124] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 125] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 126] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 127] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 128] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 129] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 130] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 131] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 132] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 115] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 116] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 117] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 118] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 119] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 120] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 121] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 122] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 123] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 124] = "IsKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 125] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 126] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 127] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 128] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 129] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 130] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 131] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 132] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 133] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 134] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 133] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 134] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 135] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 136] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 135] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 136] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 137] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 137] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 138] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 139] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 138] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 139] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 140] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 141] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 142] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 143] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 144] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 145] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 146] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 147] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 140] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 141] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 142] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 143] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 144] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 145] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 146] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 148] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 149] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 150] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 151] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 152] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 153] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 154] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 155] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 156] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 157] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 158] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 150] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 151] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 152] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 153] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 154] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 155] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 156] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 157] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 158] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 159] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 160] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 159] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 160] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 161] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 161] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 162] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 163] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 162] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 163] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 164] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 165] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 166] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 167] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 168] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 169] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 170] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 171] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 172] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 173] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 174] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 175] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 176] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 177] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 178] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 179] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 180] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 181] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 182] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 183] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 184] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 185] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 186] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 187] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 164] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 165] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 166] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 167] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 168] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 169] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 170] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 171] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 172] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 173] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 174] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 175] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 176] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 177] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 178] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 179] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 180] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 181] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 182] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 183] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 184] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 185] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 186] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 188] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 189] = "AsExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 188] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 189] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 190] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 191] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 190] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 191] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 192] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 193] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 194] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 195] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 196] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 197] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 198] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 199] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 200] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 201] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 202] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 203] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 204] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 205] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 206] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 207] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 208] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 209] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 210] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 211] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 212] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 213] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 214] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 215] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 216] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 217] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 218] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 219] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 220] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 221] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 222] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 223] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 224] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 225] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 226] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 227] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 228] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 229] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 192] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 193] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 194] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 195] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 196] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 197] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 198] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 199] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 200] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 201] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 202] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 203] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 204] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 205] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 206] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 207] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 208] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 209] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 210] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 211] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 212] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 213] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 214] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 215] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 216] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 217] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 218] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 219] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 220] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 221] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 222] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 223] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 224] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 225] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 226] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 227] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 228] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 229] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 230] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 231] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 230] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 232] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 231] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 232] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 233] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 234] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 235] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 236] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 237] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 238] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 233] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 234] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 235] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 236] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 237] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 238] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 239] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 240] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 239] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 240] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 241] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 242] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 241] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 242] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 243] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 244] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 243] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 244] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 245] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 246] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 245] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 247] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 246] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 248] = "SourceFile"; // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 247] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 249] = "JSDocTypeExpression"; // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 248] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 250] = "JSDocAllType"; // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 249] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 250] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 251] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 252] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 253] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 254] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 255] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 256] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 257] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 258] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 259] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 260] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 261] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 262] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 263] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 264] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 265] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 266] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 267] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 268] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 251] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 252] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 253] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 254] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 255] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 256] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 257] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 258] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 259] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 260] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 261] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 262] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 263] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 264] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 265] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 266] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 267] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 268] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 269] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 270] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 269] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 271] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 270] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 272] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 55] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 66] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 68] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 103] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 68] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 132] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 104] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 112] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 149] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 158] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 56] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 68] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 70] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 105] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 70] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 134] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 151] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 160] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 66] = "LastPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 132] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 134] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -342,8 +344,8 @@ var ts; SyntaxKind[SyntaxKind["FirstTemplateToken"] = 11] = "FirstTemplateToken"; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; - SyntaxKind[SyntaxKind["LastBinaryOperator"] = 66] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 133] = "FirstNode"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 135] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -364,6 +366,7 @@ var ts; NodeFlags[NodeFlags["OctalLiteral"] = 65536] = "OctalLiteral"; NodeFlags[NodeFlags["Namespace"] = 131072] = "Namespace"; NodeFlags[NodeFlags["ExportContext"] = 262144] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 524288] = "ContainsThis"; NodeFlags[NodeFlags["Modifier"] = 2035] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 49152] = "BlockScoped"; @@ -613,6 +616,7 @@ var ts; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; + TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ @@ -655,6 +659,7 @@ var ts; ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; ModuleKind[ModuleKind["System"] = 4] = "System"; + ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; })(ts.ModuleKind || (ts.ModuleKind = {})); var ModuleKind = ts.ModuleKind; (function (JsxEmit) { @@ -1221,8 +1226,11 @@ var ts; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { - Debug.assert(!headChain.next); - headChain.next = tailChain; + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; @@ -1496,6 +1504,7 @@ var ts; * List of supported extensions in order of file resolution precedence. */ ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -1819,10 +1828,15 @@ var ts; close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { + // mtime.getTime() equals 0 if file was removed + if (curr.mtime.getTime() === 0) { + callback(fileName, /* removed */ true); + return; + } if (+curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, /* removed */ false); } }, resolvePath: function (path) { @@ -1925,7 +1939,7 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, @@ -2013,7 +2027,7 @@ var ts; Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -2031,10 +2045,9 @@ var ts; An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, @@ -2063,10 +2076,6 @@ var ts; An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -2077,6 +2086,10 @@ var ts; _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "'=' can only be used in an object literal property inside a destructuring assignment." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -2201,7 +2214,7 @@ var ts; In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, @@ -2289,6 +2302,9 @@ var ts; yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A module cannot have multiple default exports." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2389,7 +2405,7 @@ var ts; Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2401,7 +2417,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -2422,7 +2438,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -2443,7 +2459,6 @@ var ts; Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, @@ -2490,7 +2505,9 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } }; })(ts || (ts = {})); /// @@ -2499,75 +2516,75 @@ var ts; (function (ts) { /* @internal */ function tokenIsIdentifierOrKeyword(token) { - return token >= 67 /* Identifier */; + return token >= 69 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { - "abstract": 113 /* AbstractKeyword */, - "any": 115 /* AnyKeyword */, - "as": 114 /* AsKeyword */, - "boolean": 118 /* BooleanKeyword */, - "break": 68 /* BreakKeyword */, - "case": 69 /* CaseKeyword */, - "catch": 70 /* CatchKeyword */, - "class": 71 /* ClassKeyword */, - "continue": 73 /* ContinueKeyword */, - "const": 72 /* ConstKeyword */, - "constructor": 119 /* ConstructorKeyword */, - "debugger": 74 /* DebuggerKeyword */, - "declare": 120 /* DeclareKeyword */, - "default": 75 /* DefaultKeyword */, - "delete": 76 /* DeleteKeyword */, - "do": 77 /* DoKeyword */, - "else": 78 /* ElseKeyword */, - "enum": 79 /* EnumKeyword */, - "export": 80 /* ExportKeyword */, - "extends": 81 /* ExtendsKeyword */, - "false": 82 /* FalseKeyword */, - "finally": 83 /* FinallyKeyword */, - "for": 84 /* ForKeyword */, - "from": 131 /* FromKeyword */, - "function": 85 /* FunctionKeyword */, - "get": 121 /* GetKeyword */, - "if": 86 /* IfKeyword */, - "implements": 104 /* ImplementsKeyword */, - "import": 87 /* ImportKeyword */, - "in": 88 /* InKeyword */, - "instanceof": 89 /* InstanceOfKeyword */, - "interface": 105 /* InterfaceKeyword */, - "is": 122 /* IsKeyword */, - "let": 106 /* LetKeyword */, - "module": 123 /* ModuleKeyword */, - "namespace": 124 /* NamespaceKeyword */, - "new": 90 /* NewKeyword */, - "null": 91 /* NullKeyword */, - "number": 126 /* NumberKeyword */, - "package": 107 /* PackageKeyword */, - "private": 108 /* PrivateKeyword */, - "protected": 109 /* ProtectedKeyword */, - "public": 110 /* PublicKeyword */, - "require": 125 /* RequireKeyword */, - "return": 92 /* ReturnKeyword */, - "set": 127 /* SetKeyword */, - "static": 111 /* StaticKeyword */, - "string": 128 /* StringKeyword */, - "super": 93 /* SuperKeyword */, - "switch": 94 /* SwitchKeyword */, - "symbol": 129 /* SymbolKeyword */, - "this": 95 /* ThisKeyword */, - "throw": 96 /* ThrowKeyword */, - "true": 97 /* TrueKeyword */, - "try": 98 /* TryKeyword */, - "type": 130 /* TypeKeyword */, - "typeof": 99 /* TypeOfKeyword */, - "var": 100 /* VarKeyword */, - "void": 101 /* VoidKeyword */, - "while": 102 /* WhileKeyword */, - "with": 103 /* WithKeyword */, - "yield": 112 /* YieldKeyword */, - "async": 116 /* AsyncKeyword */, - "await": 117 /* AwaitKeyword */, - "of": 132 /* OfKeyword */, + "abstract": 115 /* AbstractKeyword */, + "any": 117 /* AnyKeyword */, + "as": 116 /* AsKeyword */, + "boolean": 120 /* BooleanKeyword */, + "break": 70 /* BreakKeyword */, + "case": 71 /* CaseKeyword */, + "catch": 72 /* CatchKeyword */, + "class": 73 /* ClassKeyword */, + "continue": 75 /* ContinueKeyword */, + "const": 74 /* ConstKeyword */, + "constructor": 121 /* ConstructorKeyword */, + "debugger": 76 /* DebuggerKeyword */, + "declare": 122 /* DeclareKeyword */, + "default": 77 /* DefaultKeyword */, + "delete": 78 /* DeleteKeyword */, + "do": 79 /* DoKeyword */, + "else": 80 /* ElseKeyword */, + "enum": 81 /* EnumKeyword */, + "export": 82 /* ExportKeyword */, + "extends": 83 /* ExtendsKeyword */, + "false": 84 /* FalseKeyword */, + "finally": 85 /* FinallyKeyword */, + "for": 86 /* ForKeyword */, + "from": 133 /* FromKeyword */, + "function": 87 /* FunctionKeyword */, + "get": 123 /* GetKeyword */, + "if": 88 /* IfKeyword */, + "implements": 106 /* ImplementsKeyword */, + "import": 89 /* ImportKeyword */, + "in": 90 /* InKeyword */, + "instanceof": 91 /* InstanceOfKeyword */, + "interface": 107 /* InterfaceKeyword */, + "is": 124 /* IsKeyword */, + "let": 108 /* LetKeyword */, + "module": 125 /* ModuleKeyword */, + "namespace": 126 /* NamespaceKeyword */, + "new": 92 /* NewKeyword */, + "null": 93 /* NullKeyword */, + "number": 128 /* NumberKeyword */, + "package": 109 /* PackageKeyword */, + "private": 110 /* PrivateKeyword */, + "protected": 111 /* ProtectedKeyword */, + "public": 112 /* PublicKeyword */, + "require": 127 /* RequireKeyword */, + "return": 94 /* ReturnKeyword */, + "set": 129 /* SetKeyword */, + "static": 113 /* StaticKeyword */, + "string": 130 /* StringKeyword */, + "super": 95 /* SuperKeyword */, + "switch": 96 /* SwitchKeyword */, + "symbol": 131 /* SymbolKeyword */, + "this": 97 /* ThisKeyword */, + "throw": 98 /* ThrowKeyword */, + "true": 99 /* TrueKeyword */, + "try": 100 /* TryKeyword */, + "type": 132 /* TypeKeyword */, + "typeof": 101 /* TypeOfKeyword */, + "var": 102 /* VarKeyword */, + "void": 103 /* VoidKeyword */, + "while": 104 /* WhileKeyword */, + "with": 105 /* WithKeyword */, + "yield": 114 /* YieldKeyword */, + "async": 118 /* AsyncKeyword */, + "await": 119 /* AwaitKeyword */, + "of": 134 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -2589,37 +2606,39 @@ var ts; "=>": 34 /* EqualsGreaterThanToken */, "+": 35 /* PlusToken */, "-": 36 /* MinusToken */, + "**": 38 /* AsteriskAsteriskToken */, "*": 37 /* AsteriskToken */, - "/": 38 /* SlashToken */, - "%": 39 /* PercentToken */, - "++": 40 /* PlusPlusToken */, - "--": 41 /* MinusMinusToken */, - "<<": 42 /* LessThanLessThanToken */, + "/": 39 /* SlashToken */, + "%": 40 /* PercentToken */, + "++": 41 /* PlusPlusToken */, + "--": 42 /* MinusMinusToken */, + "<<": 43 /* LessThanLessThanToken */, ">": 43 /* GreaterThanGreaterThanToken */, - ">>>": 44 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 45 /* AmpersandToken */, - "|": 46 /* BarToken */, - "^": 47 /* CaretToken */, - "!": 48 /* ExclamationToken */, - "~": 49 /* TildeToken */, - "&&": 50 /* AmpersandAmpersandToken */, - "||": 51 /* BarBarToken */, - "?": 52 /* QuestionToken */, - ":": 53 /* ColonToken */, - "=": 55 /* EqualsToken */, - "+=": 56 /* PlusEqualsToken */, - "-=": 57 /* MinusEqualsToken */, - "*=": 58 /* AsteriskEqualsToken */, - "/=": 59 /* SlashEqualsToken */, - "%=": 60 /* PercentEqualsToken */, - "<<=": 61 /* LessThanLessThanEqualsToken */, - ">>=": 62 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 64 /* AmpersandEqualsToken */, - "|=": 65 /* BarEqualsToken */, - "^=": 66 /* CaretEqualsToken */, - "@": 54 /* AtToken */ + ">>": 44 /* GreaterThanGreaterThanToken */, + ">>>": 45 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 46 /* AmpersandToken */, + "|": 47 /* BarToken */, + "^": 48 /* CaretToken */, + "!": 49 /* ExclamationToken */, + "~": 50 /* TildeToken */, + "&&": 51 /* AmpersandAmpersandToken */, + "||": 52 /* BarBarToken */, + "?": 53 /* QuestionToken */, + ":": 54 /* ColonToken */, + "=": 56 /* EqualsToken */, + "+=": 57 /* PlusEqualsToken */, + "-=": 58 /* MinusEqualsToken */, + "*=": 59 /* AsteriskEqualsToken */, + "**=": 60 /* AsteriskAsteriskEqualsToken */, + "/=": 61 /* SlashEqualsToken */, + "%=": 62 /* PercentEqualsToken */, + "<<=": 63 /* LessThanLessThanEqualsToken */, + ">>=": 64 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 66 /* AmpersandEqualsToken */, + "|=": 67 /* BarEqualsToken */, + "^=": 68 /* CaretEqualsToken */, + "@": 55 /* AtToken */ }; /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers @@ -3123,8 +3142,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 67 /* Identifier */ || token > 103 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 68 /* FirstReservedWord */ && token <= 103 /* LastReservedWord */; }, + isIdentifier: function () { return token === 69 /* Identifier */ || token > 105 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 70 /* FirstReservedWord */ && token <= 105 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -3146,16 +3165,6 @@ var ts; onError(message, length || 0); } } - function isIdentifierStart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || - ch === 36 /* $ */ || ch === 95 /* _ */ || - ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || - ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || - ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } function scanNumber() { var start = pos; while (isDigit(text.charCodeAt(pos))) @@ -3438,12 +3447,12 @@ var ts; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { + if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92 /* backslash */) { ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); @@ -3468,7 +3477,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 67 /* Identifier */; + return token = 69 /* Identifier */; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -3552,7 +3561,7 @@ var ts; } return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 48 /* ExclamationToken */; + return pos++, token = 49 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); @@ -3561,42 +3570,48 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 60 /* PercentEqualsToken */; + return pos += 2, token = 62 /* PercentEqualsToken */; } - return pos++, token = 39 /* PercentToken */; + return pos++, token = 40 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 50 /* AmpersandAmpersandToken */; + return pos += 2, token = 51 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* AmpersandEqualsToken */; + return pos += 2, token = 66 /* AmpersandEqualsToken */; } - return pos++, token = 45 /* AmpersandToken */; + return pos++, token = 46 /* AmpersandToken */; case 40 /* openParen */: return pos++, token = 17 /* OpenParenToken */; case 41 /* closeParen */: return pos++, token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* AsteriskEqualsToken */; + return pos += 2, token = 59 /* AsteriskEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 60 /* AsteriskAsteriskEqualsToken */; + } + return pos += 2, token = 38 /* AsteriskAsteriskToken */; } return pos++, token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 40 /* PlusPlusToken */; + return pos += 2, token = 41 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* PlusEqualsToken */; + return pos += 2, token = 57 /* PlusEqualsToken */; } return pos++, token = 35 /* PlusToken */; case 44 /* comma */: return pos++, token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 41 /* MinusMinusToken */; + return pos += 2, token = 42 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* MinusEqualsToken */; + return pos += 2, token = 58 /* MinusEqualsToken */; } return pos++, token = 36 /* MinusToken */; case 46 /* dot */: @@ -3653,9 +3668,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* SlashEqualsToken */; + return pos += 2, token = 61 /* SlashEqualsToken */; } - return pos++, token = 38 /* SlashToken */; + return pos++, token = 39 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3707,7 +3722,7 @@ var ts; tokenValue = "" + scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 53 /* ColonToken */; + return pos++, token = 54 /* ColonToken */; case 59 /* semicolon */: return pos++, token = 23 /* SemicolonToken */; case 60 /* lessThan */: @@ -3722,14 +3737,16 @@ var ts; } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 61 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 63 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 42 /* LessThanLessThanToken */; + return pos += 2, token = 43 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 28 /* LessThanEqualsToken */; } - if (text.charCodeAt(pos + 1) === 47 /* slash */ && languageVariant === 1 /* JSX */) { + if (languageVariant === 1 /* JSX */ && + text.charCodeAt(pos + 1) === 47 /* slash */ && + text.charCodeAt(pos + 2) !== 42 /* asterisk */) { return pos += 2, token = 26 /* LessThanSlashToken */; } return pos++, token = 25 /* LessThanToken */; @@ -3752,7 +3769,7 @@ var ts; if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 55 /* EqualsToken */; + return pos++, token = 56 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3765,35 +3782,35 @@ var ts; } return pos++, token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 52 /* QuestionToken */; + return pos++, token = 53 /* QuestionToken */; case 91 /* openBracket */: return pos++, token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: return pos++, token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 66 /* CaretEqualsToken */; + return pos += 2, token = 68 /* CaretEqualsToken */; } - return pos++, token = 47 /* CaretToken */; + return pos++, token = 48 /* CaretToken */; case 123 /* openBrace */: return pos++, token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 51 /* BarBarToken */; + return pos += 2, token = 52 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* BarEqualsToken */; + return pos += 2, token = 67 /* BarEqualsToken */; } - return pos++, token = 46 /* BarToken */; + return pos++, token = 47 /* BarToken */; case 125 /* closeBrace */: return pos++, token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 49 /* TildeToken */; + return pos++, token = 50 /* TildeToken */; case 64 /* at */: - return pos++, token = 54 /* AtToken */; + return pos++, token = 55 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); @@ -3801,9 +3818,9 @@ var ts; error(ts.Diagnostics.Invalid_character); return pos++, token = 0 /* Unknown */; default: - if (isIdentifierStart(ch)) { + if (isIdentifierStart(ch, languageVersion)) { pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92 /* backslash */) { @@ -3830,14 +3847,14 @@ var ts; if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 44 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 45 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 43 /* GreaterThanGreaterThanToken */; + return pos++, token = 44 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { return pos++, token = 29 /* GreaterThanEqualsToken */; @@ -3846,7 +3863,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) { + if (token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -3886,7 +3903,7 @@ var ts; } p++; } - while (p < end && isIdentifierPart(text.charCodeAt(p))) { + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; @@ -3932,7 +3949,7 @@ var ts; break; } } - return token = 234 /* JsxText */; + return token = 236 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -3941,7 +3958,7 @@ var ts; var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) { + if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { pos++; } else { @@ -4020,16 +4037,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 217 /* ModuleBlock */) { + else if (node.kind === 219 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -4048,7 +4065,7 @@ var ts; }); return state; } - else if (node.kind === 216 /* ModuleDeclaration */) { + else if (node.kind === 218 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -4088,6 +4105,8 @@ var ts; var container; var blockScopeContainer; var lastContainer; + var seenThisKeyword; + var isJavaScriptFile = ts.isSourceFileJavaScript(file); // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). @@ -4126,10 +4145,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 216 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return "\"" + node.name.text + "\""; } - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -4137,22 +4156,25 @@ var ts; return node.name.text; } switch (node.kind) { - case 142 /* Constructor */: + case 144 /* Constructor */: return "__constructor"; - case 150 /* FunctionType */: - case 145 /* CallSignature */: + case 152 /* FunctionType */: + case 147 /* CallSignature */: return "__call"; - case 151 /* ConstructorType */: - case 146 /* ConstructSignature */: + case 153 /* ConstructorType */: + case 148 /* ConstructSignature */: return "__new"; - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return "__index"; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return "__export"; - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 211 /* FunctionDeclaration */: - case 212 /* ClassDeclaration */: + case 181 /* BinaryExpression */: + // Binary expression case is for JS module 'module.exports = expr' + return "export="; + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: return node.flags & 1024 /* Default */ ? "default" : undefined; } } @@ -4169,8 +4191,9 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 1024 /* Default */; // The exported symbol for an export default function/class node is always named "default" - var name = node.flags & 1024 /* Default */ && parent ? "default" : getDeclarationName(node); + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { // Check and see if the symbol table already has a symbol with this name. If not, @@ -4206,6 +4229,11 @@ var ts; var message = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 1024 /* Default */) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -4223,7 +4251,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 228 /* ExportSpecifier */ || (node.kind === 219 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -4297,44 +4325,51 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - ts.forEachChild(node, bind); + if (node.kind === 215 /* InterfaceDeclaration */) { + seenThisKeyword = false; + ts.forEachChild(node, bind); + node.flags = seenThisKeyword ? node.flags | 524288 /* ContainsThis */ : node.flags & ~524288 /* ContainsThis */; + } + else { + ts.forEachChild(node, bind); + } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function getContainerFlags(node) { switch (node.kind) { - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 153 /* TypeLiteral */: - case 163 /* ObjectLiteralExpression */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: return 1 /* IsContainer */; - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 211 /* FunctionDeclaration */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 216 /* ModuleDeclaration */: - case 246 /* SourceFile */: - case 214 /* TypeAliasDeclaration */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 218 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 216 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 242 /* CatchClause */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 218 /* CaseBlock */: + case 244 /* CatchClause */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 220 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 190 /* Block */: + case 192 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Othewise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -4371,38 +4406,38 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 153 /* TypeLiteral */: - case 163 /* ObjectLiteralExpression */: - case 213 /* InterfaceDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + case 215 /* InterfaceDeclaration */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 214 /* TypeAliasDeclaration */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 216 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -4432,11 +4467,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 246 /* SourceFile */ ? node : node.body; - if (body.kind === 246 /* SourceFile */ || body.kind === 217 /* ModuleBlock */) { + var body = node.kind === 248 /* SourceFile */ ? node : node.body; + if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 226 /* ExportDeclaration */ || stat.kind === 225 /* ExportAssignment */) { + if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { return true; } } @@ -4508,7 +4543,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 67 /* Identifier */) { + if (prop.name.kind !== 69 /* Identifier */) { continue; } var identifier = prop.name; @@ -4520,7 +4555,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */ || prop.kind === 141 /* MethodDeclaration */ + var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -4542,10 +4577,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 246 /* SourceFile */: + case 248 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -4566,8 +4601,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 104 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 112 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && !ts.isIdentifierName(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { @@ -4602,7 +4637,7 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 67 /* Identifier */) { + if (inStrictMode && node.expression.kind === 69 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name var span = ts.getErrorSpanForNode(file, node.expression); @@ -4610,11 +4645,11 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 67 /* Identifier */) { + if (name && name.kind === 69 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -4658,7 +4693,7 @@ var ts; function checkStrictModePrefixUnaryExpression(node) { // Grammar checking if (inStrictMode) { - if (node.operator === 40 /* PlusPlusToken */ || node.operator === 41 /* MinusMinusToken */) { + if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -4702,17 +4737,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 246 /* SourceFile */: - case 217 /* ModuleBlock */: + case 248 /* SourceFile */: + case 219 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -4739,107 +4774,130 @@ var ts; } function bindWorker(node) { switch (node.kind) { - case 67 /* Identifier */: + /* Strict mode checks */ + case 69 /* Identifier */: return checkStrictModeIdentifier(node); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: + if (isJavaScriptFile) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return checkStrictModeCatchClause(node); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return checkStrictModeWithStatement(node); - case 135 /* TypeParameter */: + case 97 /* ThisKeyword */: + seenThisKeyword = true; + return; + case 137 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 136 /* Parameter */: + case 138 /* Parameter */: return bindParameter(node); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 142 /* Constructor */: + case 144 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 168 /* CallExpression */: + if (isJavaScriptFile) { + bindCallExpression(node); + } + break; + // Members of classes, interfaces, and modules + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 219 /* ImportEqualsDeclaration */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + // Imports and exports + case 221 /* ImportEqualsDeclaration */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return bindImportClause(node); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return bindExportDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return bindExportAssignment(node); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } function bindExportAssignment(node) { + var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (node.expression.kind === 67 /* Identifier */) { + else if (boundExpression.kind === 69 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -4863,8 +4921,32 @@ var ts; declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); } } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + // When we create a property via 'exports.foo = bar', the 'exports.foo' property access + // expression is the declaration + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); + } + function bindModuleExportsAssignment(node) { + // 'module.exports = expr' assignment + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } function bindClassLikeDeclaration(node) { - if (node.kind === 212 /* ClassDeclaration */) { + if (node.kind === 214 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -4940,7 +5022,7 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 142 /* Constructor */ && + node.parent.kind === 144 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); @@ -4992,7 +5074,8 @@ var ts; increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); @@ -5062,7 +5145,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 246 /* SourceFile */) { + while (node && node.kind !== 248 /* SourceFile */) { node = node.parent; } return node; @@ -5174,15 +5257,15 @@ var ts; return current; } switch (current.kind) { - case 246 /* SourceFile */: - case 218 /* CaseBlock */: - case 242 /* CatchClause */: - case 216 /* ModuleDeclaration */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 248 /* SourceFile */: + case 220 /* CaseBlock */: + case 244 /* CatchClause */: + case 218 /* ModuleDeclaration */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return current; - case 190 /* Block */: + case 192 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -5195,9 +5278,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 209 /* VariableDeclaration */ && + declaration.kind === 211 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 242 /* CatchClause */; + declaration.parent.kind === 244 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -5236,7 +5319,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 246 /* SourceFile */: + case 248 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -5245,16 +5328,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: errorNode = node.name; break; } @@ -5273,16 +5356,20 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 8192 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 215 /* EnumDeclaration */ && isConst(node); + return node.kind === 217 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 161 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 163 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -5297,14 +5384,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 209 /* VariableDeclaration */) { + if (node.kind === 211 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 210 /* VariableDeclarationList */) { + if (node && node.kind === 212 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 191 /* VariableStatement */) { + if (node && node.kind === 193 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -5319,7 +5406,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 193 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 195 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -5327,7 +5414,7 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 136 /* Parameter */ || node.kind === 135 /* TypeParameter */) ? + var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode); return ts.filter(commentRanges, isJsDocComment); @@ -5342,40 +5429,40 @@ var ts; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { + if (151 /* FirstTypeNode */ <= node.kind && node.kind <= 160 /* LastTypeNode */) { return true; } switch (node.kind) { - case 115 /* AnyKeyword */: - case 126 /* NumberKeyword */: - case 128 /* StringKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: + case 117 /* AnyKeyword */: + case 128 /* NumberKeyword */: + case 130 /* StringKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: return true; - case 101 /* VoidKeyword */: - return node.parent.kind !== 175 /* VoidExpression */; + case 103 /* VoidKeyword */: + return node.parent.kind !== 177 /* VoidExpression */; case 9 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 136 /* Parameter */; - case 186 /* ExpressionWithTypeArguments */: + return node.parent.kind === 138 /* Parameter */; + case 188 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 67 /* Identifier */: + case 69 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } - // fall through - case 133 /* QualifiedName */: - case 164 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 135 /* QualifiedName */: + case 166 /* PropertyAccessExpression */: + case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 152 /* TypeQuery */) { + if (parent_1.kind === 154 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5384,38 +5471,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (149 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 158 /* LastTypeNode */) { + if (151 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 160 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return node === parent_1.constraint; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 136 /* Parameter */: - case 209 /* VariableDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 138 /* Parameter */: + case 211 /* VariableDeclaration */: return node === parent_1.type; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 142 /* Constructor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 144 /* Constructor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return node === parent_1.type; - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return node === parent_1.type; - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: return node === parent_1.type; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5429,23 +5516,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return visitor(node); - case 218 /* CaseBlock */: - case 190 /* Block */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: + case 220 /* CaseBlock */: + case 192 /* Block */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5455,18 +5542,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -5474,7 +5561,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 134 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 136 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(name_5.expression); @@ -5493,14 +5580,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 161 /* BindingElement */: - case 245 /* EnumMember */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 244 /* ShorthandPropertyAssignment */: - case 209 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 247 /* EnumMember */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 246 /* ShorthandPropertyAssignment */: + case 211 /* VariableDeclaration */: return true; } } @@ -5508,29 +5595,29 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */); + return node && (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */); + return node && (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 142 /* Constructor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return true; } } @@ -5539,24 +5626,24 @@ var ts; ts.isFunctionLike = isFunctionLike; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: return true; } return false; } ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 190 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 192 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 141 /* MethodDeclaration */ && node.parent.kind === 163 /* ObjectLiteralExpression */; + return node && node.kind === 143 /* MethodDeclaration */ && node.parent.kind === 165 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -5584,7 +5671,7 @@ var ts; return undefined; } switch (node.kind) { - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -5599,9 +5686,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5612,23 +5699,26 @@ var ts; node = node.parent; } break; - case 172 /* ArrowFunction */: + case 174 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 216 /* ModuleDeclaration */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 215 /* EnumDeclaration */: - case 246 /* SourceFile */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 218 /* ModuleDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 217 /* EnumDeclaration */: + case 248 /* SourceFile */: return node; } } @@ -5640,7 +5730,7 @@ var ts; if (!node) return node; switch (node.kind) { - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container @@ -5655,9 +5745,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5668,19 +5758,19 @@ var ts; node = node.parent; } break; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return node; } } @@ -5689,12 +5779,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 149 /* TypeReference */: + case 151 /* TypeReference */: return node.typeName; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return node.expression; - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: return node; } } @@ -5702,7 +5792,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5711,44 +5801,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: // classes are valid targets return true; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 212 /* ClassDeclaration */; - case 136 /* Parameter */: + return node.parent.kind === 214 /* ClassDeclaration */; + case 138 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 212 /* ClassDeclaration */; - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 141 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 214 /* ClassDeclaration */; + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 143 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 212 /* ClassDeclaration */; + return node.body && node.parent.kind === 214 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: if (node.decorators) { return true; } return false; - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -5759,10 +5849,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -5772,96 +5862,106 @@ var ts; return nodeIsDecorated(node) || childIsDecorated(node); } ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 166 /* PropertyAccessExpression */; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 167 /* ElementAccessExpression */; + } + ts.isElementAccessExpression = isElementAccessExpression; function isExpression(node) { switch (node.kind) { - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 168 /* TaggedTemplateExpression */: - case 187 /* AsExpression */: - case 169 /* TypeAssertionExpression */: - case 170 /* ParenthesizedExpression */: - case 171 /* FunctionExpression */: - case 184 /* ClassExpression */: - case 172 /* ArrowFunction */: - case 175 /* VoidExpression */: - case 173 /* DeleteExpression */: - case 174 /* TypeOfExpression */: - case 177 /* PrefixUnaryExpression */: - case 178 /* PostfixUnaryExpression */: - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 181 /* TemplateExpression */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 170 /* TaggedTemplateExpression */: + case 189 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 172 /* ParenthesizedExpression */: + case 173 /* FunctionExpression */: + case 186 /* ClassExpression */: + case 174 /* ArrowFunction */: + case 177 /* VoidExpression */: + case 175 /* DeleteExpression */: + case 176 /* TypeOfExpression */: + case 179 /* PrefixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 183 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 185 /* OmittedExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 182 /* YieldExpression */: + case 187 /* OmittedExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 184 /* YieldExpression */: + case 178 /* AwaitExpression */: return true; - case 133 /* QualifiedName */: - while (node.parent.kind === 133 /* QualifiedName */) { + case 135 /* QualifiedName */: + while (node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 152 /* TypeQuery */; - case 67 /* Identifier */: - if (node.parent.kind === 152 /* TypeQuery */) { + return node.parent.kind === 154 /* TypeQuery */; + case 69 /* Identifier */: + if (node.parent.kind === 154 /* TypeQuery */) { return true; } // fall through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: + case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 209 /* VariableDeclaration */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 245 /* EnumMember */: - case 243 /* PropertyAssignment */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 247 /* EnumMember */: + case 245 /* PropertyAssignment */: + case 163 /* BindingElement */: return parent_2.initializer === node; - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 202 /* ReturnStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 206 /* ThrowStatement */: - case 204 /* SwitchStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 204 /* ReturnStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 208 /* ThrowStatement */: + case 206 /* SwitchStatement */: return parent_2.expression === node; - case 197 /* ForStatement */: + case 199 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 210 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 212 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212 /* VariableDeclarationList */) || forInStatement.expression === node; - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return node === parent_2.expression; - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return node === parent_2.expression; - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: return node === parent_2.expression; - case 137 /* Decorator */: - case 238 /* JsxExpression */: + case 139 /* Decorator */: + case 240 /* JsxExpression */: + case 239 /* JsxSpreadAttribute */: return true; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5872,6 +5972,12 @@ var ts; return false; } ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + // TypeScript 1.0 spec (April 2014): 11.2.1 + // An external module name is "relative" if the first term is "." or "..". + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 /* Instantiated */ || @@ -5879,7 +5985,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */; + return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5888,20 +5994,70 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 230 /* ExternalModuleReference */; + return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + /** + * Returns true if the node is a CallExpression to the identifier 'require' with + * exactly one argument. + * This function does not test if the node is in a JavaScript file or not. + */ + function isRequireCall(expression) { + // of the form 'require("name")' + return expression.kind === 168 /* CallExpression */ && + expression.expression.kind === 69 /* Identifier */ && + expression.expression.text === "require" && + expression.arguments.length === 1; + } + ts.isRequireCall = isRequireCall; + /** + * Returns true if the node is an assignment to a property on the identifier 'exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isExportsPropertyAssignment(expression) { + // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + /** + * Returns true if the node is an assignment to the property access expression 'module.exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isModuleExportsAssignment(expression) { + // of the form 'module.exports = expr' where 'expr' is arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { - if (node.kind === 220 /* ImportDeclaration */) { + if (node.kind === 222 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 219 /* ImportEqualsDeclaration */) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 230 /* ExternalModuleReference */) { + if (reference.kind === 232 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 226 /* ExportDeclaration */) { + if (node.kind === 228 /* ExportDeclaration */) { return node.moduleSpecifier; } } @@ -5909,13 +6065,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 136 /* Parameter */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 244 /* ShorthandPropertyAssignment */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 138 /* Parameter */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 246 /* ShorthandPropertyAssignment */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5923,9 +6079,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 259 /* JSDocFunctionType */ && + return node.kind === 261 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 261 /* JSDocConstructorType */; + node.parameters[0].type.kind === 263 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -5939,26 +6095,26 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 267 /* JSDocTypeTag */); + return getJSDocTag(node, 269 /* JSDocTypeTag */); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 266 /* JSDocReturnTag */); + return getJSDocTag(node, 268 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 268 /* JSDocTemplateTag */); + return getJSDocTag(node, 270 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 67 /* Identifier */) { + if (parameter.name && parameter.name.kind === 69 /* Identifier */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 265 /* JSDocParameterTag */) { + if (t.kind === 267 /* JSDocParameterTag */) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5977,12 +6133,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 260 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 262 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 260 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 262 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -6003,7 +6159,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 160 /* ArrayBindingPattern */ || node.kind === 159 /* ObjectBindingPattern */); + return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -6018,34 +6174,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 172 /* ArrowFunction */: - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 142 /* Constructor */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 228 /* ExportSpecifier */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 143 /* GetAccessor */: - case 221 /* ImportClause */: - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 213 /* InterfaceDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 216 /* ModuleDeclaration */: - case 222 /* NamespaceImport */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 144 /* SetAccessor */: - case 244 /* ShorthandPropertyAssignment */: - case 214 /* TypeAliasDeclaration */: - case 135 /* TypeParameter */: - case 209 /* VariableDeclaration */: + case 174 /* ArrowFunction */: + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 144 /* Constructor */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 230 /* ExportSpecifier */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 145 /* GetAccessor */: + case 223 /* ImportClause */: + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 215 /* InterfaceDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 218 /* ModuleDeclaration */: + case 224 /* NamespaceImport */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 146 /* SetAccessor */: + case 246 /* ShorthandPropertyAssignment */: + case 216 /* TypeAliasDeclaration */: + case 137 /* TypeParameter */: + case 211 /* VariableDeclaration */: return true; } return false; @@ -6053,25 +6209,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: - case 208 /* DebuggerStatement */: - case 195 /* DoStatement */: - case 193 /* ExpressionStatement */: - case 192 /* EmptyStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 194 /* IfStatement */: - case 205 /* LabeledStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 96 /* ThrowKeyword */: - case 207 /* TryStatement */: - case 191 /* VariableStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 225 /* ExportAssignment */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 210 /* DebuggerStatement */: + case 197 /* DoStatement */: + case 195 /* ExpressionStatement */: + case 194 /* EmptyStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 196 /* IfStatement */: + case 207 /* LabeledStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 98 /* ThrowKeyword */: + case 209 /* TryStatement */: + case 193 /* VariableStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 227 /* ExportAssignment */: return true; default: return false; @@ -6080,13 +6236,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 142 /* Constructor */: - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: + case 144 /* Constructor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: return true; default: return false; @@ -6095,11 +6251,11 @@ var ts; ts.isClassElement = isClassElement; // True if the given identifier, string literal, or number literal is the name of a declaration node function isDeclarationName(name) { - if (name.kind !== 67 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { + if (name.kind !== 69 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { return false; } var parent = name.parent; - if (parent.kind === 224 /* ImportSpecifier */ || parent.kind === 228 /* ExportSpecifier */) { + if (parent.kind === 226 /* ImportSpecifier */ || parent.kind === 230 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -6114,31 +6270,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 245 /* EnumMember */: - case 243 /* PropertyAssignment */: - case 164 /* PropertyAccessExpression */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 247 /* EnumMember */: + case 245 /* PropertyAssignment */: + case 166 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 133 /* QualifiedName */) { + while (parent.kind === 135 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 152 /* TypeQuery */; + return parent.kind === 154 /* TypeQuery */; } return false; - case 161 /* BindingElement */: - case 224 /* ImportSpecifier */: + case 163 /* BindingElement */: + case 226 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 228 /* ExportSpecifier */: + case 230 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -6154,26 +6310,26 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 219 /* ImportEqualsDeclaration */ || - node.kind === 221 /* ImportClause */ && !!node.name || - node.kind === 222 /* NamespaceImport */ || - node.kind === 224 /* ImportSpecifier */ || - node.kind === 228 /* ExportSpecifier */ || - node.kind === 225 /* ExportAssignment */ && node.expression.kind === 67 /* Identifier */; + return node.kind === 221 /* ImportEqualsDeclaration */ || + node.kind === 223 /* ImportClause */ && !!node.name || + node.kind === 224 /* NamespaceImport */ || + node.kind === 226 /* ImportSpecifier */ || + node.kind === 230 /* ExportSpecifier */ || + node.kind === 227 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 104 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 106 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -6242,7 +6398,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 68 /* FirstKeyword */ <= token && token <= 132 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 134 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -6262,7 +6418,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 134 /* ComputedPropertyName */ && + declaration.name.kind === 136 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -6272,14 +6428,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 164 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 67 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { + if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 134 /* ComputedPropertyName */) { + if (name.kind === 136 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6297,21 +6453,21 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 67 /* Identifier */ && node.text === "Symbol"; + return node.kind === 69 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 113 /* AbstractKeyword */: - case 116 /* AsyncKeyword */: - case 72 /* ConstKeyword */: - case 120 /* DeclareKeyword */: - case 75 /* DefaultKeyword */: - case 80 /* ExportKeyword */: - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 115 /* AbstractKeyword */: + case 118 /* AsyncKeyword */: + case 74 /* ConstKeyword */: + case 122 /* DeclareKeyword */: + case 77 /* DefaultKeyword */: + case 82 /* ExportKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: return true; } return false; @@ -6319,28 +6475,28 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 136 /* Parameter */; + return root.kind === 138 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 161 /* BindingElement */) { + while (node.kind === 163 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 216 /* ModuleDeclaration */ || n.kind === 246 /* SourceFile */; + return isFunctionLike(n) || n.kind === 218 /* ModuleDeclaration */ || n.kind === 248 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneEntityName(node) { - if (node.kind === 67 /* Identifier */) { - var clone_1 = createSynthesizedNode(67 /* Identifier */); + if (node.kind === 69 /* Identifier */) { + var clone_1 = createSynthesizedNode(69 /* Identifier */); clone_1.text = node.text; return clone_1; } else { - var clone_2 = createSynthesizedNode(133 /* QualifiedName */); + var clone_2 = createSynthesizedNode(135 /* QualifiedName */); clone_2.left = cloneEntityName(node.left); clone_2.left.parent = clone_2; clone_2.right = cloneEntityName(node.right); @@ -6595,7 +6751,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 142 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6624,10 +6780,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 143 /* GetAccessor */) { + if (accessor.kind === 145 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 144 /* SetAccessor */) { + else if (accessor.kind === 146 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6636,7 +6792,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) + if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6647,10 +6803,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 143 /* GetAccessor */ && !getAccessor) { + if (member.kind === 145 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 144 /* SetAccessor */ && !setAccessor) { + if (member.kind === 146 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6783,16 +6939,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 111 /* StaticKeyword */: return 128 /* Static */; - case 110 /* PublicKeyword */: return 16 /* Public */; - case 109 /* ProtectedKeyword */: return 64 /* Protected */; - case 108 /* PrivateKeyword */: return 32 /* Private */; - case 113 /* AbstractKeyword */: return 256 /* Abstract */; - case 80 /* ExportKeyword */: return 1 /* Export */; - case 120 /* DeclareKeyword */: return 2 /* Ambient */; - case 72 /* ConstKeyword */: return 32768 /* Const */; - case 75 /* DefaultKeyword */: return 1024 /* Default */; - case 116 /* AsyncKeyword */: return 512 /* Async */; + case 113 /* StaticKeyword */: return 128 /* Static */; + case 112 /* PublicKeyword */: return 16 /* Public */; + case 111 /* ProtectedKeyword */: return 64 /* Protected */; + case 110 /* PrivateKeyword */: return 32 /* Private */; + case 115 /* AbstractKeyword */: return 256 /* Abstract */; + case 82 /* ExportKeyword */: return 1 /* Export */; + case 122 /* DeclareKeyword */: return 2 /* Ambient */; + case 74 /* ConstKeyword */: return 32768 /* Const */; + case 77 /* DefaultKeyword */: return 1024 /* Default */; + case 118 /* AsyncKeyword */: return 512 /* Async */; } return 0; } @@ -6800,29 +6956,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 167 /* NewExpression */: - case 166 /* CallExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 168 /* TaggedTemplateExpression */: - case 162 /* ArrayLiteralExpression */: - case 170 /* ParenthesizedExpression */: - case 163 /* ObjectLiteralExpression */: - case 184 /* ClassExpression */: - case 171 /* FunctionExpression */: - case 67 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 169 /* NewExpression */: + case 168 /* CallExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 170 /* TaggedTemplateExpression */: + case 164 /* ArrayLiteralExpression */: + case 172 /* ParenthesizedExpression */: + case 165 /* ObjectLiteralExpression */: + case 186 /* ClassExpression */: + case 173 /* FunctionExpression */: + case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 181 /* TemplateExpression */: - case 82 /* FalseKeyword */: - case 91 /* NullKeyword */: - case 95 /* ThisKeyword */: - case 97 /* TrueKeyword */: - case 93 /* SuperKeyword */: + case 183 /* TemplateExpression */: + case 84 /* FalseKeyword */: + case 93 /* NullKeyword */: + case 97 /* ThisKeyword */: + case 99 /* TrueKeyword */: + case 95 /* SuperKeyword */: return true; } } @@ -6830,12 +6986,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 55 /* FirstAssignment */ && token <= 66 /* LastAssignment */; + return token >= 56 /* FirstAssignment */ && token <= 68 /* LastAssignment */; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 186 /* ExpressionWithTypeArguments */ && - node.parent.token === 81 /* ExtendsKeyword */ && + return node.kind === 188 /* ExpressionWithTypeArguments */ && + node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -6846,10 +7002,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 67 /* Identifier */) { + if (node.kind === 69 /* Identifier */) { return true; } - else if (node.kind === 164 /* PropertyAccessExpression */) { + else if (isPropertyAccessExpression(node)) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -6857,16 +7013,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 163 /* ObjectLiteralExpression */) { + if (kind === 165 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 162 /* ArrayLiteralExpression */) { + if (kind === 164 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6876,12 +7032,12 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } ts.isTsx = isTsx; /** @@ -7178,9 +7334,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 135 /* TypeParameter */) { + if (d && d.kind === 137 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215 /* InterfaceDeclaration */) { return current; } } @@ -7192,7 +7348,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(270 /* Count */); + var nodeConstructors = new Array(272 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -7237,20 +7393,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 246 /* ShorthandPropertyAssignment */: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7259,24 +7421,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7287,290 +7449,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 155 /* TupleType */: + case 157 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 164 /* PropertyAccessExpression */: + case 166 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 174 /* TypeOfExpression */: + case 176 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 175 /* VoidExpression */: + case 177 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 176 /* AwaitExpression */: + case 178 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 187 /* AsExpression */: + case 189 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 183 /* SpreadElementExpression */: + case 185 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 210 /* VariableDeclarationList */: + case 212 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 194 /* IfStatement */: + case 196 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 195 /* DoStatement */: + case 197 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 198 /* ForInStatement */: + case 200 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ForOfStatement */: + case 201 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: return visitNode(cbNode, node.label); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 239 /* CaseClause */: + case 241 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 240 /* DefaultClause */: + case 242 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 207 /* TryStatement */: + case 209 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 137 /* Decorator */: + case 139 /* Decorator */: return visitNode(cbNode, node.expression); - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 222 /* NamespaceImport */: + case 224 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 223 /* NamedImports */: - case 227 /* NamedExports */: + case 225 /* NamedImports */: + case 229 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 241 /* HeritageClause */: + case 243 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 230 /* ExternalModuleReference */: + case 232 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 229 /* MissingDeclaration */: + case 231 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 231 /* JsxElement */: + case 233 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 232 /* JsxSelfClosingElement */: - case 233 /* JsxOpeningElement */: + case 234 /* JsxSelfClosingElement */: + case 235 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 236 /* JsxAttribute */: + case 238 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 237 /* JsxSpreadAttribute */: + case 239 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 235 /* JsxClosingElement */: + case 237 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 247 /* JSDocTypeExpression */: + case 249 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 251 /* JSDocUnionType */: + case 253 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 252 /* JSDocTupleType */: + case 254 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 250 /* JSDocArrayType */: + case 252 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 254 /* JSDocNonNullableType */: + case 256 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 253 /* JSDocNullableType */: + case 255 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 255 /* JSDocRecordType */: + case 257 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 257 /* JSDocTypeReference */: + case 259 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 258 /* JSDocOptionalType */: + case 260 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 259 /* JSDocFunctionType */: + case 261 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 260 /* JSDocVariadicType */: + case 262 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 261 /* JSDocConstructorType */: + case 263 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 262 /* JSDocThisType */: + case 264 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 256 /* JSDocRecordMember */: + case 258 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 263 /* JSDocComment */: + case 265 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 265 /* JSDocParameterTag */: + case 267 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 266 /* JSDocReturnTag */: + case 268 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 267 /* JSDocTypeTag */: + case 269 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 268 /* JSDocTemplateTag */: + case 270 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7701,13 +7863,14 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -7715,7 +7878,7 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -7736,6 +7899,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32 /* JavaScriptFile */) { + sourceFile.parserContextFlags = 32 /* JavaScriptFile */; + } // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -7753,7 +7919,7 @@ var ts; // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -7765,9 +7931,9 @@ var ts; // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { - case 191 /* VariableStatement */: - case 211 /* FunctionDeclaration */: - case 136 /* Parameter */: + case 193 /* VariableStatement */: + case 213 /* FunctionDeclaration */: + case 138 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); @@ -7808,7 +7974,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(246 /* SourceFile */, /*pos*/ 0); + var sourceFile = createNode(248 /* SourceFile */, /*pos*/ 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -7972,7 +8138,7 @@ var ts; var saveParseDiagnosticsLength = parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; // Note: it is not actually necessary to save/restore the context flags here. That's - // because the saving/restorating of these flags happens naturally through the recursive + // because the saving/restoring of these flags happens naturally through the recursive // descent nature of our parser. However, we still store this here just so we can // assert that that invariant holds. var saveContextFlags = contextFlags; @@ -8007,20 +8173,20 @@ var ts; } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token === 67 /* Identifier */) { + if (token === 69 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token === 112 /* YieldKeyword */ && inYieldContext()) { + if (token === 114 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token === 117 /* AwaitKeyword */ && inAwaitContext()) { + if (token === 119 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token > 103 /* LastReservedWord */; + return token > 105 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -8126,16 +8292,16 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(67 /* Identifier */); + var node = createNode(69 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token !== 67 /* Identifier */) { + if (token !== 69 /* Identifier */) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -8170,7 +8336,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(134 /* ComputedPropertyName */); + var node = createNode(136 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -8183,21 +8349,28 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 72 /* ConstKeyword */) { + if (token === 74 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 79 /* EnumKeyword */; + return nextToken() === 81 /* EnumKeyword */; } - if (token === 80 /* ExportKeyword */) { + if (token === 82 /* ExportKeyword */) { nextToken(); - if (token === 75 /* DefaultKeyword */) { + if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } - if (token === 75 /* DefaultKeyword */) { + if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); } + if (token === 113 /* StaticKeyword */) { + nextToken(); + return canFollowModifier(); + } nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } return canFollowModifier(); } function parseAnyContextualModifier() { @@ -8211,7 +8384,7 @@ var ts; } function nextTokenIsClassOrFunction() { nextToken(); - return token === 71 /* ClassKeyword */ || token === 85 /* FunctionKeyword */; + return token === 73 /* ClassKeyword */ || token === 87 /* FunctionKeyword */; } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -8231,7 +8404,7 @@ var ts; // outer module. We just want to consume and move on. return !(token === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; + return token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 4 /* TypeMembers */: return isStartOfTypeMember(); case 5 /* ClassMembers */: @@ -8305,7 +8478,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 81 /* ExtendsKeyword */ || next === 104 /* ImplementsKeyword */; + return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 83 /* ExtendsKeyword */ || next === 106 /* ImplementsKeyword */; } return true; } @@ -8318,8 +8491,8 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 104 /* ImplementsKeyword */ || - token === 81 /* ExtendsKeyword */) { + if (token === 106 /* ImplementsKeyword */ || + token === 83 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -8345,14 +8518,14 @@ var ts; case 21 /* ImportOrExportSpecifiers */: return token === 16 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token === 16 /* CloseBraceToken */ || token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; + return token === 16 /* CloseBraceToken */ || token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 15 /* OpenBraceToken */ || token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 17 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery return token === 18 /* CloseParenToken */ || token === 23 /* SemicolonToken */; @@ -8369,11 +8542,11 @@ var ts; case 20 /* HeritageClauses */: return token === 15 /* OpenBraceToken */ || token === 16 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token === 27 /* GreaterThanToken */ || token === 38 /* SlashToken */; + return token === 27 /* GreaterThanToken */ || token === 39 /* SlashToken */; case 14 /* JsxChildren */: return token === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash); case 22 /* JSDocFunctionParameters */: - return token === 18 /* CloseParenToken */ || token === 53 /* ColonToken */ || token === 16 /* CloseBraceToken */; + return token === 18 /* CloseParenToken */ || token === 54 /* ColonToken */ || token === 16 /* CloseBraceToken */; case 23 /* JSDocTypeArguments */: return token === 27 /* GreaterThanToken */ || token === 16 /* CloseBraceToken */; case 25 /* JSDocTupleTypes */: @@ -8561,20 +8734,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 142 /* Constructor */: - case 147 /* IndexSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 139 /* PropertyDeclaration */: - case 189 /* SemicolonClassElement */: + case 144 /* Constructor */: + case 149 /* IndexSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 191 /* SemicolonClassElement */: return true; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 67 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 119 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 69 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 121 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -8583,8 +8756,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: return true; } } @@ -8593,58 +8766,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 191 /* VariableStatement */: - case 190 /* Block */: - case 194 /* IfStatement */: - case 193 /* ExpressionStatement */: - case 206 /* ThrowStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 192 /* EmptyStatement */: - case 207 /* TryStatement */: - case 205 /* LabeledStatement */: - case 195 /* DoStatement */: - case 208 /* DebuggerStatement */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: - case 225 /* ExportAssignment */: - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 214 /* TypeAliasDeclaration */: + case 213 /* FunctionDeclaration */: + case 193 /* VariableStatement */: + case 192 /* Block */: + case 196 /* IfStatement */: + case 195 /* ExpressionStatement */: + case 208 /* ThrowStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 194 /* EmptyStatement */: + case 209 /* TryStatement */: + case 207 /* LabeledStatement */: + case 197 /* DoStatement */: + case 210 /* DebuggerStatement */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + case 227 /* ExportAssignment */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 216 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 245 /* EnumMember */; + return node.kind === 247 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 146 /* ConstructSignature */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: - case 138 /* PropertySignature */: - case 145 /* CallSignature */: + case 148 /* ConstructSignature */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: + case 140 /* PropertySignature */: + case 147 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 209 /* VariableDeclaration */) { + if (node.kind !== 211 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8665,7 +8838,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 136 /* Parameter */) { + if (node.kind !== 138 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8782,7 +8955,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(133 /* QualifiedName */, entity.pos); + var node = createNode(135 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8815,13 +8988,13 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(67 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(181 /* TemplateExpression */); + var template = createNode(183 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -8834,7 +9007,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(188 /* TemplateSpan */); + var span = createNode(190 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { @@ -8876,14 +9049,14 @@ var ts; // TYPES function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - if (typeName.kind === 67 /* Identifier */ && token === 122 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 69 /* Identifier */ && token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(148 /* TypePredicate */, typeName.pos); + var node_1 = createNode(150 /* TypePredicate */, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(149 /* TypeReference */, typeName.pos); + var node = createNode(151 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -8891,15 +9064,15 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(152 /* TypeQuery */); - parseExpected(99 /* TypeOfKeyword */); + var node = createNode(154 /* TypeQuery */); + parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(135 /* TypeParameter */); + var node = createNode(137 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(81 /* ExtendsKeyword */)) { + if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -8926,7 +9099,7 @@ var ts; } } function parseParameterType() { - if (parseOptional(53 /* ColonToken */)) { + if (parseOptional(54 /* ColonToken */)) { return token === 9 /* StringLiteral */ ? parseLiteralNode(/*internName*/ true) : parseType(); @@ -8934,7 +9107,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 54 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 55 /* AtToken */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8943,7 +9116,7 @@ var ts; } } function parseParameter() { - var node = createNode(136 /* Parameter */); + var node = createNode(138 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); @@ -8961,7 +9134,7 @@ var ts; // to avoid this we'll advance cursor to the next token. nextToken(); } - node.questionToken = parseOptionalToken(52 /* QuestionToken */); + node.questionToken = parseOptionalToken(53 /* QuestionToken */); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(/*inParameter*/ true); // Do not check for initializers in an ambient context for parameters. This is not @@ -9037,10 +9210,10 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 146 /* ConstructSignature */) { - parseExpected(90 /* NewKeyword */); + if (kind === 148 /* ConstructSignature */) { + parseExpected(92 /* NewKeyword */); } - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); parseTypeMemberSemicolon(); return finishNode(node); } @@ -9087,21 +9260,21 @@ var ts; // A colon signifies a well formed indexer // A comma should be a badly formed indexer because comma expressions are not allowed // in computed properties. - if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */) { + if (token === 54 /* ColonToken */ || token === 24 /* CommaToken */) { return true; } // Question mark could be an indexer with an optional property, // or it could be a conditional expression in a computed property. - if (token !== 52 /* QuestionToken */) { + if (token !== 53 /* QuestionToken */) { return false; } // If any of the following tokens are after the question mark, it cannot // be a conditional expression, so treat it as an indexer. nextToken(); - return token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; + return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(147 /* IndexSignature */, fullStart); + var node = createNode(149 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -9112,19 +9285,19 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(140 /* MethodSignature */, fullStart); + var method = createNode(142 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [Await] - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(138 /* PropertySignature */, fullStart); + var property = createNode(140 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -9158,23 +9331,23 @@ var ts; nextToken(); return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || - token === 52 /* QuestionToken */ || - token === 53 /* ColonToken */ || + token === 53 /* QuestionToken */ || + token === 54 /* ColonToken */ || canParseSemicolon(); } function parseTypeMember() { switch (token) { case 17 /* OpenParenToken */: case 25 /* LessThanToken */: - return parseSignatureMember(145 /* CallSignature */); + return parseSignatureMember(147 /* CallSignature */); case 19 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) : parsePropertyOrMethodSignature(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(146 /* ConstructSignature */); + return parseSignatureMember(148 /* ConstructSignature */); } // fall through. case 9 /* StringLiteral */: @@ -9211,7 +9384,7 @@ var ts; return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(153 /* TypeLiteral */); + var node = createNode(155 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -9227,12 +9400,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(155 /* TupleType */); + var node = createNode(157 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(158 /* ParenthesizedType */); + var node = createNode(160 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -9240,8 +9413,8 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 151 /* ConstructorType */) { - parseExpected(90 /* NewKeyword */); + if (kind === 153 /* ConstructorType */) { + parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); return finishNode(node); @@ -9252,17 +9425,18 @@ var ts; } function parseNonArrayType() { switch (token) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: return parseTokenNode(); - case 99 /* TypeOfKeyword */: + case 101 /* TypeOfKeyword */: return parseTypeQuery(); case 15 /* OpenBraceToken */: return parseTypeLiteral(); @@ -9276,17 +9450,18 @@ var ts; } function isStartOfType() { switch (token) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: - case 99 /* TypeOfKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: + case 101 /* TypeOfKeyword */: case 15 /* OpenBraceToken */: case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return true; case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, @@ -9304,7 +9479,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(154 /* ArrayType */, type.pos); + var node = createNode(156 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9326,10 +9501,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(157 /* IntersectionType */, parseArrayTypeOrHigher, 45 /* AmpersandToken */); + return parseUnionOrIntersectionType(159 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(156 /* UnionType */, parseIntersectionTypeOrHigher, 46 /* BarToken */); + return parseUnionOrIntersectionType(158 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -9346,8 +9521,8 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || - token === 52 /* QuestionToken */ || token === 55 /* EqualsToken */ || + if (token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || + token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { // ( id : // ( id , @@ -9373,24 +9548,24 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(150 /* FunctionType */); + return parseFunctionOrConstructorType(152 /* FunctionType */); } - if (token === 90 /* NewKeyword */) { - return parseFunctionOrConstructorType(151 /* ConstructorType */); + if (token === 92 /* NewKeyword */) { + return parseFunctionOrConstructorType(153 /* ConstructorType */); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(53 /* ColonToken */) ? parseType() : undefined; + return parseOptional(54 /* ColonToken */) ? parseType() : undefined; } // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token) { - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: @@ -9398,12 +9573,12 @@ var ts; case 17 /* OpenParenToken */: case 19 /* OpenBracketToken */: case 15 /* OpenBraceToken */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 90 /* NewKeyword */: - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: - case 67 /* Identifier */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 92 /* NewKeyword */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: + case 69 /* Identifier */: return true; default: return isIdentifier(); @@ -9416,16 +9591,16 @@ var ts; switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 76 /* DeleteKeyword */: - case 99 /* TypeOfKeyword */: - case 101 /* VoidKeyword */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 78 /* DeleteKeyword */: + case 101 /* TypeOfKeyword */: + case 103 /* VoidKeyword */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: case 25 /* LessThanToken */: - case 117 /* AwaitKeyword */: - case 112 /* YieldKeyword */: + case 119 /* AwaitKeyword */: + case 114 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -9444,9 +9619,9 @@ var ts; function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. return token !== 15 /* OpenBraceToken */ && - token !== 85 /* FunctionKeyword */ && - token !== 71 /* ClassKeyword */ && - token !== 54 /* AtToken */ && + token !== 87 /* FunctionKeyword */ && + token !== 73 /* ClassKeyword */ && + token !== 55 /* AtToken */ && isStartOfExpression(); } function allowInAndParseExpression() { @@ -9472,7 +9647,7 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 55 /* EqualsToken */) { + if (token !== 56 /* EqualsToken */) { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. @@ -9489,7 +9664,7 @@ var ts; } // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -9527,7 +9702,7 @@ var ts; // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 67 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { + if (expr.kind === 69 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -9543,7 +9718,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 112 /* YieldKeyword */) { + if (token === 114 /* YieldKeyword */) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -9572,7 +9747,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(182 /* YieldExpression */); + var node = createNode(184 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9592,8 +9767,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(172 /* ArrowFunction */, identifier.pos); - var parameter = createNode(136 /* Parameter */, identifier.pos); + var node = createNode(174 /* ArrowFunction */, identifier.pos); + var parameter = createNode(138 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -9635,7 +9810,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 116 /* AsyncKeyword */) { + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 118 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token === 34 /* EqualsGreaterThanToken */) { @@ -9648,7 +9823,7 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 116 /* AsyncKeyword */) { + if (token === 118 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; @@ -9668,7 +9843,7 @@ var ts; var third = nextToken(); switch (third) { case 34 /* EqualsGreaterThanToken */: - case 53 /* ColonToken */: + case 54 /* ColonToken */: case 15 /* OpenBraceToken */: return 1 /* True */; default: @@ -9699,7 +9874,7 @@ var ts; } // If we have something like "(a:", then we must have a // type-annotated parameter in an arrow function expression. - if (nextToken() === 53 /* ColonToken */) { + if (nextToken() === 54 /* ColonToken */) { return 1 /* True */; } // This *could* be a parenthesized arrow function. @@ -9717,10 +9892,10 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 81 /* ExtendsKeyword */) { + if (third === 83 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 55 /* EqualsToken */: + case 56 /* EqualsToken */: case 27 /* GreaterThanToken */: return false; default: @@ -9745,7 +9920,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(172 /* ArrowFunction */); + var node = createNode(174 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512 /* Async */); // Arrow functions are never generators. @@ -9755,7 +9930,7 @@ var ts; // a => (b => c) // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); // If we couldn't get parameters, we definitely could not parse out an arrow function. if (!node.parameters) { return undefined; @@ -9779,8 +9954,8 @@ var ts; return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); } if (token !== 23 /* SemicolonToken */ && - token !== 85 /* FunctionKeyword */ && - token !== 71 /* ClassKeyword */ && + token !== 87 /* FunctionKeyword */ && + token !== 73 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -9805,17 +9980,17 @@ var ts; } function parseConditionalExpressionRest(leftOperand) { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(180 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(182 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(53 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(53 /* ColonToken */)); + node.colonToken = parseExpectedToken(54 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(54 /* ColonToken */)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9824,7 +9999,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 88 /* InKeyword */ || t === 132 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 134 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9833,13 +10008,36 @@ var ts; reScanGreaterToken(); var newPrecedence = getBinaryOperatorPrecedence(); // Check the precedence to see if we should "take" this operator - if (newPrecedence <= precedence) { + // - For left associative operator (all operator but **), consume the operator, + // recursively call the function below, and parse binaryExpression as a rightOperand + // of the caller if the new precendence of the operator is greater then or equal to the current precendence. + // For example: + // a - b - c; + // ^token; leftOperand = b. Return b to the caller as a rightOperand + // a * b - c + // ^token; leftOperand = b. Return b to the caller as a rightOperand + // a - b * c; + // ^token; leftOperand = b. Return b * c to the caller as a rightOperand + // - For right associative operator (**), consume the operator, recursively call the function + // and parse binaryExpression as a rightOperand of the caller if the new precendence of + // the operator is strictly grater than the current precendence + // For example: + // a ** b ** c; + // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand + // a - b ** c; + // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand + // a ** b - c + // ^token; leftOperand = b. Return b to the caller as a rightOperand + var consumeCurrentOperator = token === 38 /* AsteriskAsteriskToken */ ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { break; } - if (token === 88 /* InKeyword */ && inDisallowInContext()) { + if (token === 90 /* InKeyword */ && inDisallowInContext()) { break; } - if (token === 114 /* AsKeyword */) { + if (token === 116 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -9860,22 +10058,22 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 88 /* InKeyword */) { + if (inDisallowInContext() && token === 90 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 51 /* BarBarToken */: + case 52 /* BarBarToken */: return 1; - case 50 /* AmpersandAmpersandToken */: + case 51 /* AmpersandAmpersandToken */: return 2; - case 46 /* BarToken */: + case 47 /* BarToken */: return 3; - case 47 /* CaretToken */: + case 48 /* CaretToken */: return 4; - case 45 /* AmpersandToken */: + case 46 /* AmpersandToken */: return 5; case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: @@ -9886,66 +10084,68 @@ var ts; case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - case 89 /* InstanceOfKeyword */: - case 88 /* InKeyword */: - case 114 /* AsKeyword */: + case 91 /* InstanceOfKeyword */: + case 90 /* InKeyword */: + case 116 /* AsKeyword */: return 7; - case 42 /* LessThanLessThanToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* LessThanLessThanToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: return 8; case 35 /* PlusToken */: case 36 /* MinusToken */: return 9; case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: return 10; + case 38 /* AsteriskAsteriskToken */: + return 11; } // -1 is lower than all other precedences. Returning it will cause binary expression // parsing to stop. return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(179 /* BinaryExpression */, left.pos); + var node = createNode(181 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(187 /* AsExpression */, left.pos); + var node = createNode(189 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(177 /* PrefixUnaryExpression */); + var node = createNode(179 /* PrefixUnaryExpression */); node.operator = token; nextToken(); - node.operand = parseUnaryExpressionOrHigher(); + node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(173 /* DeleteExpression */); + var node = createNode(175 /* DeleteExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(174 /* TypeOfExpression */); + var node = createNode(176 /* TypeOfExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(175 /* VoidExpression */); + var node = createNode(177 /* VoidExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token === 117 /* AwaitKeyword */) { + if (token === 119 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -9955,46 +10155,137 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(176 /* AwaitExpression */); + var node = createNode(178 /* AwaitExpression */); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + /** + * Parse ES7 unary expression and await expression + * + * ES7 UnaryExpression: + * 1) SimpleUnaryExpression[?yield] + * 2) IncrementExpression[?yield] ** UnaryExpression[?yield] + */ function parseUnaryExpressionOrHigher() { if (isAwaitExpression()) { return parseAwaitExpression(); } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 /* AsteriskAsteriskToken */ ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38 /* AsteriskAsteriskToken */) { + var diagnostic; + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } + else { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + /** + * Parse ES7 simple-unary expression or higher: + * + * ES7 SimpleUnaryExpression: + * 1) IncrementExpression[?yield] + * 2) delete UnaryExpression[?yield] + * 3) void UnaryExpression[?yield] + * 4) typeof UnaryExpression[?yield] + * 5) + UnaryExpression[?yield] + * 6) - UnaryExpression[?yield] + * 7) ~ UnaryExpression[?yield] + * 8) ! UnaryExpression[?yield] + */ + function parseSimpleUnaryExpression() { switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: return parsePrefixUnaryExpression(); - case 76 /* DeleteKeyword */: + case 78 /* DeleteKeyword */: return parseDeleteExpression(); - case 99 /* TypeOfKeyword */: + case 101 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: return parseVoidExpression(); case 25 /* LessThanToken */: - if (sourceFile.languageVariant !== 1 /* JSX */) { - return parseTypeAssertion(); - } - if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); - } - // Fall through + // This is modified UnaryExpression grammar in TypeScript + // UnaryExpression (modified): + // < type > UnaryExpression + return parseTypeAssertion(); default: - return parsePostfixExpressionOrHigher(); + return parseIncrementExpression(); } } - function parsePostfixExpressionOrHigher() { + /** + * Check if the current token can possibly be an ES7 increment expression. + * + * ES7 IncrementExpression: + * LeftHandSideExpression[?Yield] + * LeftHandSideExpression[?Yield][no LineTerminator here]++ + * LeftHandSideExpression[?Yield][no LineTerminator here]-- + * ++LeftHandSideExpression[?Yield] + * --LeftHandSideExpression[?Yield] + */ + function isIncrementExpression() { + // This function is called inside parseUnaryExpression to decide + // whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly + switch (token) { + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 78 /* DeleteKeyword */: + case 101 /* TypeOfKeyword */: + case 103 /* VoidKeyword */: + return false; + case 25 /* LessThanToken */: + // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression + if (sourceFile.languageVariant !== 1 /* JSX */) { + return false; + } + // We are in JSX context and the token is part of JSXElement. + // Fall through + default: + return true; + } + } + /** + * Parse ES7 IncrementExpression. IncrementExpression is used instead of ES6's PostFixExpression. + * + * ES7 IncrementExpression[yield]: + * 1) LeftHandSideExpression[?yield] + * 2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++ + * 3) LeftHandSideExpression[?yield] [[no LineTerminator here]]-- + * 4) ++LeftHandSideExpression[?yield] + * 5) --LeftHandSideExpression[?yield] + * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression + */ + function parseIncrementExpression() { + if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { + var node = createNode(179 /* PrefixUnaryExpression */); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 /* JSX */ && token === 25 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + // JSXElement is part of primaryExpression + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); + } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 40 /* PlusPlusToken */ || token === 41 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(178 /* PostfixUnaryExpression */, expression.pos); + if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(180 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -10033,7 +10324,7 @@ var ts; // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token === 93 /* SuperKeyword */ + var expression = token === 95 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); // Now, we *may* be complete. However, we might have consumed the start of a @@ -10098,7 +10389,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(164 /* PropertyAccessExpression */, expression.pos); + var node = createNode(166 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10106,27 +10397,27 @@ var ts; } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); - if (opening.kind === 233 /* JsxOpeningElement */) { - var node = createNode(231 /* JsxElement */, opening.pos); + if (opening.kind === 235 /* JsxOpeningElement */) { + var node = createNode(233 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 232 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 234 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements return opening; } } function parseJsxText() { - var node = createNode(234 /* JsxText */, scanner.getStartPos()); + var node = createNode(236 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 234 /* JsxText */: + case 236 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -10165,11 +10456,11 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(233 /* JsxOpeningElement */, fullStart); + node = createNode(235 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { - parseExpected(38 /* SlashToken */); + parseExpected(39 /* SlashToken */); if (inExpressionContext) { parseExpected(27 /* GreaterThanToken */); } @@ -10177,7 +10468,7 @@ var ts; parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); scanJsxText(); } - node = createNode(232 /* JsxSelfClosingElement */, fullStart); + node = createNode(234 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10188,7 +10479,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(133 /* QualifiedName */, elementName.pos); + var node = createNode(135 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -10196,7 +10487,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(238 /* JsxExpression */); + var node = createNode(240 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { node.expression = parseExpression(); @@ -10215,9 +10506,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(236 /* JsxAttribute */); + var node = createNode(238 /* JsxAttribute */); node.name = parseIdentifierName(); - if (parseOptional(55 /* EqualsToken */)) { + if (parseOptional(56 /* EqualsToken */)) { switch (token) { case 9 /* StringLiteral */: node.initializer = parseLiteralNode(); @@ -10230,7 +10521,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(237 /* JsxSpreadAttribute */); + var node = createNode(239 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -10238,7 +10529,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(235 /* JsxClosingElement */); + var node = createNode(237 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -10251,18 +10542,18 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(169 /* TypeAssertionExpression */); + var node = createNode(171 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(164 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(166 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10271,7 +10562,7 @@ var ts; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(19 /* OpenBracketToken */)) { - var indexedAccess = createNode(165 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(167 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -10287,7 +10578,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(168 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(170 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -10310,7 +10601,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(166 /* CallExpression */, expression.pos); + var callExpr = createNode(168 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -10318,7 +10609,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(166 /* CallExpression */, expression.pos); + var callExpr = createNode(168 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10356,18 +10647,18 @@ var ts; case 21 /* DotToken */: // foo. case 18 /* CloseParenToken */: // foo) case 20 /* CloseBracketToken */: // foo] - case 53 /* ColonToken */: // foo: + case 54 /* ColonToken */: // foo: case 23 /* SemicolonToken */: // foo; - case 52 /* QuestionToken */: // foo? + case 53 /* QuestionToken */: // foo? case 30 /* EqualsEqualsToken */: // foo == case 32 /* EqualsEqualsEqualsToken */: // foo === case 31 /* ExclamationEqualsToken */: // foo != case 33 /* ExclamationEqualsEqualsToken */: // foo !== - case 50 /* AmpersandAmpersandToken */: // foo && - case 51 /* BarBarToken */: // foo || - case 47 /* CaretToken */: // foo ^ - case 45 /* AmpersandToken */: // foo & - case 46 /* BarToken */: // foo | + case 51 /* AmpersandAmpersandToken */: // foo && + case 52 /* BarBarToken */: // foo || + case 48 /* CaretToken */: // foo ^ + case 46 /* AmpersandToken */: // foo & + case 47 /* BarToken */: // foo | case 16 /* CloseBraceToken */: // foo } case 1 /* EndOfFileToken */: // these cases can't legally follow a type arg list. However, they're not legal @@ -10390,11 +10681,11 @@ var ts; case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - case 91 /* NullKeyword */: - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + case 93 /* NullKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: return parseTokenNode(); case 17 /* OpenParenToken */: return parseParenthesizedExpression(); @@ -10402,7 +10693,7 @@ var ts; return parseArrayLiteralExpression(); case 15 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 116 /* AsyncKeyword */: + case 118 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -10410,14 +10701,14 @@ var ts; break; } return parseFunctionExpression(); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassExpression(); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionExpression(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return parseNewExpression(); - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: if (reScanSlashToken() === 10 /* RegularExpressionLiteral */) { return parseLiteralNode(); } @@ -10428,28 +10719,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(170 /* ParenthesizedExpression */); + var node = createNode(172 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(183 /* SpreadElementExpression */); + var node = createNode(185 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(185 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(187 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(162 /* ArrayLiteralExpression */); + var node = createNode(164 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048 /* MultiLine */; @@ -10458,11 +10749,11 @@ var ts; return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(121 /* GetKeyword */)) { - return parseAccessorDeclaration(143 /* GetAccessor */, fullStart, decorators, modifiers); + if (parseContextualModifier(123 /* GetKeyword */)) { + return parseAccessorDeclaration(145 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(127 /* SetKeyword */)) { - return parseAccessorDeclaration(144 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(129 /* SetKeyword */)) { + return parseAccessorDeclaration(146 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10479,28 +10770,38 @@ var ts; var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - // Parse to check if it is short-hand property assignment or normal property assignment - if ((token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(244 /* ShorthandPropertyAssignment */, fullStart); + // check if it is short-hand property assignment or normal property assignment + // NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production + // CoverInitializedName[Yield] : + // IdentifierReference[?Yield] Initializer[In, ?Yield] + // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */ || token === 56 /* EqualsToken */); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(246 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56 /* EqualsToken */); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(243 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(245 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(163 /* ObjectLiteralExpression */); + var node = createNode(165 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048 /* MultiLine */; @@ -10519,9 +10820,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(171 /* FunctionExpression */); + var node = createNode(173 /* FunctionExpression */); setModifiers(node, parseModifiers()); - parseExpected(85 /* FunctionKeyword */); + parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); @@ -10530,7 +10831,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -10541,8 +10842,8 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(167 /* NewExpression */); - parseExpected(90 /* NewKeyword */); + var node = createNode(169 /* NewExpression */); + parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token === 17 /* OpenParenToken */) { @@ -10552,7 +10853,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(190 /* Block */); + var node = createNode(192 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10582,25 +10883,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(192 /* EmptyStatement */); + var node = createNode(194 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(194 /* IfStatement */); - parseExpected(86 /* IfKeyword */); + var node = createNode(196 /* IfStatement */); + parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(78 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(80 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(195 /* DoStatement */); - parseExpected(77 /* DoKeyword */); + var node = createNode(197 /* DoStatement */); + parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(102 /* WhileKeyword */); + parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10612,8 +10913,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(196 /* WhileStatement */); - parseExpected(102 /* WhileKeyword */); + var node = createNode(198 /* WhileStatement */); + parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10622,11 +10923,11 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(84 /* ForKeyword */); + parseExpected(86 /* ForKeyword */); parseExpected(17 /* OpenParenToken */); var initializer = undefined; if (token !== 23 /* SemicolonToken */) { - if (token === 100 /* VarKeyword */ || token === 106 /* LetKeyword */ || token === 72 /* ConstKeyword */) { + if (token === 102 /* VarKeyword */ || token === 108 /* LetKeyword */ || token === 74 /* ConstKeyword */) { initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { @@ -10634,22 +10935,22 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(88 /* InKeyword */)) { - var forInStatement = createNode(198 /* ForInStatement */, pos); + if (parseOptional(90 /* InKeyword */)) { + var forInStatement = createNode(200 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(132 /* OfKeyword */)) { - var forOfStatement = createNode(199 /* ForOfStatement */, pos); + else if (parseOptional(134 /* OfKeyword */)) { + var forOfStatement = createNode(201 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(197 /* ForStatement */, pos); + var forStatement = createNode(199 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10667,7 +10968,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */); + parseExpected(kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10675,8 +10976,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(202 /* ReturnStatement */); - parseExpected(92 /* ReturnKeyword */); + var node = createNode(204 /* ReturnStatement */); + parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -10684,8 +10985,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(203 /* WithStatement */); - parseExpected(103 /* WithKeyword */); + var node = createNode(205 /* WithStatement */); + parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); @@ -10693,30 +10994,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(239 /* CaseClause */); - parseExpected(69 /* CaseKeyword */); + var node = createNode(241 /* CaseClause */); + parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(240 /* DefaultClause */); - parseExpected(75 /* DefaultKeyword */); - parseExpected(53 /* ColonToken */); + var node = createNode(242 /* DefaultClause */); + parseExpected(77 /* DefaultKeyword */); + parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 69 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(204 /* SwitchStatement */); - parseExpected(94 /* SwitchKeyword */); + var node = createNode(206 /* SwitchStatement */); + parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(218 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(220 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10731,29 +11032,29 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(206 /* ThrowStatement */); - parseExpected(96 /* ThrowKeyword */); + var node = createNode(208 /* ThrowStatement */); + parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(207 /* TryStatement */); - parseExpected(98 /* TryKeyword */); + var node = createNode(209 /* TryStatement */); + parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); - node.catchClause = token === 70 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token === 83 /* FinallyKeyword */) { - parseExpected(83 /* FinallyKeyword */); + if (!node.catchClause || token === 85 /* FinallyKeyword */) { + parseExpected(85 /* FinallyKeyword */); node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(242 /* CatchClause */); - parseExpected(70 /* CatchKeyword */); + var result = createNode(244 /* CatchClause */); + parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); } @@ -10762,8 +11063,8 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(208 /* DebuggerStatement */); - parseExpected(74 /* DebuggerKeyword */); + var node = createNode(210 /* DebuggerStatement */); + parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -10773,14 +11074,14 @@ var ts; // a colon. var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 67 /* Identifier */ && parseOptional(53 /* ColonToken */)) { - var labeledStatement = createNode(205 /* LabeledStatement */, fullStart); + if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { + var labeledStatement = createNode(207 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(193 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(195 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -10792,7 +11093,7 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 85 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token === 87 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); @@ -10801,12 +11102,12 @@ var ts; function isDeclaration() { while (true) { switch (token) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -10829,36 +11130,36 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 105 /* InterfaceKeyword */: - case 130 /* TypeKeyword */: + case 107 /* InterfaceKeyword */: + case 132 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 116 /* AsyncKeyword */: - case 120 /* DeclareKeyword */: + case 115 /* AbstractKeyword */: + case 118 /* AsyncKeyword */: + case 122 /* DeclareKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 87 /* ImportKeyword */: + case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token); - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: nextToken(); - if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 75 /* DefaultKeyword */) { + if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { return true; } continue; - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: - case 113 /* AbstractKeyword */: + case 113 /* StaticKeyword */: nextToken(); continue; default: @@ -10871,47 +11172,47 @@ var ts; } function isStartOfStatement() { switch (token) { - case 54 /* AtToken */: + case 55 /* AtToken */: case 23 /* SemicolonToken */: case 15 /* OpenBraceToken */: - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 85 /* FunctionKeyword */: - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: - case 86 /* IfKeyword */: - case 77 /* DoKeyword */: - case 102 /* WhileKeyword */: - case 84 /* ForKeyword */: - case 73 /* ContinueKeyword */: - case 68 /* BreakKeyword */: - case 92 /* ReturnKeyword */: - case 103 /* WithKeyword */: - case 94 /* SwitchKeyword */: - case 96 /* ThrowKeyword */: - case 98 /* TryKeyword */: - case 74 /* DebuggerKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 87 /* FunctionKeyword */: + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: + case 88 /* IfKeyword */: + case 79 /* DoKeyword */: + case 104 /* WhileKeyword */: + case 86 /* ForKeyword */: + case 75 /* ContinueKeyword */: + case 70 /* BreakKeyword */: + case 94 /* ReturnKeyword */: + case 105 /* WithKeyword */: + case 96 /* SwitchKeyword */: + case 98 /* ThrowKeyword */: + case 100 /* TryKeyword */: + case 76 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return true; - case 72 /* ConstKeyword */: - case 80 /* ExportKeyword */: - case 87 /* ImportKeyword */: + case 74 /* ConstKeyword */: + case 82 /* ExportKeyword */: + case 89 /* ImportKeyword */: return isStartOfDeclaration(); - case 116 /* AsyncKeyword */: - case 120 /* DeclareKeyword */: - case 105 /* InterfaceKeyword */: - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: - case 130 /* TypeKeyword */: + case 118 /* AsyncKeyword */: + case 122 /* DeclareKeyword */: + case 107 /* InterfaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: + case 132 /* TypeKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10934,61 +11235,61 @@ var ts; return parseEmptyStatement(); case 15 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); - case 100 /* VarKeyword */: + case 102 /* VarKeyword */: return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 106 /* LetKeyword */: + case 108 /* LetKeyword */: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); } break; - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 86 /* IfKeyword */: + case 88 /* IfKeyword */: return parseIfStatement(); - case 77 /* DoKeyword */: + case 79 /* DoKeyword */: return parseDoStatement(); - case 102 /* WhileKeyword */: + case 104 /* WhileKeyword */: return parseWhileStatement(); - case 84 /* ForKeyword */: + case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 73 /* ContinueKeyword */: - return parseBreakOrContinueStatement(200 /* ContinueStatement */); - case 68 /* BreakKeyword */: - return parseBreakOrContinueStatement(201 /* BreakStatement */); - case 92 /* ReturnKeyword */: + case 75 /* ContinueKeyword */: + return parseBreakOrContinueStatement(202 /* ContinueStatement */); + case 70 /* BreakKeyword */: + return parseBreakOrContinueStatement(203 /* BreakStatement */); + case 94 /* ReturnKeyword */: return parseReturnStatement(); - case 103 /* WithKeyword */: + case 105 /* WithKeyword */: return parseWithStatement(); - case 94 /* SwitchKeyword */: + case 96 /* SwitchKeyword */: return parseSwitchStatement(); - case 96 /* ThrowKeyword */: + case 98 /* ThrowKeyword */: return parseThrowStatement(); - case 98 /* TryKeyword */: + case 100 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return parseTryStatement(); - case 74 /* DebuggerKeyword */: + case 76 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 54 /* AtToken */: + case 55 /* AtToken */: return parseDeclaration(); - case 116 /* AsyncKeyword */: - case 105 /* InterfaceKeyword */: - case 130 /* TypeKeyword */: - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: - case 120 /* DeclareKeyword */: - case 72 /* ConstKeyword */: - case 79 /* EnumKeyword */: - case 80 /* ExportKeyword */: - case 87 /* ImportKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 110 /* PublicKeyword */: - case 113 /* AbstractKeyword */: - case 111 /* StaticKeyword */: + case 118 /* AsyncKeyword */: + case 107 /* InterfaceKeyword */: + case 132 /* TypeKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: + case 122 /* DeclareKeyword */: + case 74 /* ConstKeyword */: + case 81 /* EnumKeyword */: + case 82 /* ExportKeyword */: + case 89 /* ImportKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: + case 115 /* AbstractKeyword */: + case 113 /* StaticKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -11001,35 +11302,35 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: return parseVariableStatement(fullStart, decorators, modifiers); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 71 /* ClassKeyword */: + case 73 /* ClassKeyword */: return parseClassDeclaration(fullStart, decorators, modifiers); - case 105 /* InterfaceKeyword */: + case 107 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 130 /* TypeKeyword */: + case 132 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 79 /* EnumKeyword */: + case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 123 /* ModuleKeyword */: - case 124 /* NamespaceKeyword */: + case 125 /* ModuleKeyword */: + case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 87 /* ImportKeyword */: + case 89 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: nextToken(); - return token === 75 /* DefaultKeyword */ || token === 55 /* EqualsToken */ ? + return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(229 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(231 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -11051,24 +11352,24 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(185 /* OmittedExpression */); + return createNode(187 /* OmittedExpression */); } - var node = createNode(161 /* BindingElement */); + var node = createNode(163 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(161 /* BindingElement */); + var node = createNode(163 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 53 /* ColonToken */) { + if (tokenIsIdentifier && token !== 54 /* ColonToken */) { node.name = propertyName; } else { - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -11076,14 +11377,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(159 /* ObjectBindingPattern */); + var node = createNode(161 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(160 /* ArrayBindingPattern */); + var node = createNode(162 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -11102,7 +11403,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(209 /* VariableDeclaration */); + var node = createNode(211 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -11111,14 +11412,14 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(210 /* VariableDeclarationList */); + var node = createNode(212 /* VariableDeclarationList */); switch (token) { - case 100 /* VarKeyword */: + case 102 /* VarKeyword */: break; - case 106 /* LetKeyword */: + case 108 /* LetKeyword */: node.flags |= 16384 /* Let */; break; - case 72 /* ConstKeyword */: + case 74 /* ConstKeyword */: node.flags |= 32768 /* Const */; break; default: @@ -11134,7 +11435,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 132 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 134 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -11149,7 +11450,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(191 /* VariableStatement */, fullStart); + var node = createNode(193 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -11157,29 +11458,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(211 /* FunctionDeclaration */, fullStart); + var node = createNode(213 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(85 /* FunctionKeyword */); + parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(142 /* Constructor */, pos); + var node = createNode(144 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(119 /* ConstructorKeyword */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + parseExpected(121 /* ConstructorKeyword */); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(141 /* MethodDeclaration */, fullStart); + var method = createNode(143 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -11187,12 +11488,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512 /* Async */); - fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); + fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(139 /* PropertyDeclaration */, fullStart); + var property = createNode(141 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11218,7 +11519,7 @@ var ts; var name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(52 /* QuestionToken */); + var questionToken = parseOptionalToken(53 /* QuestionToken */); if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } @@ -11234,16 +11535,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 111 /* StaticKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 113 /* StaticKeyword */: return true; default: return false; @@ -11251,7 +11552,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 54 /* AtToken */) { + if (token === 55 /* AtToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. @@ -11284,7 +11585,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 127 /* SetKeyword */ || idToken === 121 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 129 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -11292,9 +11593,9 @@ var ts; switch (token) { case 17 /* OpenParenToken */: // Method declaration case 25 /* LessThanToken */: // Generic Method declaration - case 53 /* ColonToken */: // Type Annotation for declaration - case 55 /* EqualsToken */: // Initializer for declaration - case 52 /* QuestionToken */: + case 54 /* ColonToken */: // Type Annotation for declaration + case 56 /* EqualsToken */: // Initializer for declaration + case 53 /* QuestionToken */: return true; default: // Covers @@ -11311,14 +11612,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(54 /* AtToken */)) { + if (!parseOptional(55 /* AtToken */)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(137 /* Decorator */, decoratorStart); + var decorator = createNode(139 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11352,7 +11653,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 116 /* AsyncKeyword */) { + if (token === 118 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -11367,7 +11668,7 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(189 /* SemicolonClassElement */); + var result = createNode(191 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11378,7 +11679,7 @@ var ts; if (accessor) { return accessor; } - if (token === 119 /* ConstructorKeyword */) { + if (token === 121 /* ConstructorKeyword */) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -11395,7 +11696,7 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_7 = createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var name_7 = createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. @@ -11405,17 +11706,17 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 184 /* ClassExpression */); + /*modifiers*/ undefined, 186 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(71 /* ClassKeyword */); - node.name = parseOptionalIdentifier(); + parseExpected(73 /* ClassKeyword */); + node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true); if (parseExpected(15 /* OpenBraceToken */)) { @@ -11429,6 +11730,19 @@ var ts; } return finishNode(node); } + function parseNameOfClassDeclarationOrExpression() { + // implements is a future reserved word so + // 'class implements' might mean either + // - class expression with omitted name, 'implements' starts heritage clause + // - class with name 'implements' + // 'isImplementsClause' helps to disambiguate between these two cases + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); + } function parseHeritageClauses(isClassHeritageClause) { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } @@ -11441,8 +11755,8 @@ var ts; return parseList(20 /* HeritageClauses */, parseHeritageClause); } function parseHeritageClause() { - if (token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */) { - var node = createNode(241 /* HeritageClause */); + if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { + var node = createNode(243 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11451,7 +11765,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(186 /* ExpressionWithTypeArguments */); + var node = createNode(188 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11459,16 +11773,16 @@ var ts; return finishNode(node); } function isHeritageClause() { - return token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; + return token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* InterfaceDeclaration */, fullStart); + var node = createNode(215 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(105 /* InterfaceKeyword */); + parseExpected(107 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false); @@ -11476,13 +11790,13 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214 /* TypeAliasDeclaration */, fullStart); + var node = createNode(216 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(130 /* TypeKeyword */); + parseExpected(132 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); node.type = parseType(); parseSemicolon(); return finishNode(node); @@ -11492,16 +11806,16 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(245 /* EnumMember */, scanner.getStartPos()); + var node = createNode(247 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* EnumDeclaration */, fullStart); + var node = createNode(217 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(79 /* EnumKeyword */); + parseExpected(81 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(15 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); @@ -11513,7 +11827,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(217 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(219 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11524,7 +11838,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(216 /* ModuleDeclaration */, fullStart); + var node = createNode(218 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 131072 /* Namespace */; @@ -11538,7 +11852,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216 /* ModuleDeclaration */, fullStart); + var node = createNode(218 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(/*internName*/ true); @@ -11547,11 +11861,11 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(124 /* NamespaceKeyword */)) { + if (parseOptional(126 /* NamespaceKeyword */)) { flags |= 131072 /* Namespace */; } else { - parseExpected(123 /* ModuleKeyword */); + parseExpected(125 /* ModuleKeyword */); if (token === 9 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -11559,42 +11873,42 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 125 /* RequireKeyword */ && + return token === 127 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 17 /* OpenParenToken */; } function nextTokenIsSlash() { - return nextToken() === 38 /* SlashToken */; + return nextToken() === 39 /* SlashToken */; } function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 24 /* CommaToken */ || - token === 131 /* FromKeyword */; + token === 133 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(87 /* ImportKeyword */); + parseExpected(89 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 131 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 133 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(219 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(221 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(55 /* EqualsToken */); + parseExpected(56 /* EqualsToken */); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } // Import statement - var importDeclaration = createNode(220 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(222 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11604,7 +11918,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(131 /* FromKeyword */); + parseExpected(133 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11617,7 +11931,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(221 /* ImportClause */, fullStart); + var importClause = createNode(223 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11627,7 +11941,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(223 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(225 /* NamedImports */); } return finishNode(importClause); } @@ -11637,8 +11951,8 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(230 /* ExternalModuleReference */); - parseExpected(125 /* RequireKeyword */); + var node = createNode(232 /* ExternalModuleReference */); + parseExpected(127 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(18 /* CloseParenToken */); @@ -11659,9 +11973,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(222 /* NamespaceImport */); + var namespaceImport = createNode(224 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); - parseExpected(114 /* AsKeyword */); + parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -11674,14 +11988,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 223 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 225 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(228 /* ExportSpecifier */); + return parseImportOrExportSpecifier(230 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(224 /* ImportSpecifier */); + return parseImportOrExportSpecifier(226 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11695,9 +12009,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 114 /* AsKeyword */) { + if (token === 116 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(114 /* AsKeyword */); + parseExpected(116 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -11706,27 +12020,27 @@ var ts; else { node.name = identifierName; } - if (kind === 224 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 226 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226 /* ExportDeclaration */, fullStart); + var node = createNode(228 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(131 /* FromKeyword */); + parseExpected(133 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(227 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(229 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 131 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(131 /* FromKeyword */); + if (token === 133 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(133 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11734,14 +12048,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(225 /* ExportAssignment */, fullStart); + var node = createNode(227 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(55 /* EqualsToken */)) { + if (parseOptional(56 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(75 /* DefaultKeyword */); + parseExpected(77 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -11807,10 +12121,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */ - || node.kind === 220 /* ImportDeclaration */ - || node.kind === 225 /* ExportAssignment */ - || node.kind === 226 /* ExportDeclaration */ + || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ + || node.kind === 222 /* ImportDeclaration */ + || node.kind === 227 /* ExportAssignment */ + || node.kind === 228 /* ExportDeclaration */ ? node : undefined; }); @@ -11856,22 +12170,22 @@ var ts; function isJSDocType() { switch (token) { case 37 /* AsteriskToken */: - case 52 /* QuestionToken */: + case 53 /* QuestionToken */: case 17 /* OpenParenToken */: case 19 /* OpenBracketToken */: - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: case 15 /* OpenBraceToken */: - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: case 22 /* DotDotDotToken */: - case 90 /* NewKeyword */: - case 95 /* ThisKeyword */: + case 92 /* NewKeyword */: + case 97 /* ThisKeyword */: return true; } return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -11885,7 +12199,7 @@ var ts; scanner.setText(sourceText, start, length); // Prime the first token for us to start processing. token = nextToken(); - var result = createNode(247 /* JSDocTypeExpression */); + var result = createNode(249 /* JSDocTypeExpression */); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -11895,13 +12209,13 @@ var ts; JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 46 /* BarToken */) { - var unionType = createNode(251 /* JSDocUnionType */, type.pos); + if (token === 47 /* BarToken */) { + var unionType = createNode(253 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 55 /* EqualsToken */) { - var optionalType = createNode(258 /* JSDocOptionalType */, type.pos); + if (token === 56 /* EqualsToken */) { + var optionalType = createNode(260 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11912,20 +12226,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(250 /* JSDocArrayType */, type.pos); + var arrayType = createNode(252 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } - else if (token === 52 /* QuestionToken */) { - var nullableType = createNode(253 /* JSDocNullableType */, type.pos); + else if (token === 53 /* QuestionToken */) { + var nullableType = createNode(255 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 48 /* ExclamationToken */) { - var nonNullableType = createNode(254 /* JSDocNonNullableType */, type.pos); + else if (token === 49 /* ExclamationToken */) { + var nonNullableType = createNode(256 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11940,80 +12254,80 @@ var ts; switch (token) { case 37 /* AsteriskToken */: return parseJSDocAllType(); - case 52 /* QuestionToken */: + case 53 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); case 17 /* OpenParenToken */: return parseJSDocUnionType(); case 19 /* OpenBracketToken */: return parseJSDocTupleType(); - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: return parseJSDocNonNullableType(); case 15 /* OpenBraceToken */: return parseJSDocRecordType(); - case 85 /* FunctionKeyword */: + case 87 /* FunctionKeyword */: return parseJSDocFunctionType(); case 22 /* DotDotDotToken */: return parseJSDocVariadicType(); - case 90 /* NewKeyword */: + case 92 /* NewKeyword */: return parseJSDocConstructorType(); - case 95 /* ThisKeyword */: + case 97 /* ThisKeyword */: return parseJSDocThisType(); - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(262 /* JSDocThisType */); + var result = createNode(264 /* JSDocThisType */); nextToken(); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(261 /* JSDocConstructorType */); + var result = createNode(263 /* JSDocConstructorType */); nextToken(); - parseExpected(53 /* ColonToken */); + parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(260 /* JSDocVariadicType */); + var result = createNode(262 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(259 /* JSDocFunctionType */); + var result = createNode(261 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); checkForTrailingComma(result.parameters); parseExpected(18 /* CloseParenToken */); - if (token === 53 /* ColonToken */) { + if (token === 54 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(136 /* Parameter */); + var parameter = createNode(138 /* Parameter */); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(258 /* JSDocOptionalType */, type.pos); + var result = createNode(260 /* JSDocOptionalType */, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(257 /* JSDocTypeReference */); + var result = createNode(259 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); while (parseOptional(21 /* DotToken */)) { if (token === 25 /* LessThanToken */) { @@ -12043,13 +12357,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(133 /* QualifiedName */, left.pos); + var result = createNode(135 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(255 /* JSDocRecordType */); + var result = createNode(257 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -12057,22 +12371,22 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(256 /* JSDocRecordMember */); + var result = createNode(258 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); - if (token === 53 /* ColonToken */) { + if (token === 54 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(254 /* JSDocNonNullableType */); + var result = createNode(256 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(252 /* JSDocTupleType */); + var result = createNode(254 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -12086,7 +12400,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(251 /* JSDocUnionType */); + var result = createNode(253 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -12097,14 +12411,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(46 /* BarToken */)) { + while (parseOptional(47 /* BarToken */)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(248 /* JSDocAllType */); + var result = createNode(250 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -12125,19 +12439,19 @@ var ts; token === 16 /* CloseBraceToken */ || token === 18 /* CloseParenToken */ || token === 27 /* GreaterThanToken */ || - token === 55 /* EqualsToken */ || - token === 46 /* BarToken */) { - var result = createNode(249 /* JSDocUnknownType */, pos); + token === 56 /* EqualsToken */ || + token === 47 /* BarToken */) { + var result = createNode(251 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(253 /* JSDocNullableType */, pos); + var result = createNode(255 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -12219,7 +12533,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(263 /* JSDocComment */, start); + var result = createNode(265 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12230,7 +12544,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(54 /* AtToken */, pos - 1); + var atToken = createNode(55 /* AtToken */, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -12256,7 +12570,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(264 /* JSDocTag */, atToken.pos); + var result = createNode(266 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -12307,7 +12621,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(265 /* JSDocParameterTag */, atToken.pos); + var result = createNode(267 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12317,27 +12631,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266 /* JSDocReturnTag */, atToken.pos); + var result = createNode(268 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 269 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(267 /* JSDocTypeTag */, atToken.pos); + var result = createNode(269 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 270 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -12350,7 +12664,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(135 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(137 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -12361,7 +12675,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(268 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(270 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -12382,7 +12696,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(67 /* Identifier */, startPos); + var result = createNode(69 /* Identifier */, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -12505,7 +12819,7 @@ var ts; switch (node.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 67 /* Identifier */: + case 69 /* Identifier */: return true; } return false; @@ -12898,17 +13212,19 @@ var ts; var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; + var symbolCount = 0; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, @@ -12999,6 +13315,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var cjsRequireType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -13069,6 +13386,7 @@ var ts; diagnostics.add(diagnostic); } function createSymbol(flags, name) { + symbolCount++; return new Symbol(flags, name); } function getExcludedSymbolFlags(flags) { @@ -13198,10 +13516,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 246 /* SourceFile */); + return ts.getAncestor(node, 248 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 246 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -13220,18 +13538,62 @@ var ts; } // return undefined if we can't find a symbol. } - /** Returns true if node1 is defined before node 2**/ - function isDefinedBefore(node1, node2) { - var file1 = ts.getSourceFileOfNode(node1); - var file2 = ts.getSourceFileOfNode(node2); - if (file1 === file2) { - return node1.pos <= node2.pos; + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + // nodes are in different files and order cannot be determines + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } - if (!compilerOptions.outFile && !compilerOptions.out) { - return true; + if (declaration.pos <= usage.pos) { + // declaration is before usage + // still might be illegal if usage is in the initializer of the variable declaration + return declaration.kind !== 211 /* VariableDeclaration */ || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + // declaration is after usage + // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + if (declaration.parent.parent.kind === 193 /* VariableStatement */ || + declaration.parent.parent.kind === 199 /* ForStatement */) { + // variable statement/for statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + return isSameScopeDescendentOf(usage, declaration, container); + } + else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ || + declaration.parent.parent.kind === 200 /* ForInStatement */) { + // ForIn/ForOf case - use site should not be used in expression part + var expression = declaration.parent.parent.expression; + return isSameScopeDescendentOf(usage, expression, container); + } + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 141 /* PropertyDeclaration */ && + (current.parent.flags & 128 /* Static */) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; } - var sourceFiles = host.getSourceFiles(); - return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with @@ -13258,13 +13620,13 @@ var ts; } } switch (location.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location)) + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) break; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 246 /* SourceFile */ || - (location.kind === 216 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { + if (location.kind === 248 /* SourceFile */ || + (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { // It's an external module. Because of module/namespace merging, a module's exports are in scope, // yet we never want to treat an export specifier as putting a member in scope. Therefore, // if the name we find is purely an export specifier, it is not actually considered in scope. @@ -13278,7 +13640,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 228 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { break; } result = moduleExports["default"]; @@ -13292,13 +13654,13 @@ var ts; break loop; } break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -13315,9 +13677,9 @@ var ts; } } break; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -13328,7 +13690,7 @@ var ts; } break loop; } - if (location.kind === 184 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 186 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -13344,9 +13706,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 213 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 215 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -13354,19 +13716,19 @@ var ts; } } break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 171 /* FunctionExpression */: + case 173 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -13379,7 +13741,7 @@ var ts; } } break; - case 137 /* Decorator */: + case 139 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -13388,7 +13750,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 136 /* Parameter */) { + if (location.parent && location.parent.kind === 138 /* Parameter */) { location = location.parent; } // @@ -13434,8 +13796,11 @@ var ts; // block - scope variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, // we want to check for block- scoped - if (meaning & 2 /* BlockScopedVariable */ && result.flags & 2 /* BlockScopedVariable */) { - checkResolvedBlockScopedVariable(result, errorLocation); + if (meaning & 2 /* BlockScopedVariable */) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } } } return result; @@ -13445,32 +13810,7 @@ var ts; // Block-scoped variables cannot be used before their definition var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - // first check if usage is lexically located after the declaration - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - // lexical check succeeded however code still can be illegal. - // - block scoped variables cannot be used in its initializers - // let x = x; // illegal but usage is lexically after definition - // - in ForIn/ForOf statements variable cannot be contained in expression part - // for (let x in x) - // for (let x of x) - // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 209 /* VariableDeclaration */); - var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 191 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 197 /* ForStatement */) { - // variable statement/for statement case, - // use site should not be inside variable declaration (initializer of declaration or binding element) - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); - } - else if (variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 198 /* ForInStatement */) { - // ForIn/ForOf case - use site should not be used in expression part - var expression = variableDeclaration.parent.parent.expression; - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); - } - } - if (isUsedBeforeDeclaration) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -13491,10 +13831,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 219 /* ImportEqualsDeclaration */) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 220 /* ImportDeclaration */) { + while (node && node.kind !== 222 /* ImportDeclaration */) { node = node.parent; } return node; @@ -13504,7 +13844,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 230 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 232 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -13611,17 +13951,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 221 /* ImportClause */: + case 223 /* ImportClause */: return getTargetOfImportClause(node); - case 222 /* NamespaceImport */: + case 224 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 224 /* ImportSpecifier */: + case 226 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 228 /* ExportSpecifier */: + case 230 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -13666,11 +14006,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 225 /* ExportAssignment */) { + if (node.kind === 227 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 228 /* ExportSpecifier */) { + else if (node.kind === 230 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -13683,7 +14023,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 219 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 221 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -13692,17 +14032,17 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 67 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 69 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 67 /* Identifier */ || entityName.parent.kind === 133 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 135 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 219 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 221 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -13715,16 +14055,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 67 /* Identifier */) { + if (name.kind === 69 /* Identifier */) { var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 133 /* QualifiedName */ || name.kind === 164 /* PropertyAccessExpression */) { - var left = name.kind === 133 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 133 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 135 /* QualifiedName */ || name.kind === 166 /* PropertyAccessExpression */) { + var left = name.kind === 135 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 135 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -13743,11 +14083,6 @@ var ts; ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } - function isExternalModuleNameRelative(moduleName) { - // TypeScript 1.0 spec (April 2014): 11.2.1 - // An external module name is "relative" if the first term is "." or "..". - return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; - } function resolveExternalModuleName(location, moduleReferenceExpression) { if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { return; @@ -13760,7 +14095,10 @@ var ts; if (moduleName === undefined) { return; } - var isRelative = isExternalModuleNameRelative(moduleName); + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } + var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); if (symbol) { @@ -13876,7 +14214,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 142 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -13946,17 +14284,17 @@ var ts; } } switch (location_1.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location_1)) { + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -13997,7 +14335,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -14034,7 +14372,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -14107,8 +14445,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 216 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 246 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || + (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -14144,12 +14482,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 152 /* TypeQuery */) { + if (entityName.parent.kind === 154 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 133 /* QualifiedName */ || entityName.kind === 164 /* PropertyAccessExpression */ || - entityName.parent.kind === 219 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 135 /* QualifiedName */ || entityName.kind === 166 /* PropertyAccessExpression */ || + entityName.parent.kind === 221 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -14204,10 +14542,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 158 /* ParenthesizedType */) { + while (node.kind === 160 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 216 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -14221,10 +14559,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: return "(Anonymous class)"; - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -14307,6 +14645,7 @@ var ts; } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; + var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any @@ -14316,6 +14655,12 @@ var ts; ? "any" : type.intrinsicName); } + else if (type.flags & 33554432 /* ThisType */) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } else if (type.flags & 4096 /* Reference */) { writeTypeReference(type, flags); } @@ -14357,11 +14702,10 @@ var ts; writeType(types[i], delimiter === 24 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); } } - function writeSymbolTypeReference(symbol, typeArguments, pos, end) { - // Unnamed function expressions, arrow functions, and unnamed class expressions have reserved names that - // we don't want to display - if (!isReservedMemberName(symbol.name)) { - buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */); + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + // Unnamed function expressions and arrow functions have reserved names that we don't want to display + if (symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */, 0 /* None */, flags); } if (pos < end) { writePunctuation(writer, 25 /* LessThanToken */); @@ -14375,7 +14719,7 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments; + var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(typeArguments[0], 64 /* InElementType */); writePunctuation(writer, 19 /* OpenBracketToken */); @@ -14399,12 +14743,13 @@ var ts; // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i); + writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } } - writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length); + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } function writeTupleType(type) { @@ -14416,7 +14761,7 @@ var ts; if (flags & 64 /* InElementType */) { writePunctuation(writer, 17 /* OpenParenToken */); } - writeTypeList(type.types, type.flags & 16384 /* Union */ ? 46 /* BarToken */ : 45 /* AmpersandToken */); + writeTypeList(type.types, type.flags & 16384 /* Union */ ? 47 /* BarToken */ : 46 /* AmpersandToken */); if (flags & 64 /* InElementType */) { writePunctuation(writer, 18 /* CloseParenToken */); } @@ -14440,7 +14785,7 @@ var ts; } else { // Recursive usage, use any - writeKeyword(writer, 115 /* AnyKeyword */); + writeKeyword(writer, 117 /* AnyKeyword */); } } else { @@ -14464,7 +14809,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 246 /* SourceFile */ || declaration.parent.kind === 217 /* ModuleBlock */; + return declaration.parent.kind === 248 /* SourceFile */ || declaration.parent.kind === 219 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -14474,7 +14819,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 99 /* TypeOfKeyword */); + writeKeyword(writer, 101 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } @@ -14510,7 +14855,7 @@ var ts; if (flags & 64 /* InElementType */) { writePunctuation(writer, 17 /* OpenParenToken */); } - writeKeyword(writer, 90 /* NewKeyword */); + writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { @@ -14519,6 +14864,8 @@ var ts; return; } } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; writePunctuation(writer, 15 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); @@ -14530,7 +14877,7 @@ var ts; } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 90 /* NewKeyword */); + writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14540,11 +14887,11 @@ var ts; // [x: string]: writePunctuation(writer, 19 /* OpenBracketToken */); writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 128 /* StringKeyword */); + writeKeyword(writer, 130 /* StringKeyword */); writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14554,11 +14901,11 @@ var ts; // [x: number]: writePunctuation(writer, 19 /* OpenBracketToken */); writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 126 /* NumberKeyword */); + writeKeyword(writer, 128 /* NumberKeyword */); writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14573,7 +14920,7 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14583,9 +14930,9 @@ var ts; else { buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); writePunctuation(writer, 23 /* SemicolonToken */); @@ -14594,6 +14941,7 @@ var ts; } writer.decreaseIndent(); writePunctuation(writer, 16 /* CloseBraceToken */); + inObjectTypeLiteral = saveInObjectTypeLiteral; } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -14607,7 +14955,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 81 /* ExtendsKeyword */); + writeKeyword(writer, 83 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -14619,9 +14967,9 @@ var ts; } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 52 /* QuestionToken */); + writePunctuation(writer, 53 /* QuestionToken */); } - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } @@ -14668,14 +15016,14 @@ var ts; writePunctuation(writer, 34 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 53 /* ColonToken */); + writePunctuation(writer, 54 /* ColonToken */); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 122 /* IsKeyword */); + writeKeyword(writer, 124 /* IsKeyword */); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -14711,13 +15059,13 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 216 /* ModuleDeclaration */) { + if (node.kind === 218 /* ModuleDeclaration */) { if (node.name.kind === 9 /* StringLiteral */) { return node; } } - else if (node.kind === 246 /* SourceFile */) { - return ts.isExternalModule(node) ? node : undefined; + else if (node.kind === 248 /* SourceFile */) { + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -14765,70 +15113,70 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 161 /* BindingElement */: + case 163 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 211 /* FunctionDeclaration */: - case 215 /* EnumDeclaration */: - case 219 /* ImportEqualsDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 213 /* FunctionDeclaration */: + case 217 /* EnumDeclaration */: + case 221 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 219 /* ImportEqualsDeclaration */ && parent_4.kind !== 246 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_4); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 142 /* Constructor */: - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 147 /* IndexSignature */: - case 136 /* Parameter */: - case 217 /* ModuleBlock */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 153 /* TypeLiteral */: - case 149 /* TypeReference */: - case 154 /* ArrayType */: - case 155 /* TupleType */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 158 /* ParenthesizedType */: + case 144 /* Constructor */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 149 /* IndexSignature */: + case 138 /* Parameter */: + case 219 /* ModuleBlock */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 155 /* TypeLiteral */: + case 151 /* TypeReference */: + case 156 /* ArrayType */: + case 157 /* TupleType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: + case 160 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: return false; // Type parameters are always visible - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: // Source file is always visible - case 246 /* SourceFile */: + case 248 /* SourceFile */: return true; - // Export assignements do not create name bindings outside the module - case 225 /* ExportAssignment */: + // Export assignments do not create name bindings outside the module + case 227 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -14844,10 +15192,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 225 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 227 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 228 /* ExportSpecifier */) { + else if (node.parent.kind === 230 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -14939,7 +15287,7 @@ var ts; node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 209 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 211 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -14957,10 +15305,16 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } + // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been + // assigned by contextual typing. + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } // Return the inferred type for a binding element function getTypeForBindingElement(declaration) { var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + var parentType = getTypeForBindingElementParent(pattern.parent); // If parent has the unknown (error) type, then so does this binding element if (parentType === unknownType) { return unknownType; @@ -14975,7 +15329,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 159 /* ObjectBindingPattern */) { + if (pattern.kind === 161 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -15019,10 +15373,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 198 /* ForInStatement */) { + if (declaration.parent.parent.kind === 200 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 199 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 201 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -15036,11 +15390,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136 /* Parameter */) { + if (declaration.kind === 138 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 144 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143 /* GetAccessor */); + if (func.kind === 146 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -15056,7 +15410,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 244 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 246 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -15102,7 +15456,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. - var elementTypes = ts.map(elements, function (e) { return e.kind === 185 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 187 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -15118,7 +15472,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 159 /* ObjectBindingPattern */ + return pattern.kind === 161 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -15140,14 +15494,14 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 243 /* PropertyAssignment */ ? getWidenedType(type) : type; + return declaration.kind !== 245 /* PropertyAssignment */ ? getWidenedType(type) : type; } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 136 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 138 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -15162,13 +15516,21 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 242 /* CatchClause */) { + if (declaration.parent.kind === 244 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 225 /* ExportAssignment */) { + if (declaration.kind === 227 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } + // Handle module.exports = expr + if (declaration.kind === 181 /* BinaryExpression */) { + return links.type = checkExpression(declaration.right); + } + // Handle exports.p = expr + if (declaration.kind === 166 /* PropertyAccessExpression */) { + return checkExpressionCached(declaration.parent.right); + } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; @@ -15194,7 +15556,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 143 /* GetAccessor */) { + if (accessor.kind === 145 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -15210,8 +15572,8 @@ var ts; if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 144 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 146 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -15240,7 +15602,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -15340,9 +15702,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */ || - node.kind === 211 /* FunctionDeclaration */ || node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */ || node.kind === 172 /* ArrowFunction */) { + if (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */ || + node.kind === 213 /* FunctionDeclaration */ || node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */ || node.kind === 174 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -15352,7 +15714,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -15361,8 +15723,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 212 /* ClassDeclaration */ || - node.kind === 184 /* ClassExpression */ || node.kind === 214 /* TypeAliasDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 214 /* ClassDeclaration */ || + node.kind === 186 /* ClassExpression */ || node.kind === 216 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -15482,7 +15844,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 213 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 215 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -15503,6 +15865,32 @@ var ts; } } } + // Returns true if the interface given by the symbol is free of "this" references. Specifically, the result is + // true if the interface itself contains no references to "this" in its body, if all base types are interfaces, + // and if none of the base interfaces have a "this" type. + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 215 /* InterfaceDeclaration */) { + if (declaration.flags & 524288 /* ContainsThis */) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0; _b < baseTypeNodes.length; _b++) { + var node = baseTypeNodes[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056 /* Type */, /*ignoreErrors*/ true); + if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -15510,7 +15898,12 @@ var ts; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - if (outerTypeParameters || localTypeParameters) { + // A class or interface is generic if it has type parameters or a "this" type. We always give classes a "this" type + // because it is not feasible to analyze all members to determine if the "this" type escapes the class (in particular, + // property types inferred from initializers and method return types inferred from return statements are very hard + // to exhaustively analyze). We give interfaces a "this" type if we can't definitely determine that they are free of + // "this" references. + if (outerTypeParameters || localTypeParameters || kind === 1024 /* Class */ || !isIndependentInterface(symbol)) { type.flags |= 4096 /* Reference */; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; @@ -15519,6 +15912,9 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; + type.thisType = createType(512 /* TypeParameter */ | 33554432 /* ThisType */); + type.thisType.symbol = symbol; + type.thisType.constraint = getTypeWithThisArgument(type); } } return links.declaredType; @@ -15531,7 +15927,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 214 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 216 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -15564,7 +15960,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -15597,6 +15993,79 @@ var ts; } return unknownType; } + // A type reference is considered independent if each type argument is considered independent. + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + // A type is considered independent if it the any, string, number, boolean, symbol, or void keyword, a string + // literal type, an array with an element type that is considered independent, or a type reference that is + // considered independent. + function isIndependentType(node) { + switch (node.kind) { + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 9 /* StringLiteral */: + return true; + case 156 /* ArrayType */: + return isIndependentType(node.elementType); + case 151 /* TypeReference */: + return isIndependentTypeReference(node); + } + return false; + } + // A variable-like declaration is considered independent (free of this references) if it has a type annotation + // that specifies an independent type, or if it has no type annotation and no initializer (and thus of type any). + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + // A function-like declaration is considered independent (free of this references) if it has a return type + // annotation that is considered independent and if each parameter is considered independent. + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 144 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + // Returns true if the class or interface member given by the symbol is free of "this" references. The + // function may return false for symbols that are actually free of "this" references because it is not + // feasible to perform a complete analysis in all cases. In particular, property members with types + // inferred from their initializers and function members with inferred return types are convervatively + // assumed not to be free of "this" references. + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return isIndependentVariableLikeDeclaration(declaration); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } function createSymbolTable(symbols) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { @@ -15605,11 +16074,13 @@ var ts; } return result; } - function createInstantiatedSymbolTable(symbols, mapper) { + // The mappingThisOnly flag indicates that the only type parameter being mapped is "this". When the flag is true, + // we check symbols to see if we can quickly conclude they are free of "this" references, thus needing no instantiation. + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; - result[symbol.name] = instantiateSymbol(symbol, mapper); + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } @@ -15640,44 +16111,54 @@ var ts; } return type; } - function resolveClassOrInterfaceMembers(type) { - var target = resolveDeclaredMembers(type); - var members = target.symbol.members; - var callSignatures = target.declaredCallSignatures; - var constructSignatures = target.declaredConstructSignatures; - var stringIndexType = target.declaredStringIndexType; - var numberIndexType = target.declaredNumberIndexType; - var baseTypes = getBaseTypes(target); + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096 /* Reference */) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexType = source.declaredStringIndexType; + var numberIndexType = source.declaredNumberIndexType; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexType = instantiateType(source.declaredStringIndexType, mapper); + numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + } + var baseTypes = getBaseTypes(source); if (baseTypes.length) { - members = createSymbolTable(target.declaredProperties); + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0; _i < baseTypes.length; _i++) { var baseType = baseTypes[_i]; - addInheritedMembers(members, getPropertiesOfObjectType(baseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1 /* Number */); + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); } } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } function resolveTypeReferenceMembers(type) { - var target = resolveDeclaredMembers(type.target); - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; - ts.forEach(getBaseTypes(target), function (baseType) { - var instantiatedBaseType = instantiateType(baseType, mapper); - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); - }); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); @@ -15726,7 +16207,9 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true))); + var arrayElementType = getUnionType(type.elementTypes, /*noSubtypeReduction*/ true); + // Make the tuple type itself the 'this' type by including an extra type argument + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -15842,7 +16325,14 @@ var ts; var constructSignatures; var stringIndexType; var numberIndexType; - if (symbol.flags & 2048 /* TypeLiteral */) { + if (type.target) { + members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); + callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); + constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); + stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0 /* String */), type.mapper); + numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1 /* Number */), type.mapper); + } + else if (symbol.flags & 2048 /* TypeLiteral */) { members = symbol.members; callSignatures = getSignaturesOfSymbol(members["__call"]); constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -15879,7 +16369,10 @@ var ts; } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (type.flags & 4096 /* Reference */) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { resolveClassOrInterfaceMembers(type); } else if (type.flags & 65536 /* Anonymous */) { @@ -15894,9 +16387,6 @@ var ts; else if (type.flags & 32768 /* Intersection */) { resolveIntersectionTypeMembers(type); } - else { - resolveTypeReferenceMembers(type); - } } return type; } @@ -16125,7 +16615,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 142 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 144 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -16157,7 +16647,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 148 /* TypePredicate */) { + if (declaration.type.kind === 150 /* TypePredicate */) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -16169,8 +16659,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 143 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 144 /* SetAccessor */); + if (declaration.kind === 145 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 146 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -16188,19 +16678,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -16215,6 +16705,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { @@ -16277,7 +16777,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 142 /* Constructor */ || signature.declaration.kind === 146 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 144 /* Constructor */ || signature.declaration.kind === 148 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -16291,7 +16791,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 126 /* NumberKeyword */ : 128 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 128 /* NumberKeyword */ : 130 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -16320,30 +16820,33 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137 /* TypeParameter */).parent); } function getTypeListId(types) { - switch (types.length) { - case 1: - return "" + types[0].id; - case 2: - return types[0].id + "," + types[1].id; - default: - var result = ""; - for (var i = 0; i < types.length; i++) { - if (i > 0) { - result += ","; + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; } - result += types[i].id; - } - return result; + return result; + } } + return ""; } // This function is used to propagate certain flags when creating new object type references and union types. // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type @@ -16361,7 +16864,7 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getPropagatingFlagsOfTypes(typeArguments); + var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -16380,13 +16883,13 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 149 /* TypeReference */ && n.typeName.kind === 67 /* Identifier */) { + if (n.kind === 151 /* TypeReference */ && n.typeName.kind === 69 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -16473,7 +16976,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 149 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 151 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -16505,9 +17008,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: return declaration; } } @@ -16548,10 +17051,13 @@ var ts; * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); - var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); + var typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace, name) { + var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */ | 107455 /* Value */); + } function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -16567,17 +17073,17 @@ var ts; /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ - function createTypeFromGenericGlobalType(genericGlobalType, elementType) { - return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType; + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, elementType); + return createTypeFromGenericGlobalType(globalIterableType, [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType); + return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); } function createArrayType(elementType) { - return createTypeFromGenericGlobalType(globalArrayType, elementType); + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -16749,48 +17255,68 @@ var ts; } return links.resolvedType; } + function getThisType(node) { + var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { + if (!(container.flags & 128 /* Static */)) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } function getTypeFromTypeNode(node) { switch (node.kind) { - case 115 /* AnyKeyword */: + case 117 /* AnyKeyword */: return anyType; - case 128 /* StringKeyword */: + case 130 /* StringKeyword */: return stringType; - case 126 /* NumberKeyword */: + case 128 /* NumberKeyword */: return numberType; - case 118 /* BooleanKeyword */: + case 120 /* BooleanKeyword */: return booleanType; - case 129 /* SymbolKeyword */: + case 131 /* SymbolKeyword */: return esSymbolType; - case 101 /* VoidKeyword */: + case 103 /* VoidKeyword */: return voidType; + case 97 /* ThisKeyword */: + return getTypeFromThisTypeNode(node); case 9 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return getTypeFromTypeReference(node); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return booleanType; - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 155 /* TupleType */: + case 157 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 156 /* UnionType */: + case 158 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 157 /* IntersectionType */: + case 159 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 153 /* TypeLiteral */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 155 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -16894,7 +17420,7 @@ var ts; type: instantiateType(signature.typePredicate.type, mapper) }; } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -16932,21 +17458,13 @@ var ts; } // Mark the anonymous type as instantiated such that our infinite instantiation detection logic can recognize it var result = createObjectType(65536 /* Anonymous */ | 131072 /* Instantiated */, type.symbol); - result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); - result.members = createSymbolTable(result.properties); - result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); - result.constructSignatures = instantiateList(getSignaturesOfType(type, 1 /* Construct */), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); - if (stringIndexType) - result.stringIndexType = instantiateType(stringIndexType, mapper); - if (numberIndexType) - result.numberIndexType = instantiateType(numberIndexType, mapper); + result.target = type; + result.mapper = mapper; mapper.instantiations[type.id] = result; return result; } function instantiateType(type, mapper) { - if (mapper !== identityMapper) { + if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } @@ -16972,27 +17490,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 179 /* BinaryExpression */: - return node.operatorToken.kind === 51 /* BarBarToken */ && + case 181 /* BinaryExpression */: + return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 243 /* PropertyAssignment */: + case 245 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -17176,7 +17694,7 @@ var ts; else { if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if relationship holds for all type arguments - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; } } @@ -17205,7 +17723,7 @@ var ts; if (source.flags & 80896 /* ObjectType */ && target.flags & 80896 /* ObjectType */) { if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if all type arguments are identical - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, /*reportErrors*/ false)) { + if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) { return result; } } @@ -17322,9 +17840,14 @@ var ts; } return result; } - function typesRelatedTo(sources, targets, reportErrors) { + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0 /* False */; + } var result = -1 /* True */; - for (var i = 0, len = sources.length; i < len; i++) { + for (var i = 0; i < targets.length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0 /* False */; @@ -17542,7 +18065,7 @@ var ts; if (kind === 1 /* Construct */) { // Only want to compare the construct signatures for abstractness guarantees. // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform + // (internally we are checking the corresponding declaration), it is enough to perform // the check and report an error once over all pairs of source and target construct signatures. // // sourceSig and targetSig are (possibly) undefined. @@ -18042,22 +18565,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 136 /* Parameter */: + case 138 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -18167,9 +18690,10 @@ var ts; } else if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { // If source and target are references to the same generic type, infer from type arguments - var sourceTypes = source.typeArguments; - var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } @@ -18347,10 +18871,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return true; - case 67 /* Identifier */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 135 /* QualifiedName */: node = node.parent; continue; default: @@ -18396,12 +18920,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 55 /* FirstAssignment */ && node.operatorToken.kind <= 66 /* LastAssignment */) { + if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { var n = node.left; - while (n.kind === 170 /* ParenthesizedExpression */) { + while (n.kind === 172 /* ParenthesizedExpression */) { n = n.expression; } - if (n.kind === 67 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -18415,55 +18939,55 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: - case 170 /* ParenthesizedExpression */: - case 177 /* PrefixUnaryExpression */: - case 173 /* DeleteExpression */: - case 176 /* AwaitExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 178 /* PostfixUnaryExpression */: - case 182 /* YieldExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 190 /* Block */: - case 191 /* VariableStatement */: - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 202 /* ReturnStatement */: - case 203 /* WithStatement */: - case 204 /* SwitchStatement */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 206 /* ThrowStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - case 233 /* JsxOpeningElement */: - case 238 /* JsxExpression */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: + case 172 /* ParenthesizedExpression */: + case 179 /* PrefixUnaryExpression */: + case 175 /* DeleteExpression */: + case 178 /* AwaitExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 180 /* PostfixUnaryExpression */: + case 184 /* YieldExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 192 /* Block */: + case 193 /* VariableStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 204 /* ReturnStatement */: + case 205 /* WithStatement */: + case 206 /* SwitchStatement */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 208 /* ThrowStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + case 235 /* JsxOpeningElement */: + case 240 /* JsxExpression */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -18480,37 +19004,37 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 194 /* IfStatement */: + case 196 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); } break; - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); } break; - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { - if (node.operatorToken.kind === 50 /* AmpersandAmpersandToken */) { + if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); } - else if (node.operatorToken.kind === 51 /* BarBarToken */) { + else if (node.operatorToken.kind === 52 /* BarBarToken */) { narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); } } break; - case 246 /* SourceFile */: - case 216 /* ModuleDeclaration */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: + case 248 /* SourceFile */: + case 218 /* ModuleDeclaration */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -18527,12 +19051,12 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 174 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + if (expr.left.kind !== 176 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 67 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; @@ -18592,7 +19116,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -18664,27 +19188,27 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 166 /* CallExpression */: + case 168 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: var operator = expr.operatorToken.kind; if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 50 /* AmpersandAmpersandToken */) { + else if (operator === 51 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 51 /* BarBarToken */) { + else if (operator === 52 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 89 /* InstanceOfKeyword */) { + else if (operator === 91 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 177 /* PrefixUnaryExpression */: - if (expr.operator === 48 /* ExclamationToken */) { + case 179 /* PrefixUnaryExpression */: + if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -18702,7 +19226,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 172 /* ArrowFunction */) { + if (container.kind === 174 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -18733,7 +19257,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 242 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { return; } // - check if binding is used in some function @@ -18742,12 +19266,12 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 210 /* VariableDeclarationList */) { + while (container.kind !== 212 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 191 /* VariableStatement */) { + if (container.kind === 193 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } @@ -18767,7 +19291,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 139 /* PropertyDeclaration */ || container.kind === 142 /* Constructor */) { + if (container.kind === 141 /* PropertyDeclaration */ || container.kind === 144 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -18781,32 +19305,32 @@ var ts; var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 172 /* ArrowFunction */) { + if (container.kind === 174 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 142 /* Constructor */: + case 144 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -18815,35 +19339,35 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 136 /* Parameter */) { + if (n.kind === 138 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; var container = ts.getSuperContainer(node, /*includeFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 172 /* ArrowFunction */) { + // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting + while (container && container.kind === 174 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*includeFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - // always set NodeCheckFlags for 'super' expression node + // always set NodeCheckFlags for 'super' expression node if (canUseSuperExpression) { if ((container.flags & 128 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; @@ -18866,7 +19390,7 @@ var ts; return unknownType; } if (!canUseSuperExpression) { - if (container && container.kind === 134 /* ComputedPropertyName */) { + if (container && container.kind === 136 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -18877,7 +19401,7 @@ var ts; } return unknownType; } - if (container.kind === 142 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 144 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -18892,7 +19416,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 142 /* Constructor */; + return container.kind === 144 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -18902,19 +19426,19 @@ var ts; // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { if (container.flags & 128 /* Static */) { - return container.kind === 141 /* MethodDeclaration */ || - container.kind === 140 /* MethodSignature */ || - container.kind === 143 /* GetAccessor */ || - container.kind === 144 /* SetAccessor */; + return container.kind === 143 /* MethodDeclaration */ || + container.kind === 142 /* MethodSignature */ || + container.kind === 145 /* GetAccessor */ || + container.kind === 146 /* SetAccessor */; } else { - return container.kind === 141 /* MethodDeclaration */ || - container.kind === 140 /* MethodSignature */ || - container.kind === 143 /* GetAccessor */ || - container.kind === 144 /* SetAccessor */ || - container.kind === 139 /* PropertyDeclaration */ || - container.kind === 138 /* PropertySignature */ || - container.kind === 142 /* Constructor */; + return container.kind === 143 /* MethodDeclaration */ || + container.kind === 142 /* MethodSignature */ || + container.kind === 145 /* GetAccessor */ || + container.kind === 146 /* SetAccessor */ || + container.kind === 141 /* PropertyDeclaration */ || + container.kind === 140 /* PropertySignature */ || + container.kind === 144 /* Constructor */; } } } @@ -18955,7 +19479,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136 /* Parameter */) { + if (declaration.kind === 138 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -18988,7 +19512,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 136 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 138 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -18999,8 +19523,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 142 /* Constructor */ || - functionDecl.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144 /* SetAccessor */))) { + functionDecl.kind === 144 /* Constructor */ || + functionDecl.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -19022,7 +19546,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 168 /* TaggedTemplateExpression */) { + if (template.parent.kind === 170 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -19030,13 +19554,13 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { + if (operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 51 /* BarBarToken */) { + else if (operator === 52 /* BarBarToken */) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); @@ -19143,7 +19667,7 @@ var ts; } function getContextualTypeForJsxExpression(expr) { // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 236 /* JsxAttribute */) { + if (expr.parent.kind === 238 /* JsxAttribute */) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -19153,7 +19677,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 237 /* JsxSpreadAttribute */) { + if (expr.kind === 239 /* JsxSpreadAttribute */) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -19174,38 +19698,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 209 /* VariableDeclaration */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 163 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 172 /* ArrowFunction */: - case 202 /* ReturnStatement */: + case 174 /* ArrowFunction */: + case 204 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 243 /* PropertyAssignment */: + case 245 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 188 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 181 /* TemplateExpression */); + case 190 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 183 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return getContextualType(parent); - case 238 /* JsxExpression */: - case 237 /* JsxSpreadAttribute */: + case 240 /* JsxExpression */: + case 239 /* JsxSpreadAttribute */: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -19222,7 +19746,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 171 /* FunctionExpression */ || node.kind === 172 /* ArrowFunction */; + return node.kind === 173 /* FunctionExpression */ || node.kind === 174 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -19236,7 +19760,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -19299,13 +19823,13 @@ var ts; // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 179 /* BinaryExpression */ && parent.operatorToken.kind === 55 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 181 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 243 /* PropertyAssignment */) { + if (parent.kind === 245 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 162 /* ArrayLiteralExpression */) { + if (parent.kind === 164 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -19321,8 +19845,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 161 /* BindingElement */ && !!node.initializer) || - (node.kind === 179 /* BinaryExpression */ && node.operatorToken.kind === 55 /* EqualsToken */); + return (node.kind === 163 /* BindingElement */ && !!node.initializer) || + (node.kind === 181 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -19331,7 +19855,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 183 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -19355,7 +19879,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 185 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -19370,7 +19894,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 160 /* ArrayBindingPattern */ || pattern.kind === 162 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 162 /* ArrayBindingPattern */ || pattern.kind === 164 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -19378,7 +19902,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 185 /* OmittedExpression */) { + if (patternElement.kind !== 187 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -19393,7 +19917,7 @@ var ts; return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { - return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 136 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -19443,30 +19967,30 @@ var ts; return links.resolvedType; } function checkObjectLiteral(node, contextualMapper) { + var inDestructuringPattern = isAssignmentTarget(node); // Grammar checking - checkGrammarObjectLiteralExpression(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 159 /* ObjectBindingPattern */ || contextualType.pattern.kind === 163 /* ObjectLiteralExpression */); - var inDestructuringPattern = isAssignmentTarget(node); + (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 243 /* PropertyAssignment */ || - memberDecl.kind === 244 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 245 /* PropertyAssignment */ || + memberDecl.kind === 246 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 243 /* PropertyAssignment */) { + if (memberDecl.kind === 245 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 141 /* MethodDeclaration */) { + else if (memberDecl.kind === 143 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 244 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 246 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -19474,7 +19998,9 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - if (memberDecl.kind === 243 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) { + var isOptional = (memberDecl.kind === 245 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 246 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + if (isOptional) { prop.flags |= 536870912 /* Optional */; } } @@ -19504,7 +20030,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 143 /* GetAccessor */ || memberDecl.kind === 144 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 145 /* GetAccessor */ || memberDecl.kind === 146 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -19566,7 +20092,7 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 67 /* Identifier */) { + if (lhs.kind === 69 /* Identifier */) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && @@ -19587,18 +20113,18 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: checkJsxExpression(child); break; - case 231 /* JsxElement */: + case 233 /* JsxElement */: checkJsxElement(child); break; - case 232 /* JsxSelfClosingElement */: + case 234 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; default: // No checks for JSX Text - ts.Debug.assert(child.kind === 234 /* JsxText */); + ts.Debug.assert(child.kind === 236 /* JsxText */); } } return jsxElementType || anyType; @@ -19614,7 +20140,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 133 /* QualifiedName */) { + if (tagName.kind === 135 /* QualifiedName */) { return false; } else { @@ -19733,12 +20259,14 @@ var ts; // Look up the value in the current scope if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4 /* ClassElement */; - getSymbolLinks(valueSymbol).referenced = true; + if (valueSymbol.flags & 8388608 /* Alias */) { + markAliasSymbolAsReferenced(valueSymbol); + } } return valueSymbol || unknownSymbol; } function resolveJsxTagName(node) { - if (node.tagName.kind === 67 /* Identifier */) { + if (node.tagName.kind === 69 /* Identifier */) { var tag = node.tagName; var sym = getResolvedSymbol(tag); return sym.exportSymbol || sym; @@ -19923,11 +20451,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 236 /* JsxAttribute */) { + if (node.attributes[i].kind === 238 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 237 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 239 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -19957,7 +20485,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 139 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -19973,8 +20501,8 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 93 /* SuperKeyword */) { - var errorNode = node.kind === 164 /* PropertyAccessExpression */ ? + if (left.kind === 95 /* SuperKeyword */) { + var errorNode = node.kind === 166 /* PropertyAccessExpression */ ? node.name : node.right; // TS 1.0 spec (April 2014): 4.8.2 @@ -19984,7 +20512,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 141 /* MethodDeclaration */) { + if (getDeclarationKindFromSymbol(prop) !== 143 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -20017,7 +20545,7 @@ var ts; } // Property is known to be protected at this point // All protected properties of a supertype are accessible in a super access - if (left.kind === 93 /* SuperKeyword */) { + if (left.kind === 95 /* SuperKeyword */) { return true; } // A protected property is accessible in the declaring class and classes derived from it @@ -20030,6 +20558,10 @@ var ts; return true; } // An instance property must be accessed through an instance of the enclosing class + if (type.flags & 33554432 /* ThisType */) { + // get the original type -- represented as the type constraint of the 'this' type + type = getConstraintOfTypeParameter(type); + } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); @@ -20056,18 +20588,18 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 /* ThisType */ ? apparentType : type)); } return unknownType; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32 /* Class */) { - checkClassPropertyAccess(node, left, type, prop); + checkClassPropertyAccess(node, left, apparentType, prop); } return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 164 /* PropertyAccessExpression */ + var left = node.kind === 166 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -20083,7 +20615,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -20155,6 +20687,7 @@ var ts; } /** * If indexArgumentExpression is a string literal or number literal, returns its text. + * If indexArgumentExpression is a constant value, returns its string value. * If indexArgumentExpression is a well known symbol, returns the property name corresponding * to this symbol, as long as it is a proper symbol reference. * Otherwise, returns undefined. @@ -20163,6 +20696,12 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } + if (indexArgumentExpression.kind === 167 /* ElementAccessExpression */ || indexArgumentExpression.kind === 166 /* PropertyAccessExpression */) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); @@ -20212,10 +20751,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 137 /* Decorator */) { + else if (node.kind !== 139 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -20281,7 +20820,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 183 /* SpreadElementExpression */) { + if (arg && arg.kind === 185 /* SpreadElementExpression */) { return i; } } @@ -20293,13 +20832,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 181 /* TemplateExpression */) { + if (tagExpression.template.kind === 183 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -20316,7 +20855,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -20325,7 +20864,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 167 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 169 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -20404,7 +20943,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -20463,7 +21002,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); @@ -20495,16 +21034,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 168 /* TaggedTemplateExpression */) { + if (node.kind === 170 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 181 /* TemplateExpression */) { + if (template.kind === 183 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -20529,25 +21068,29 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { switch (node.parent.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) + // If we are emitting decorators for ES3, we will only pass two arguments. + if (languageVersion === 0 /* ES3 */) { + return 2; + } // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 136 /* Parameter */: + case 138 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -20572,25 +21115,25 @@ var ts; function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. switch (node.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 136 /* Parameter */: + case 138 /* Parameter */: // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } // fall-through - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -20619,33 +21162,33 @@ var ts; function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 136 /* Parameter */: + case 138 /* Parameter */: node = node.parent; - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } // For a non-constructor parameter decorator, the `propertyKey` will be either // a string or a symbol, based on the name of the parameter's containing method. // fall-through - case 139 /* PropertyDeclaration */: - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will // be either string or symbol. var element = node; switch (element.name.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getStringLiteralType(element.name); - case 134 /* ComputedPropertyName */: + case 136 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { return nameType; @@ -20673,18 +21216,18 @@ var ts; // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a paramter decorator switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 136 /* Parameter */: + case 138 /* Parameter */: // The `parameterIndex` for a parameter decorator is always a number return numberType; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -20717,10 +21260,10 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { return globalTemplateStringsArrayType; } // This is not a synthetic argument, so we return 'undefined' @@ -20732,8 +21275,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 137 /* Decorator */ || - (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */)) { + if (node.kind === 139 /* Decorator */ || + (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -20742,11 +21285,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 137 /* Decorator */) { + if (node.kind === 139 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -20755,13 +21298,13 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 168 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 137 /* Decorator */; + var isTaggedTemplate = node.kind === 170 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 139 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (node.expression.kind !== 93 /* SuperKeyword */) { + if (node.expression.kind !== 95 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -20968,7 +21511,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 93 /* SuperKeyword */) { + if (node.expression.kind === 95 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated @@ -21101,16 +21644,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 136 /* Parameter */: + case 138 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -21147,16 +21690,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 166 /* CallExpression */) { + if (node.kind === 168 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 167 /* NewExpression */) { + else if (node.kind === 169 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 170 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 137 /* Decorator */) { + else if (node.kind === 139 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -21174,15 +21717,15 @@ var ts; // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 93 /* SuperKeyword */) { + if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 167 /* NewExpression */) { + if (node.kind === 169 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 142 /* Constructor */ && - declaration.kind !== 146 /* ConstructSignature */ && - declaration.kind !== 151 /* ConstructorType */) { + declaration.kind !== 144 /* Constructor */ && + declaration.kind !== 148 /* ConstructSignature */ && + declaration.kind !== 153 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -21190,6 +21733,10 @@ var ts; return anyType; } } + // In JavaScript files, calls to any identifier 'require' are treated as external module imports + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -21224,10 +21771,24 @@ var ts; assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } } + // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push + // the destructured type into the contained binding elements. + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 187 /* OmittedExpression */) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + assignBindingElementTypes(element); + } + } + } + } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { // Even if the parameter already has a type, it might be because it was given a type while @@ -21279,7 +21840,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 190 /* Block */) { + if (func.body.kind !== 192 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -21398,7 +21959,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 206 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 208 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -21413,7 +21974,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 190 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */) { return; } var bodyBlock = func.body; @@ -21431,10 +21992,10 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 171 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 173 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -21477,14 +22038,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -21506,7 +22067,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 190 /* Block */) { + if (node.body.kind === 192 /* Block */) { checkSourceElement(node.body); } else { @@ -21552,24 +22113,24 @@ var ts; // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { - case 67 /* Identifier */: { + case 69 /* Identifier */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 164 /* PropertyAccessExpression */: { + case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 165 /* ElementAccessExpression */: - // old compiler doesn't check indexed assess + case 167 /* ElementAccessExpression */: + // old compiler doesn't check indexed access return true; - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -21577,12 +22138,12 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: { + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; } - case 165 /* ElementAccessExpression */: { + case 167 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 9 /* StringLiteral */) { @@ -21592,7 +22153,7 @@ var ts; } return false; } - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -21638,15 +22199,15 @@ var ts; switch (node.operator) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: + case 50 /* TildeToken */: if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 48 /* ExclamationToken */: + case 49 /* ExclamationToken */: return booleanType; - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors @@ -21706,31 +22267,31 @@ var ts; function isConstEnumSymbol(symbol) { return (symbol.flags & 128 /* ConstEnum */) !== 0; } - function checkInstanceOfExpression(node, leftType, rightType) { + function checkInstanceOfExpression(left, right, leftType, rightType) { // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } - function checkInExpression(node, leftType, rightType) { + function checkInExpression(left, right, leftType, rightType) { // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } @@ -21738,7 +22299,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { + if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; var type = isTypeAny(sourceType) @@ -21747,7 +22308,12 @@ var ts; isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { - checkDestructuringAssignment(p.initializer || name_13, type); + if (p.kind === 246 /* ShorthandPropertyAssignment */) { + checkDestructuringAssignment(p, type); + } + else { + checkDestructuringAssignment(p.initializer || name_13, type); + } } else { error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); @@ -21767,8 +22333,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 185 /* OmittedExpression */) { - if (e.kind !== 183 /* SpreadElementExpression */) { + if (e.kind !== 187 /* OmittedExpression */) { + if (e.kind !== 185 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -21793,7 +22359,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 179 /* BinaryExpression */ && restExpression.operatorToken.kind === 55 /* EqualsToken */) { + if (restExpression.kind === 181 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -21805,15 +22371,26 @@ var ts; } return sourceType; } - function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 246 /* ShorthandPropertyAssignment */) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 163 /* ObjectLiteralExpression */) { + if (target.kind === 165 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 162 /* ArrayLiteralExpression */) { + if (target.kind === 164 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -21826,34 +22403,39 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - var operator = node.operatorToken.kind; - if (operator === 55 /* EqualsToken */ && (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 /* EqualsToken */ && (left.kind === 165 /* ObjectLiteralExpression */ || left.kind === 164 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); switch (operator) { case 37 /* AsteriskToken */: - case 58 /* AsteriskEqualsToken */: - case 38 /* SlashToken */: - case 59 /* SlashEqualsToken */: - case 39 /* PercentToken */: - case 60 /* PercentEqualsToken */: + case 38 /* AsteriskAsteriskToken */: + case 59 /* AsteriskEqualsToken */: + case 60 /* AsteriskAsteriskEqualsToken */: + case 39 /* SlashToken */: + case 61 /* SlashEqualsToken */: + case 40 /* PercentToken */: + case 62 /* PercentEqualsToken */: case 36 /* MinusToken */: - case 57 /* MinusEqualsToken */: - case 42 /* LessThanLessThanToken */: - case 61 /* LessThanLessThanEqualsToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 46 /* BarToken */: - case 65 /* BarEqualsToken */: - case 47 /* CaretToken */: - case 66 /* CaretEqualsToken */: - case 45 /* AmpersandToken */: - case 64 /* AmpersandEqualsToken */: - // TypeScript 1.0 spec (April 2014): 4.15.1 + case 58 /* MinusEqualsToken */: + case 43 /* LessThanLessThanToken */: + case 63 /* LessThanLessThanEqualsToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 47 /* BarToken */: + case 67 /* BarEqualsToken */: + case 48 /* CaretToken */: + case 68 /* CaretEqualsToken */: + case 46 /* AmpersandToken */: + case 66 /* AmpersandEqualsToken */: + // TypeScript 1.0 spec (April 2014): 4.19.1 // These operators require their operands to be of type Any, the Number primitive type, // or an enum type. Operands of an enum type are treated // as having the primitive type Number. If one operand is the null or undefined value, @@ -21868,21 +22450,21 @@ var ts; // try and return them a helpful suggestion if ((leftType.flags & 8 /* Boolean */) && (rightType.flags & 8 /* Boolean */) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal - var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } } return numberType; case 35 /* PlusToken */: - case 56 /* PlusEqualsToken */: - // TypeScript 1.0 spec (April 2014): 4.15.2 + case 57 /* PlusEqualsToken */: + // TypeScript 1.0 spec (April 2014): 4.19.2 // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. // If one operand is the null or undefined value, it is treated as having the type of the other operand. @@ -21915,7 +22497,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 56 /* PlusEqualsToken */) { + if (operator === 57 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; @@ -21935,15 +22517,15 @@ var ts; reportOperatorError(); } return booleanType; - case 89 /* InstanceOfKeyword */: - return checkInstanceOfExpression(node, leftType, rightType); - case 88 /* InKeyword */: - return checkInExpression(node, leftType, rightType); - case 50 /* AmpersandAmpersandToken */: + case 91 /* InstanceOfKeyword */: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90 /* InKeyword */: + return checkInExpression(left, right, leftType, rightType); + case 51 /* AmpersandAmpersandToken */: return rightType; - case 51 /* BarBarToken */: + case 52 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 55 /* EqualsToken */: + case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 24 /* CommaToken */: @@ -21951,8 +22533,8 @@ var ts; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? node.left : - someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? left : + someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -21962,37 +22544,37 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 46 /* BarToken */: - case 65 /* BarEqualsToken */: - return 51 /* BarBarToken */; - case 47 /* CaretToken */: - case 66 /* CaretEqualsToken */: + case 47 /* BarToken */: + case 67 /* BarEqualsToken */: + return 52 /* BarBarToken */; + case 48 /* CaretToken */: + case 68 /* CaretEqualsToken */: return 33 /* ExclamationEqualsEqualsToken */; - case 45 /* AmpersandToken */: - case 64 /* AmpersandEqualsToken */: - return 50 /* AmpersandAmpersandToken */; + case 46 /* AmpersandToken */: + case 66 /* AmpersandEqualsToken */: + return 51 /* AmpersandAmpersandToken */; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { + if (produceDiagnostics && operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { // TypeScript 1.0 spec (April 2014): 4.17 // An assignment of the form // VarExpr = ValueExpr // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported - checkTypeAssignableTo(valueType, leftType, node.left, /*headMessage*/ undefined); + checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined); } } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function isYieldExpressionInClass(node) { @@ -22083,7 +22665,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -22094,7 +22676,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -22124,7 +22706,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 133 /* QualifiedName */) { + if (node.kind === 135 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -22136,9 +22718,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -22152,78 +22734,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: return checkIdentifier(node); - case 95 /* ThisKeyword */: + case 97 /* ThisKeyword */: return checkThisExpression(node); - case 93 /* SuperKeyword */: + case 95 /* SuperKeyword */: return checkSuperExpression(node); - case 91 /* NullKeyword */: + case 93 /* NullKeyword */: return nullType; - case 97 /* TrueKeyword */: - case 82 /* FalseKeyword */: + case 99 /* TrueKeyword */: + case 84 /* FalseKeyword */: return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 164 /* PropertyAccessExpression */: + case 166 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: return checkCallExpression(node); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: return checkClassExpression(node); - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 174 /* TypeOfExpression */: + case 176 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: return checkAssertion(node); - case 173 /* DeleteExpression */: + case 175 /* DeleteExpression */: return checkDeleteExpression(node); - case 175 /* VoidExpression */: + case 177 /* VoidExpression */: return checkVoidExpression(node); - case 176 /* AwaitExpression */: + case 178 /* AwaitExpression */: return checkAwaitExpression(node); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 178 /* PostfixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 183 /* SpreadElementExpression */: + case 185 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 185 /* OmittedExpression */: + case 187 /* OmittedExpression */: return undefinedType; - case 182 /* YieldExpression */: + case 184 /* YieldExpression */: return checkYieldExpression(node); - case 238 /* JsxExpression */: + case 240 /* JsxExpression */: return checkJsxExpression(node); - case 231 /* JsxElement */: + case 233 /* JsxElement */: return checkJsxElement(node); - case 232 /* JsxSelfClosingElement */: + case 234 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 233 /* JsxOpeningElement */: + case 235 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -22252,7 +22834,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 142 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -22269,15 +22851,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 141 /* MethodDeclaration */ || - node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */; + return node.kind === 143 /* MethodDeclaration */ || + node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 67 /* Identifier */ && + if (param.name.kind === 69 /* Identifier */ && param.name.text === parameter.text) { return i; } @@ -22287,31 +22869,31 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 172 /* ArrowFunction */: - case 145 /* CallSignature */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 150 /* FunctionType */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 174 /* ArrowFunction */: + case 147 /* CallSignature */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 152 /* FunctionType */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 150 /* FunctionType */ || node.kind === 211 /* FunctionDeclaration */ || node.kind === 151 /* ConstructorType */ || - node.kind === 145 /* CallSignature */ || node.kind === 142 /* Constructor */ || - node.kind === 146 /* ConstructSignature */) { + else if (node.kind === 152 /* FunctionType */ || node.kind === 213 /* FunctionDeclaration */ || node.kind === 153 /* ConstructorType */ || + node.kind === 147 /* CallSignature */ || node.kind === 144 /* Constructor */ || + node.kind === 148 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 148 /* TypePredicate */) { + if (node.type.kind === 150 /* TypePredicate */) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -22330,19 +22912,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 159 /* ObjectBindingPattern */ || - param.name.kind === 160 /* ArrayBindingPattern */) { + if (param.name.kind === 161 /* ObjectBindingPattern */ || + param.name.kind === 162 /* ArrayBindingPattern */) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 67 /* Identifier */ && + if (element.name.kind === 69 /* Identifier */ && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 160 /* ArrayBindingPattern */ || - element.name.kind === 159 /* ObjectBindingPattern */) { + else if (element.name.kind === 162 /* ArrayBindingPattern */ || + element.name.kind === 161 /* ObjectBindingPattern */) { checkBindingPattern(element.name); } } @@ -22366,10 +22948,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -22397,7 +22979,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 213 /* InterfaceDeclaration */) { + if (node.kind === 215 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -22417,7 +22999,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 128 /* StringKeyword */: + case 130 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -22425,7 +23007,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 126 /* NumberKeyword */: + case 128 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -22474,7 +23056,7 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 166 /* CallExpression */ && n.expression.kind === 93 /* SuperKeyword */; + return n.kind === 168 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); @@ -22492,15 +23074,15 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 95 /* ThisKeyword */) { + if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 171 /* FunctionExpression */ && n.kind !== 211 /* FunctionDeclaration */) { + else if (n.kind !== 173 /* FunctionExpression */ && n.kind !== 213 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 139 /* PropertyDeclaration */ && + return n.kind === 141 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } @@ -22530,7 +23112,7 @@ var ts; var superCallStatement; for (var _i = 0; _i < statements.length; _i++) { var statement = statements[_i]; - if (statement.kind === 193 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -22556,7 +23138,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 143 /* GetAccessor */) { + if (node.kind === 145 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } @@ -22564,7 +23146,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 143 /* GetAccessor */ ? 144 /* SetAccessor */ : 143 /* GetAccessor */; + var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -22660,9 +23242,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 145 /* CallSignature */ || signatureDeclarationNode.kind === 146 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 145 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 147 /* CallSignature */ || signatureDeclarationNode.kind === 148 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 147 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -22680,7 +23262,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 213 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 215 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -22766,7 +23348,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */); + ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -22802,7 +23384,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 213 /* InterfaceDeclaration */ || node.parent.kind === 153 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -22813,7 +23395,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 211 /* FunctionDeclaration */ || node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */ || node.kind === 142 /* Constructor */) { + if (node.kind === 213 /* FunctionDeclaration */ || node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */ || node.kind === 144 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -22953,16 +23535,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -22973,7 +23555,8 @@ var ts; } } function checkNonThenableType(type, location, message) { - if (!(type.flags & 1 /* Any */) && isTypeAssignableTo(type, getGlobalThenableType())) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -23206,22 +23789,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 136 /* Parameter */: + case 138 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -23234,9 +23817,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 149 /* TypeReference */) { + if (node && node.kind === 151 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Resolve type so we know which symbol is referenced var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); // Resolved symbol is alias @@ -23255,19 +23838,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 136 /* Parameter */: + case 138 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -23296,25 +23879,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 141 /* MethodDeclaration */: + case 143 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 144 /* SetAccessor */: - case 143 /* GetAccessor */: - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 146 /* SetAccessor */: + case 145 /* GetAccessor */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 136 /* Parameter */) { + if (node.kind === 138 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -23332,15 +23915,12 @@ var ts; checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { - if (!compilerOptions.experimentalAsyncFunctions) { - error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning); - } emitAwaiter = true; } // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 136 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -23389,11 +23969,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 190 /* Block */) { + if (node.kind === 192 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 217 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 219 /* ModuleBlock */) { checkFunctionAndClassExpressionBodies(node); } } @@ -23412,12 +23992,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 139 /* PropertyDeclaration */ || - node.kind === 138 /* PropertySignature */ || - node.kind === 141 /* MethodDeclaration */ || - node.kind === 140 /* MethodSignature */ || - node.kind === 143 /* GetAccessor */ || - node.kind === 144 /* SetAccessor */) { + if (node.kind === 141 /* PropertyDeclaration */ || + node.kind === 140 /* PropertySignature */ || + node.kind === 143 /* MethodDeclaration */ || + node.kind === 142 /* MethodSignature */ || + node.kind === 145 /* GetAccessor */ || + node.kind === 146 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -23426,7 +24006,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 136 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 138 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -23442,7 +24022,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 67 /* Identifier */; + var isDeclaration_1 = node.kind !== 69 /* Identifier */; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -23465,7 +24045,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 67 /* Identifier */; + var isDeclaration_2 = node.kind !== 69 /* Identifier */; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -23479,12 +24059,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 246 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -23519,7 +24099,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 209 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 211 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -23529,17 +24109,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 191 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 190 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 217 /* ModuleBlock */ || - container.kind === 216 /* ModuleDeclaration */ || - container.kind === 246 /* SourceFile */); + (container.kind === 192 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 219 /* ModuleBlock */ || + container.kind === 218 /* ModuleDeclaration */ || + container.kind === 248 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -23554,18 +24134,18 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 136 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 138 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 67 /* Identifier */) { + if (n.kind === 69 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 136 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 138 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -23591,7 +24171,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { + if (node.name.kind === 136 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -23602,7 +24182,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 136 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 138 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -23634,10 +24214,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 139 /* PropertyDeclaration */ && node.kind !== 138 /* PropertySignature */) { + if (node.kind !== 141 /* PropertyDeclaration */ && node.kind !== 140 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { + if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -23660,7 +24240,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 163 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 165 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -23698,12 +24278,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -23723,14 +24303,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { + if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -23759,7 +24339,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 210 /* VariableDeclarationList */) { + if (node.initializer.kind === 212 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -23773,7 +24353,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { + if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -24012,7 +24592,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144 /* SetAccessor */))); + return !!(node.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -24035,10 +24615,10 @@ var ts; // for generators. return; } - if (func.kind === 144 /* SetAccessor */) { + if (func.kind === 146 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 142 /* Constructor */) { + else if (func.kind === 144 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -24047,7 +24627,12 @@ var ts; if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + if (promisedType) { + // If the function has a return type, but promisedType is + // undefined, an error will be reported in checkAsyncFunctionReturnType + // so we don't need to report one here. + checkTypeAssignableTo(awaitedType, promisedType, node.expression); + } } else { checkTypeAssignableTo(exprType, returnType, node.expression); @@ -24074,7 +24659,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 240 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -24086,7 +24671,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 239 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 241 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. @@ -24107,7 +24692,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 205 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 207 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -24137,7 +24722,7 @@ var ts; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 67 /* Identifier */) { + if (catchClause.variableDeclaration.name.kind !== 69 /* Identifier */) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -24212,7 +24797,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 134 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 136 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -24289,6 +24874,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -24307,7 +24893,7 @@ var ts; } } } - checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify @@ -24324,7 +24910,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - ts.forEach(implementedTypeNodes, function (typeRefNode) { + for (var _b = 0; _b < implementedTypeNodes.length; _b++) { + var typeRefNode = implementedTypeNodes[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -24334,14 +24921,14 @@ var ts; if (t !== unknownType) { var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { - checkTypeAssignableTo(type, t, node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); } } } - }); + } } if (produceDiagnostics) { checkIndexConstraints(type); @@ -24392,7 +24979,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { - if (derivedClassDecl.kind === 184 /* ClassExpression */) { + if (derivedClassDecl.kind === 186 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -24440,7 +25027,7 @@ var ts; } } function isAccessor(kind) { - return kind === 143 /* GetAccessor */ || kind === 144 /* SetAccessor */; + return kind === 145 /* GetAccessor */ || kind === 146 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -24480,7 +25067,7 @@ var ts; var ok = true; for (var _i = 0; _i < baseTypes.length; _i++) { var base = baseTypes[_i]; - var properties = getPropertiesOfObjectType(base); + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0; _a < properties.length; _a++) { var prop = properties[_a]; if (!ts.hasProperty(seen, prop.name)) { @@ -24510,7 +25097,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -24519,19 +25106,21 @@ var ts; // Only check this symbol once if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); // run subsequent checks only if first set succeeded if (checkInheritedPropertiesAreIdentical(type, node.name)) { - ts.forEach(getBaseTypes(type), function (baseType) { - checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); - }); + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } checkIndexConstraints(type); } } // Interfaces cannot merge with non-ambient classes. if (symbol && symbol.declarations) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 212 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var declaration = _c[_b]; + if (declaration.kind === 214 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -24560,24 +25149,38 @@ var ts; if (!(nodeLinks.flags & 8192 /* EnumValuesComputed */)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); - var autoValue = 0; + var autoValue = 0; // set to undefined when enum member is non-constant var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); - ts.forEach(node.members, function (member) { - if (member.name.kind !== 134 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name.kind === 136 /* ComputedPropertyName */) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } + var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; if (initializer) { autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { + // In ambient enum declarations that specify no const modifier, enum member declarations + // that omit a value are considered computed members (as opposed to having auto-incremented values assigned). autoValue = undefined; } + else if (previousEnumMemberIsNonConstant) { + // If the member declaration specifies no value, the member is considered a constant enum member. + // If the member is the first member in the enum declaration, it is assigned the value zero. + // Otherwise, it is assigned the value of the immediately preceding member plus one, + // and an error occurs if the immediately preceding member is not a constant enum member + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } if (autoValue !== undefined) { getNodeLinks(member).enumMemberValue = autoValue++; } - }); + } nodeLinks.flags |= 8192 /* EnumValuesComputed */; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { @@ -24590,11 +25193,11 @@ var ts; if (enumIsConst) { error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); } - else if (!ambient) { + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. - // Also, we do not need to check this for ambients because there is already - // a syntax error if it is not a constant. checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); } } @@ -24610,7 +25213,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -24618,10 +25221,10 @@ var ts; switch (e.operator) { case 35 /* PlusToken */: return value_1; case 36 /* MinusToken */: return -value_1; - case 49 /* TildeToken */: return ~value_1; + case 50 /* TildeToken */: return ~value_1; } return undefined; - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -24631,31 +25234,31 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 46 /* BarToken */: return left | right; - case 45 /* AmpersandToken */: return left & right; - case 43 /* GreaterThanGreaterThanToken */: return left >> right; - case 44 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 42 /* LessThanLessThanToken */: return left << right; - case 47 /* CaretToken */: return left ^ right; + case 47 /* BarToken */: return left | right; + case 46 /* AmpersandToken */: return left & right; + case 44 /* GreaterThanGreaterThanToken */: return left >> right; + case 45 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 43 /* LessThanLessThanToken */: return left << right; + case 48 /* CaretToken */: return left ^ right; case 37 /* AsteriskToken */: return left * right; - case 38 /* SlashToken */: return left / right; + case 39 /* SlashToken */: return left / right; case 35 /* PlusToken */: return left + right; case 36 /* MinusToken */: return left - right; - case 39 /* PercentToken */: return left % right; + case 40 /* PercentToken */: return left % right; } return undefined; case 8 /* NumericLiteral */: return +e.text; - case 170 /* ParenthesizedExpression */: + case 172 /* ParenthesizedExpression */: return evalConstant(e.expression); - case 67 /* Identifier */: - case 165 /* ElementAccessExpression */: - case 164 /* PropertyAccessExpression */: + case 69 /* Identifier */: + case 167 /* ElementAccessExpression */: + case 166 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName; - if (e.kind === 67 /* Identifier */) { + if (e.kind === 69 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type enumType_1 = currentType; @@ -24663,7 +25266,7 @@ var ts; } else { var expression; - if (e.kind === 165 /* ElementAccessExpression */) { + if (e.kind === 167 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -24678,10 +25281,10 @@ var ts; // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName var current = expression; while (current) { - if (current.kind === 67 /* Identifier */) { + if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 164 /* PropertyAccessExpression */) { + else if (current.kind === 166 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -24707,7 +25310,7 @@ var ts; return undefined; } // illegal case: forward reference - if (!isDefinedBefore(propertyDecl, member)) { + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { reportError = false; error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return undefined; @@ -24722,7 +25325,7 @@ var ts; return; } // Grammar checking - checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -24752,7 +25355,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 215 /* EnumDeclaration */) { + if (declaration.kind !== 217 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -24775,8 +25378,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 212 /* ClassDeclaration */ || - (declaration.kind === 211 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 214 /* ClassDeclaration */ || + (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -24832,7 +25435,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 212 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 214 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -24841,9 +25444,9 @@ var ts; // Checks for ambient external modules. if (isAmbientExternalModule) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } - if (isExternalModuleNameRelative(node.name.text)) { + if (ts.isExternalModuleNameRelative(node.name.text)) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -24852,17 +25455,17 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 133 /* QualifiedName */) { + if (node.kind === 135 /* QualifiedName */) { node = node.left; } - else if (node.kind === 164 /* PropertyAccessExpression */) { + else if (node.kind === 166 /* PropertyAccessExpression */) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 67 /* Identifier */); + ts.Debug.assert(node.kind === 69 /* Identifier */); return node; } function checkExternalImportOrExportDeclaration(node) { @@ -24871,14 +25474,14 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 226 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 228 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { // TypeScript 1.0 spec (April 2013): 12.1.6 // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference // other external modules only through top - level external module names. @@ -24896,7 +25499,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 228 /* ExportSpecifier */ ? + var message = node.kind === 230 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -24923,7 +25526,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -24960,9 +25563,9 @@ var ts; } } else { - if (languageVersion >= 2 /* ES6 */ && !ts.isInAmbientContext(node)) { + if (modulekind === 5 /* ES6 */ && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -24980,8 +25583,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -24995,7 +25598,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 246 /* SourceFile */ && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 216 /* ModuleDeclaration */) { + if (node.parent.kind !== 248 /* SourceFile */ && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 218 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -25010,8 +25613,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 246 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 216 /* ModuleDeclaration */ && container.name.kind === 67 /* Identifier */) { + var container = node.parent.kind === 248 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 218 /* ModuleDeclaration */ && container.name.kind === 69 /* Identifier */) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -25019,7 +25622,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { markExportAsReferenced(node); } else { @@ -25027,21 +25630,21 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (languageVersion >= 2 /* ES6 */) { - // export assignment is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (modulekind === 5 /* ES6 */) { + // export assignment is not supported in es6 modules + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (compilerOptions.module === 4 /* System */) { + else if (modulekind === 4 /* System */) { // system modules does not support export assignment grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } function getModuleStatements(node) { - if (node.kind === 246 /* SourceFile */) { + if (node.kind === 248 /* SourceFile */) { return node.statements; } - if (node.kind === 216 /* ModuleDeclaration */ && node.body.kind === 217 /* ModuleBlock */) { + if (node.kind === 218 /* ModuleDeclaration */ && node.body.kind === 219 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -25080,118 +25683,118 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessivly // hitting the cancellation token on every node we check. switch (kind) { - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: return checkTypeParameter(node); - case 136 /* Parameter */: + case 138 /* Parameter */: return checkParameter(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return checkPropertyDeclaration(node); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return checkSignatureDeclaration(node); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return checkMethodDeclaration(node); - case 142 /* Constructor */: + case 144 /* Constructor */: return checkConstructorDeclaration(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return checkAccessorDeclaration(node); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return checkTypeReferenceNode(node); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return checkTypePredicate(node); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return checkTypeQuery(node); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return checkTypeLiteral(node); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return checkArrayType(node); - case 155 /* TupleType */: + case 157 /* TupleType */: return checkTupleType(node); - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return checkSourceElement(node.type); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return checkBlock(node); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return checkVariableStatement(node); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: return checkExpressionStatement(node); - case 194 /* IfStatement */: + case 196 /* IfStatement */: return checkIfStatement(node); - case 195 /* DoStatement */: + case 197 /* DoStatement */: return checkDoStatement(node); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: return checkWhileStatement(node); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return checkForStatement(node); - case 198 /* ForInStatement */: + case 200 /* ForInStatement */: return checkForInStatement(node); - case 199 /* ForOfStatement */: + case 201 /* ForOfStatement */: return checkForOfStatement(node); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: return checkReturnStatement(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: return checkWithStatement(node); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return checkSwitchStatement(node); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return checkLabeledStatement(node); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: return checkThrowStatement(node); - case 207 /* TryStatement */: + case 209 /* TryStatement */: return checkTryStatement(node); - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 161 /* BindingElement */: + case 163 /* BindingElement */: return checkBindingElement(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return checkClassDeclaration(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return checkImportDeclaration(node); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return checkExportDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return checkExportAssignment(node); - case 192 /* EmptyStatement */: + case 194 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 208 /* DebuggerStatement */: + case 210 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 229 /* MissingDeclaration */: + case 231 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -25206,97 +25809,98 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: ts.forEach(node.members, checkSourceElement); + ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 203 /* WithStatement */: + case 205 /* WithStatement */: checkFunctionAndClassExpressionBodies(node.expression); break; - case 137 /* Decorator */: - case 136 /* Parameter */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 161 /* BindingElement */: - case 162 /* ArrayLiteralExpression */: - case 163 /* ObjectLiteralExpression */: - case 243 /* PropertyAssignment */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 168 /* TaggedTemplateExpression */: - case 181 /* TemplateExpression */: - case 188 /* TemplateSpan */: - case 169 /* TypeAssertionExpression */: - case 187 /* AsExpression */: - case 170 /* ParenthesizedExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 176 /* AwaitExpression */: - case 173 /* DeleteExpression */: - case 177 /* PrefixUnaryExpression */: - case 178 /* PostfixUnaryExpression */: - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 183 /* SpreadElementExpression */: - case 182 /* YieldExpression */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 191 /* VariableStatement */: - case 193 /* ExpressionStatement */: - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: - case 202 /* ReturnStatement */: - case 204 /* SwitchStatement */: - case 218 /* CaseBlock */: - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - case 205 /* LabeledStatement */: - case 206 /* ThrowStatement */: - case 207 /* TryStatement */: - case 242 /* CatchClause */: - case 209 /* VariableDeclaration */: - case 210 /* VariableDeclarationList */: - case 212 /* ClassDeclaration */: - case 241 /* HeritageClause */: - case 186 /* ExpressionWithTypeArguments */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 225 /* ExportAssignment */: - case 246 /* SourceFile */: - case 238 /* JsxExpression */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - case 233 /* JsxOpeningElement */: + case 139 /* Decorator */: + case 138 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 163 /* BindingElement */: + case 164 /* ArrayLiteralExpression */: + case 165 /* ObjectLiteralExpression */: + case 245 /* PropertyAssignment */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 170 /* TaggedTemplateExpression */: + case 183 /* TemplateExpression */: + case 190 /* TemplateSpan */: + case 171 /* TypeAssertionExpression */: + case 189 /* AsExpression */: + case 172 /* ParenthesizedExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 178 /* AwaitExpression */: + case 175 /* DeleteExpression */: + case 179 /* PrefixUnaryExpression */: + case 180 /* PostfixUnaryExpression */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 185 /* SpreadElementExpression */: + case 184 /* YieldExpression */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 193 /* VariableStatement */: + case 195 /* ExpressionStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: + case 204 /* ReturnStatement */: + case 206 /* SwitchStatement */: + case 220 /* CaseBlock */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + case 207 /* LabeledStatement */: + case 208 /* ThrowStatement */: + case 209 /* TryStatement */: + case 244 /* CatchClause */: + case 211 /* VariableDeclaration */: + case 212 /* VariableDeclarationList */: + case 214 /* ClassDeclaration */: + case 243 /* HeritageClause */: + case 188 /* ExpressionWithTypeArguments */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 227 /* ExportAssignment */: + case 248 /* SourceFile */: + case 240 /* JsxExpression */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + case 235 /* JsxOpeningElement */: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -25323,7 +25927,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -25382,7 +25986,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 203 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 205 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -25405,34 +26009,34 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 246 /* SourceFile */: - if (!ts.isExternalModule(location)) { + case 248 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 184 /* ClassExpression */: + case 186 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, - // add the type parameters into the symbol table + // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 171 /* FunctionExpression */: + case 173 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -25475,43 +26079,43 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 67 /* Identifier */ && + return name.kind === 69 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 135 /* TypeParameter */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: + case 137 /* TypeParameter */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 133 /* QualifiedName */) { + while (node.parent && node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 149 /* TypeReference */; + return node.parent && node.parent.kind === 151 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 164 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 166 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 186 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 188 /* ExpressionWithTypeArguments */; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 133 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 135 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 219 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 221 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 227 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -25523,11 +26127,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 225 /* ExportAssignment */) { + if (entityName.parent.kind === 227 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 164 /* PropertyAccessExpression */) { + if (entityName.kind !== 166 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -25537,13 +26141,24 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 186 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = 0 /* None */; + // In an interface or class, we're definitely interested in a type. + if (entityName.parent.kind === 188 /* ExpressionWithTypeArguments */) { + meaning = 793056 /* Type */; + // In a class 'extends' clause we are also looking for a value. + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455 /* Value */; + } + } + else { + meaning = 1536 /* Namespace */; + } meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 233 /* JsxOpeningElement */) || - (entityName.parent.kind === 232 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 235 /* JsxClosingElement */)) { + else if ((entityName.parent.kind === 235 /* JsxOpeningElement */) || + (entityName.parent.kind === 234 /* JsxSelfClosingElement */) || + (entityName.parent.kind === 237 /* JsxClosingElement */)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { @@ -25551,20 +26166,20 @@ var ts; // Missing entity name. return undefined; } - if (entityName.kind === 67 /* Identifier */) { + if (entityName.kind === 69 /* Identifier */) { // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 164 /* PropertyAccessExpression */) { + else if (entityName.kind === 166 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 133 /* QualifiedName */) { + else if (entityName.kind === 135 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -25573,16 +26188,16 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 236 /* JsxAttribute */) { + else if (entityName.parent.kind === 238 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 148 /* TypePredicate */) { + if (entityName.parent.kind === 150 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? @@ -25597,14 +26212,14 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } - if (node.kind === 67 /* Identifier */) { + if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 225 /* ExportAssignment */ + return node.parent.kind === 227 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 161 /* BindingElement */ && - node.parent.parent.kind === 159 /* ObjectBindingPattern */ && + else if (node.parent.kind === 163 /* BindingElement */ && + node.parent.parent.kind === 161 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -25614,18 +26229,18 @@ var ts; } } switch (node.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: - var type = checkExpression(node); + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 119 /* ConstructorKeyword */: + case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 142 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 144 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -25633,14 +26248,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 220 /* ImportDeclaration */ || node.parent.kind === 226 /* ExportDeclaration */) && + ((node.parent.kind === 222 /* ImportDeclaration */ || node.parent.kind === 228 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -25657,7 +26272,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 244 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 246 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -25774,11 +26389,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 246 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 248 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 216 /* ModuleDeclaration */ || n.kind === 215 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 218 /* ModuleDeclaration */ || n.kind === 217 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -25793,11 +26408,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 190 /* Block */: - case 218 /* CaseBlock */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 192 /* Block */: + case 220 /* CaseBlock */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return true; } return false; @@ -25827,22 +26442,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 225 /* ExportAssignment */: - return node.expression && node.expression.kind === 67 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 227 /* ExportAssignment */: + return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 246 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 248 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -25904,7 +26519,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 245 /* EnumMember */) { + if (node.kind === 247 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -25996,23 +26611,6 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function getBlockScopedVariableId(n) { - ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 161 /* BindingElement */ || (n.parent.kind === 209 /* VariableDeclaration */ && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); - var isLetOrConst = symbol && - (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 242 /* CatchClause */; - if (isLetOrConst) { - // side-effect of calling this method: - // assign id to symbol if it was not yet set - getSymbolLinks(symbol); - return symbol.id; - } - return undefined; - } function instantiateSingleCallFunctionType(functionType, typeArguments) { if (functionType === unknownType) { return unknownType; @@ -26044,7 +26642,6 @@ var ts; isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, collectLinkedAliases: collectLinkedAliases, - getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter @@ -26057,11 +26654,10 @@ var ts; }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); - // Initialize special symbols getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; @@ -26087,6 +26683,7 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. if (languageVersion >= 2 /* ES6 */) { @@ -26136,10 +26733,7 @@ var ts; if (!ts.nodeCanBeDecorated(node)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } - else if (languageVersion < 1 /* ES5 */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); - } - else if (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */) { + else if (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -26149,38 +26743,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 147 /* IndexSignature */: - case 216 /* ModuleDeclaration */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: - case 225 /* ExportAssignment */: - case 136 /* Parameter */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 149 /* IndexSignature */: + case 218 /* ModuleDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + case 227 /* ExportAssignment */: + case 138 /* Parameter */: break; - case 211 /* FunctionDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116 /* AsyncKeyword */) && - node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 213 /* FunctionDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && + node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 191 /* VariableStatement */: - case 214 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 193 /* VariableStatement */: + case 216 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 215 /* EnumDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72 /* ConstKeyword */) && - node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { + case 217 /* EnumDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && + node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -26195,14 +26789,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { - case 110 /* PublicKeyword */: - case 109 /* ProtectedKeyword */: - case 108 /* PrivateKeyword */: + case 112 /* PublicKeyword */: + case 111 /* ProtectedKeyword */: + case 110 /* PrivateKeyword */: var text = void 0; - if (modifier.kind === 110 /* PublicKeyword */) { + if (modifier.kind === 112 /* PublicKeyword */) { text = "public"; } - else if (modifier.kind === 109 /* ProtectedKeyword */) { + else if (modifier.kind === 111 /* ProtectedKeyword */) { text = "protected"; lastProtected = modifier; } @@ -26219,11 +26813,11 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256 /* Abstract */) { - if (modifier.kind === 108 /* PrivateKeyword */) { + if (modifier.kind === 110 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -26232,17 +26826,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 111 /* StaticKeyword */: + case 113 /* StaticKeyword */: if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { @@ -26251,7 +26845,7 @@ var ts; flags |= 128 /* Static */; lastStatic = modifier; break; - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -26264,42 +26858,42 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 120 /* DeclareKeyword */: + case 122 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 113 /* AbstractKeyword */: + case 115 /* AbstractKeyword */: if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 212 /* ClassDeclaration */) { - if (node.kind !== 141 /* MethodDeclaration */) { + if (node.kind !== 214 /* ClassDeclaration */) { + if (node.kind !== 143 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 212 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128 /* Static */) { @@ -26311,14 +26905,14 @@ var ts; } flags |= 256 /* Abstract */; break; - case 116 /* AsyncKeyword */: + case 118 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 136 /* Parameter */) { + else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512 /* Async */; @@ -26326,7 +26920,7 @@ var ts; break; } } - if (node.kind === 142 /* Constructor */) { + if (node.kind === 144 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -26344,10 +26938,10 @@ var ts; } return; } - else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 136 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512 /* Async */) { @@ -26359,10 +26953,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 141 /* MethodDeclaration */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -26428,7 +27022,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 172 /* ArrowFunction */) { + if (node.kind === 174 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -26463,7 +27057,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 128 /* StringKeyword */ && parameter.type.kind !== 126 /* NumberKeyword */) { + if (parameter.type.kind !== 130 /* StringKeyword */ && parameter.type.kind !== 128 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -26496,7 +27090,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 185 /* OmittedExpression */) { + if (arg.kind === 187 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -26523,7 +27117,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81 /* ExtendsKeyword */) { + if (heritageClause.token === 83 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -26536,7 +27130,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -26552,14 +27146,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81 /* ExtendsKeyword */) { + if (heritageClause.token === 83 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -26570,19 +27164,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 134 /* ComputedPropertyName */) { + if (node.kind !== 136 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 179 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 181 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -26599,7 +27193,7 @@ var ts; return grammarErrorOnNode(questionToken, message); } } - function checkGrammarObjectLiteralExpression(node) { + function checkGrammarObjectLiteralExpression(node, inDestructuring) { var seen = {}; var Property = 1; var GetAccessor = 2; @@ -26608,12 +27202,17 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 185 /* OmittedExpression */ || - name_16.kind === 134 /* ComputedPropertyName */) { + if (prop.kind === 187 /* OmittedExpression */ || + name_16.kind === 136 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_16); continue; } + if (prop.kind === 246 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern + // outside of destructuring it is a syntax error + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + } // ECMA-262 11.1.5 Object Initialiser // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and @@ -26623,7 +27222,7 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */) { + if (prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_16.kind === 8 /* NumericLiteral */) { @@ -26631,13 +27230,13 @@ var ts; } currentKind = Property; } - else if (prop.kind === 141 /* MethodDeclaration */) { + else if (prop.kind === 143 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 143 /* GetAccessor */) { + else if (prop.kind === 145 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 144 /* SetAccessor */) { + else if (prop.kind === 146 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -26669,7 +27268,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 237 /* JsxSpreadAttribute */) { + if (attr.kind === 239 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -26681,7 +27280,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 238 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 240 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -26690,24 +27289,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 210 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 212 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -26730,10 +27329,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 143 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 145 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 144 /* SetAccessor */) { + else if (kind === 146 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -26758,7 +27357,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 134 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 136 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -26768,7 +27367,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 163 /* ObjectLiteralExpression */) { + if (node.parent.kind === 165 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -26792,22 +27391,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 213 /* InterfaceDeclaration */) { + else if (node.parent.kind === 215 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 153 /* TypeLiteral */) { + else if (node.parent.kind === 155 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: return true; - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -26819,11 +27418,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 200 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 202 /* ContinueStatement */ && !isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -26831,8 +27430,8 @@ var ts; return false; } break; - case 204 /* SwitchStatement */: - if (node.kind === 201 /* BreakStatement */ && !node.label) { + case 206 /* SwitchStatement */: + if (node.kind === 203 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -26847,13 +27446,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 201 /* BreakStatement */ + var message = node.kind === 203 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 201 /* BreakStatement */ + var message = node.kind === 203 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -26865,7 +27464,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 160 /* ArrayBindingPattern */ || node.name.kind === 159 /* ObjectBindingPattern */) { + if (node.name.kind === 162 /* ArrayBindingPattern */ || node.name.kind === 161 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -26875,7 +27474,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 198 /* ForInStatement */ && node.parent.parent.kind !== 199 /* ForOfStatement */) { + if (node.parent.parent.kind !== 200 /* ForInStatement */ && node.parent.parent.kind !== 201 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -26902,7 +27501,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 67 /* Identifier */) { + if (name.kind === 69 /* Identifier */) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -26911,7 +27510,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 185 /* OmittedExpression */) { + if (element.kind !== 187 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -26928,15 +27527,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 194 /* IfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 196 /* IfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return false; - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -26952,7 +27551,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 177 /* PrefixUnaryExpression */) { + if (expression.kind === 179 /* PrefixUnaryExpression */) { var unaryExpression = expression; if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { expression = unaryExpression.operand; @@ -26968,37 +27567,6 @@ var ts; } return false; } - function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 32768 /* Const */) !== 0; - var hasError = false; - // skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions. - // since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members. - if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { - var node = _a[_i]; - // Do not use hasDynamicName here, because that returns false for well known symbols. - // We want to perform checkComputedPropertyName for all computed properties, including - // well known symbols. - if (node.name.kind === 134 /* ComputedPropertyName */) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); - } - else if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer)) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; - } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; - } - } - } - return hasError; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -27024,7 +27592,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -27044,12 +27612,12 @@ var ts; return true; } } - else if (node.parent.kind === 213 /* InterfaceDeclaration */) { + else if (node.parent.kind === 215 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 153 /* TypeLiteral */) { + else if (node.parent.kind === 155 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -27069,11 +27637,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 213 /* InterfaceDeclaration */ || - node.kind === 220 /* ImportDeclaration */ || - node.kind === 219 /* ImportEqualsDeclaration */ || - node.kind === 226 /* ExportDeclaration */ || - node.kind === 225 /* ExportAssignment */ || + if (node.kind === 215 /* InterfaceDeclaration */ || + node.kind === 222 /* ImportDeclaration */ || + node.kind === 221 /* ImportEqualsDeclaration */ || + node.kind === 228 /* ExportDeclaration */ || + node.kind === 227 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 1024 /* Default */))) { return false; @@ -27083,7 +27651,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 191 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 193 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -27109,7 +27677,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 190 /* Block */ || node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { + if (node.parent.kind === 192 /* Block */ || node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -27160,6 +27728,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; + var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; @@ -27191,7 +27760,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 220 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -27245,6 +27814,7 @@ var ts; function createAndSetNewTextWriterWithSymbolWriter() { var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -27267,10 +27837,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 209 /* VariableDeclaration */) { + if (declaration.kind === 211 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 223 /* NamedImports */ || declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 221 /* ImportClause */) { + else if (declaration.kind === 225 /* NamedImports */ || declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 223 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -27288,7 +27858,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 220 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 222 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -27298,12 +27868,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -27337,6 +27907,11 @@ var ts; function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); } + function reportInaccessibleThisError() { + if (errorNameNode) { + diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); @@ -27345,7 +27920,9 @@ var ts; emitType(type); } else { + errorNameNode = declaration.name; resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + errorNameNode = undefined; } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -27356,7 +27933,9 @@ var ts; emitType(signature.type); } else { + errorNameNode = signature.name; resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + errorNameNode = undefined; } } function emitLines(nodes) { @@ -27395,49 +27974,50 @@ var ts; } function emitType(type) { switch (type.kind) { - case 115 /* AnyKeyword */: - case 128 /* StringKeyword */: - case 126 /* NumberKeyword */: - case 118 /* BooleanKeyword */: - case 129 /* SymbolKeyword */: - case 101 /* VoidKeyword */: + case 117 /* AnyKeyword */: + case 130 /* StringKeyword */: + case 128 /* NumberKeyword */: + case 120 /* BooleanKeyword */: + case 131 /* SymbolKeyword */: + case 103 /* VoidKeyword */: + case 97 /* ThisKeyword */: case 9 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 186 /* ExpressionWithTypeArguments */: + case 188 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 149 /* TypeReference */: + case 151 /* TypeReference */: return emitTypeReference(type); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return emitTypeQuery(type); - case 154 /* ArrayType */: + case 156 /* ArrayType */: return emitArrayType(type); - case 155 /* TupleType */: + case 157 /* TupleType */: return emitTupleType(type); - case 156 /* UnionType */: + case 158 /* UnionType */: return emitUnionType(type); - case 157 /* IntersectionType */: + case 159 /* IntersectionType */: return emitIntersectionType(type); - case 158 /* ParenthesizedType */: + case 160 /* ParenthesizedType */: return emitParenType(type); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 153 /* TypeLiteral */: + case 155 /* TypeLiteral */: return emitTypeLiteral(type); - case 67 /* Identifier */: + case 69 /* Identifier */: return emitEntityName(type); - case 133 /* QualifiedName */: + case 135 /* QualifiedName */: return emitEntityName(type); - case 148 /* TypePredicate */: + case 150 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 67 /* Identifier */) { + if (entityName.kind === 69 /* Identifier */) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 133 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 133 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); @@ -27446,13 +28026,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 219 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 221 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 67 /* Identifier */ || node.expression.kind === 164 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 166 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -27533,7 +28113,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -27553,7 +28133,7 @@ var ts; write(";"); writeLine(); // Make all the declarations visible for the export name - if (node.expression.kind === 67 /* Identifier */) { + if (node.expression.kind === 69 /* Identifier */) { var nodes = resolver.collectLinkedAliases(node.expression); // write each of these declarations asynchronously writeAsynchronousModuleElements(nodes); @@ -27572,10 +28152,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 219 /* ImportEqualsDeclaration */ || - (node.parent.kind === 246 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 221 /* ImportEqualsDeclaration */ || + (node.parent.kind === 248 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -27585,7 +28165,7 @@ var ts; }); } else { - if (node.kind === 220 /* ImportDeclaration */) { + if (node.kind === 222 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -27603,23 +28183,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return writeVariableStatement(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return writeClassDeclaration(node); - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -27635,7 +28215,7 @@ var ts; if (node.flags & 1024 /* Default */) { write("default "); } - else if (node.kind !== 213 /* InterfaceDeclaration */) { + else if (node.kind !== 215 /* InterfaceDeclaration */) { write("declare "); } } @@ -27684,7 +28264,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 222 /* NamespaceImport */) { + if (namedBindings.kind === 224 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -27712,7 +28292,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -27770,7 +28350,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 217 /* ModuleBlock */) { + while (node.body.kind !== 219 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -27835,7 +28415,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 141 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -27846,15 +28426,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 153 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 141 /* MethodDeclaration */ || - node.parent.kind === 140 /* MethodSignature */ || - node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - node.parent.kind === 145 /* CallSignature */ || - node.parent.kind === 146 /* ConstructSignature */); + if (node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 155 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 143 /* MethodDeclaration */ || + node.parent.kind === 142 /* MethodSignature */ || + node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + node.parent.kind === 147 /* CallSignature */ || + node.parent.kind === 148 /* ConstructSignature */); emitType(node.constraint); } else { @@ -27865,31 +28445,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -27917,13 +28497,13 @@ var ts; if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - else if (!isImplementsList && node.expression.kind === 91 /* NullKeyword */) { + else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + if (node.parent.parent.kind === 214 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -28007,7 +28587,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 209 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 211 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -28017,10 +28597,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && node.parent.kind === 153 /* TypeLiteral */) { + if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -28029,14 +28609,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 209 /* VariableDeclaration */) { + if (node.kind === 211 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) { + else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -28045,7 +28625,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28077,7 +28657,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 185 /* OmittedExpression */) { + if (element.kind !== 187 /* OmittedExpression */) { elements.push(element); } } @@ -28147,7 +28727,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 143 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 145 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -28160,7 +28740,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 143 /* GetAccessor */ + return accessor.kind === 145 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -28169,7 +28749,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 144 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -28219,17 +28799,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 211 /* FunctionDeclaration */) { + if (node.kind === 213 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 141 /* MethodDeclaration */) { + else if (node.kind === 143 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 211 /* FunctionDeclaration */) { + if (node.kind === 213 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 142 /* Constructor */) { + else if (node.kind === 144 /* Constructor */) { write("constructor"); } else { @@ -28247,11 +28827,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 146 /* ConstructSignature */ || node.kind === 151 /* ConstructorType */) { + if (node.kind === 148 /* ConstructSignature */ || node.kind === 153 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { write("["); } else { @@ -28261,22 +28841,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 147 /* IndexSignature */) { + if (node.kind === 149 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 150 /* FunctionType */ || node.kind === 151 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 153 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 152 /* FunctionType */ || node.kind === 153 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 155 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 142 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 144 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -28287,26 +28867,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 145 /* CallSignature */: + case 147 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -28314,7 +28894,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.kind === 214 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -28328,7 +28908,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -28363,9 +28943,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 150 /* FunctionType */ || - node.parent.kind === 151 /* ConstructorType */ || - node.parent.parent.kind === 153 /* TypeLiteral */) { + if (node.parent.kind === 152 /* FunctionType */ || + node.parent.kind === 153 /* ConstructorType */ || + node.parent.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -28381,24 +28961,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 142 /* Constructor */: + case 144 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 145 /* CallSignature */: + case 147 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -28406,7 +28986,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28419,7 +28999,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -28431,12 +29011,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 159 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 161 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 160 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 162 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -28455,7 +29035,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 185 /* OmittedExpression */) { + if (bindingElement.kind === 187 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -28464,7 +29044,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 161 /* BindingElement */) { + else if (bindingElement.kind === 163 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -28487,7 +29067,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 67 /* Identifier */); + ts.Debug.assert(bindingElement.name.kind === 69 /* Identifier */); // If the node is just an identifier, we will simply emit the text associated with the node's name // Example: // original: function foo({y = 10, x}) {} @@ -28503,40 +29083,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 216 /* ModuleDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 213 /* InterfaceDeclaration */: - case 212 /* ClassDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: + case 213 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 215 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: return emitExportDeclaration(node); - case 142 /* Constructor */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 144 /* Constructor */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return writeFunctionDeclaration(node); - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 147 /* IndexSignature */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 149 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: return emitAccessorDeclaration(node); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return emitPropertyDeclaration(node); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: return emitExportAssignment(node); - case 246 /* SourceFile */: + case 248 /* SourceFile */: return emitSourceFile(node); } } @@ -28587,6425 +29167,6 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; - // Flags enum to track count of temp variables and a few dedicated names - var TempFlags; - (function (TempFlags) { - TempFlags[TempFlags["Auto"] = 0] = "Auto"; - TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; - TempFlags[TempFlags["_i"] = 268435456] = "_i"; - })(TempFlags || (TempFlags = {})); - // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile) { - // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - // emit output for the __param helper function - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; - var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; - if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - else { - // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - // Sort and make the unique list of diagnostics - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); - return { - emitSkipped: false, - diagnostics: diagnostics, - sourceMaps: sourceMapDataList - }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { - return false; - } - } - } - return true; - } - function emitJavaScript(jsFilePath, root) { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var currentSourceFile; - // name of an exporter function if file is a System external module - // System.register([...], function () {...}) - // exporting in System modules looks like: - // export var x; ... x = 1 - // => - // var x;... exporter("x", x = 1) - var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; - var computedPropertyNamesToGeneratedNames; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStars; - /** Write emitted output to disk */ - var writeEmittedFiles = writeJavaScriptFile; - var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - /** Emit a node */ - var emit = emitNodeWithCommentsAndWithoutSourcemap; - /** Called just before starting emit of a node */ - var emitStart = function (node) { }; - /** Called once the emit of the node is done */ - var emitEnd = function (node) { }; - /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind - * but if optional emitFn callback is provided the text is emitted using the callback instead of default text - * @param tokenKind the kind of the token to search and emit - * @param startPos the position in the source to start searching for the token - * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - var emitToken = emitTokenText; - /** Called to before starting the lexical scopes as in function/class in the emitted code because of node - * @param scopeDeclaration node that starts the lexical scope - * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - /** Called after coming out of the scope */ - var scopeEmitEnd = function () { }; - /** Sourcemap data that will get encoded */ - var sourceMapData; - /** If removeComments is true, no leading-comments needed to be emitted **/ - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); - return; - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - emit(sourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - // Return the next available name in the pattern _a ... _z, _0, _1, ... - // TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. - // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_19)) { - tempFlags |= flags; - return name_19; - } - } - while (true) { - var count = tempFlags & 268435455 /* CountMask */; - tempFlags++; - // Skip over 'i' and 'n' - if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; - } - } - } - } - // Generate a name that is unique within the current file and doesn't conflict with any names - // in global scope. The name is formed by adding an '_n' suffix to the specified base name, - // where n is a positive integer. Note that names generated by makeTempVariableName and - // makeUniqueName are guaranteed to never conflict. - function makeUniqueName(baseName) { - // Find the first unique 'name_n', where n is a positive number - if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 /* StringLiteral */ ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 67 /* Identifier */: - return makeUniqueName(node.text); - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - return generateNameForModuleOrEnum(node); - case 220 /* ImportDeclaration */: - case 226 /* ExportDeclaration */: - return generateNameForImportOrExportDeclaration(node); - case 211 /* FunctionDeclaration */: - case 212 /* ClassDeclaration */: - case 225 /* ExportAssignment */: - return generateNameForExportDefault(); - case 184 /* ClassExpression */: - return generateNameForClassExpression(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - function initializeEmitterWithSourceMaps() { - var sourceMapDir; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - var sourceMapSourceIndex = -1; - // Names and its index map - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; - } - // Last recorded and encoded spans - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - // Add a new least significant bit that has the sign of the value. - // if negative number the least significant bit that gets added to the number has value 1 - // else least significant bit value that gets added is 0 - // eg. -1 changes to binary : 01 [1] => 3 - // +1 changes to binary : 01 [0] => 2 - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; - do { - var currentDigit = inValue & 31; // 11111 - inValue = inValue >> 5; - if (inValue > 0) { - // There are still more digits to decode, set the msb (6th bit) - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } - } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - // Convert the location to be one-based. - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - // If this location wasn't recorded or the location in source is going backwards, record the span - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - // New span - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path - // otherwise source locations relative to map file location - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - // Child scopes are always shown with a dot (even if they have no name), - // unless it is a computed property. Then it is shown with brackets, - // but the brackets are included in the name. - var name_21 = node.name; - if (!name_21 || name_21.kind !== 134 /* ComputedPropertyName */) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - // The scope was already given a name use it - recordScopeNameStart(scopeName); - } - else if (node.kind === 211 /* FunctionDeclaration */ || - node.kind === 171 /* FunctionExpression */ || - node.kind === 141 /* MethodDeclaration */ || - node.kind === 140 /* MethodSignature */ || - node.kind === 143 /* GetAccessor */ || - node.kind === 144 /* SetAccessor */ || - node.kind === 216 /* ModuleDeclaration */ || - node.kind === 212 /* ClassDeclaration */ || - node.kind === 215 /* EnumDeclaration */) { - // Declaration and has associated name use it - if (node.name) { - var name_22 = node.name; - // For computed property names, the text will include the brackets - scopeName = name_22.kind === 134 /* ComputedPropertyName */ - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - // Block just use the name from upper level scope - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - // Encode the sourceMap into the sourceMap url - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); - } - // Initialize source map data - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the - // relative paths of the sources list in the sourcemap - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - // For modules or multiple emit files the mapRoot will have directory structure like the sources - // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - // The relative paths are relative to the common directory - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath - ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap - host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 246 /* SourceFile */) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); - } - // Create a temporary variable with a unique unused name. - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(67 /* Identifier */); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - function emitTokenText(tokenKind, startPos, emitFn) { - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); - } - else { - write(tokenString); - } - return startPos + tokenString.length; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - // This emitting is to make sure we emit following comment properly - // ...(x, /*comment1*/ y)... - // ^ => node.pos - // "comment1" is not considered leading comment for "y" but rather - // considered as trailing comment of the previous node. - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, /*startIndex*/ 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98 /* b */: - case 66 /* B */: - case 111 /* o */: - case 79 /* O */: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - // Any template literal or string literal with an extended escape - // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. - if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); - } - // If we don't need to downlevel and we can reach the original source text using - // the node's parent reference, then simply get the text as it was originally written. - if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - } - // If we can't reach the original source text, use the canonical form if it's a number, - // or an escaped quoted form of the original text if it's string-like. - switch (node.kind) { - case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); - case 11 /* NoSubstitutionTemplateLiteral */: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12 /* TemplateHead */: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13 /* TemplateMiddle */: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14 /* TemplateTail */: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8 /* NumericLiteral */: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - // Find original source text, since we need to emit the raw strings of the tagged template. - // The raw strings contain the (escaped) strings of what the user wrote. - // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), - // thus we need to remove those characters. - // First template piece starts with "`", others with "}" - // Last template piece ends with "`", others with "${" - var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - // Newline normalization: - // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's - // and LineTerminatorSequences are normalized to for both TV and TRV. - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); - }); - } - write("]"); - } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - // Now we emit the expressions - if (node.template.kind === 181 /* TemplateExpression */) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 179 /* BinaryExpression */ - && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); - } - function emitTemplateExpression(node) { - // In ES6 mode and above, we can simply emit each portion of a template in order, but in - // ES3 & ES5 we must convert the template expression into a series of string concatenations. - if (languageVersion >= 2 /* ES6 */) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - // Check if the expression has operands and binds its operands less closely than binary '+'. - // If it does, we need to wrap the expression in parentheses. Otherwise, something like - // `abc${ 1 << 2 }` - // becomes - // "abc" + 1 << 2 + "" - // which is really - // ("abc" + 1) << (2 + "") - // rather than - // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 170 /* ParenthesizedExpression */ - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; - if (i > 0 || headEmitted) { - // If this is the first span and the head was not emitted, then this templateSpan's - // expression will be the first to be emitted. Don't emit the preceding ' + ' in that - // case. - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - // Only emit if the literal is non-empty. - // The binary '+' operator is left-associative, so the first string concatenation - // with the head will force the result up to this point to be a string. - // Emitting a '+ ""' has no semantic effect for middles and tails. - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); - } - } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar - // There is always atleast one templateSpan in this code path, since - // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 166 /* CallExpression */: - case 167 /* NewExpression */: - return parent.expression === template; - case 168 /* TaggedTemplateExpression */: - case 170 /* ParenthesizedExpression */: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; - } - } - /** - * Returns whether the expression has lesser, greater, - * or equal precedence to the binary '+' operator - */ - function comparePrecedenceToBinaryPlus(expression) { - // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' - // which have greater precedence and '-' which has equal precedence. - // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, - // although we convert the former into regular function expressions in ES5 mode, - // and in ES6 mode this function won't get called anyway. - // - // TODO (drosen): Note that we need to account for the upcoming 'yield' and - // spread ('...') unary operators that are anticipated for ES6. - switch (expression.kind) { - case 179 /* BinaryExpression */: - switch (expression.operatorToken.kind) { - case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: - return 1 /* GreaterThan */; - case 35 /* PlusToken */: - case 36 /* MinusToken */: - return 0 /* EqualTo */; - default: - return -1 /* LessThan */; - } - case 182 /* YieldExpression */: - case 180 /* ConditionalExpression */: - return -1 /* LessThan */; - default: - return 1 /* GreaterThan */; - } - } - } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); - } - function jsxEmitReact(node) { - /// Emit a tag name, which is either '"div"' for lower-cased names, or - /// 'Div' for upper-cased or dotted names - function emitTagName(name) { - if (name.kind === 67 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - /// Emit an attribute name, which is quoted if it needs to be quoted. Because - /// these emit into an object literal property name, we don't need to be worried - /// about keywords, just non-identifier characters - function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - /// Emit an name/value pair for an attribute (e.g. "x: 3") - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } - } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */); - syntheticReactRef.text = 'React'; - syntheticReactRef.parent = openingNode; - // Call React.createElement(tag, ... - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - // Attribute list - if (openingNode.attributes.length === 0) { - // When there are no attributes, React wants "null" - write("null"); - } - else { - // Either emit one big object literal (no spread attribs), or - // a call to React.__spread - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); - var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { - // If this is the first argument, we need to emit a {} as the first argument - if (i_1 === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i_1 > 0) { - write(", "); - } - emit(attrs[i_1].expression); - } - else { - ts.Debug.assert(attrs[i_1].kind === 236 /* JsxAttribute */); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i_1 > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i_1]); - } - } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); // closing paren to React.__spread( - } - else { - // One object literal with all the attributes in them - write("{"); - for (var i = 0; i < attrs.length; i++) { - if (i > 0) { - write(", "); - } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - // Children - if (children) { - for (var i = 0; i < children.length; i++) { - // Don't emit empty expressions - if (children[i].kind === 238 /* JsxExpression */ && !(children[i].expression)) { - continue; - } - // Don't emit empty strings - if (children[i].kind === 234 /* JsxText */) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); - } - } - else { - write(", "); - emit(children[i]); - } - } - } - // Closing paren - write(")"); // closes "React.createElement(" - emitTrailingComments(openingNode); - } - if (node.kind === 231 /* JsxElement */) { - emitJsxElement(node.openingElement, node.children); - } - else { - ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); - emitJsxElement(node); - } - } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); - } - } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); - } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 237 /* JsxSpreadAttribute */) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 236 /* JsxAttribute */); - emitJsxAttribute(attribs[i]); - } - } - } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 232 /* JsxSelfClosingElement */)) { - write(" "); - } - emitAttributes(node.attributes); - if (node.kind === 232 /* JsxSelfClosingElement */) { - write("/>"); - } - else { - write(">"); - } - } - function emitJsxClosingElement(node) { - write(""); - } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 231 /* JsxElement */) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); - emitJsxOpeningOrSelfClosingElement(node); - } - } - // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. - // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. - // For example, this is utilized when feeding in a result to Object.defineProperty. - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 161 /* BindingElement */); - if (node.kind === 9 /* StringLiteral */) { - emitLiteral(node); - } - else if (node.kind === 134 /* ComputedPropertyName */) { - // if this is a decorated computed property, we will need to capture the result - // of the property expression so that we can apply decorators later. This is to ensure - // we don't introduce unintended side effects: - // - // class C { - // [_a = x]() { } - // } - // - // The emit for the decorated computed property decorator is: - // - // Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); - // - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - // we have already generated a variable for this node, write that value instead. - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0 /* Auto */).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write("\""); - if (node.kind === 8 /* NumericLiteral */) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - write("\""); - } - } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 162 /* ArrayLiteralExpression */: - case 179 /* BinaryExpression */: - case 166 /* CallExpression */: - case 239 /* CaseClause */: - case 134 /* ComputedPropertyName */: - case 180 /* ConditionalExpression */: - case 137 /* Decorator */: - case 173 /* DeleteExpression */: - case 195 /* DoStatement */: - case 165 /* ElementAccessExpression */: - case 225 /* ExportAssignment */: - case 193 /* ExpressionStatement */: - case 186 /* ExpressionWithTypeArguments */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 194 /* IfStatement */: - case 232 /* JsxSelfClosingElement */: - case 233 /* JsxOpeningElement */: - case 237 /* JsxSpreadAttribute */: - case 238 /* JsxExpression */: - case 167 /* NewExpression */: - case 170 /* ParenthesizedExpression */: - case 178 /* PostfixUnaryExpression */: - case 177 /* PrefixUnaryExpression */: - case 202 /* ReturnStatement */: - case 244 /* ShorthandPropertyAssignment */: - case 183 /* SpreadElementExpression */: - case 204 /* SwitchStatement */: - case 168 /* TaggedTemplateExpression */: - case 188 /* TemplateSpan */: - case 206 /* ThrowStatement */: - case 169 /* TypeAssertionExpression */: - case 174 /* TypeOfExpression */: - case 175 /* VoidExpression */: - case 196 /* WhileStatement */: - case 203 /* WithStatement */: - case 182 /* YieldExpression */: - return true; - case 161 /* BindingElement */: - case 245 /* EnumMember */: - case 136 /* Parameter */: - case 243 /* PropertyAssignment */: - case 139 /* PropertyDeclaration */: - case 209 /* VariableDeclaration */: - return parent.initializer === node; - case 164 /* PropertyAccessExpression */: - return parent.expression === node; - case 172 /* ArrowFunction */: - case 171 /* FunctionExpression */: - return parent.body === node; - case 219 /* ImportEqualsDeclaration */: - return parent.moduleReference === node; - case 133 /* QualifiedName */: - return parent.left === node; - } - return false; - } - function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { - write("_arguments"); - return; - } - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 246 /* SourceFile */) { - // Identifier references module export - if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { - write("exports."); - } - } - else { - // Identifier references namespace export - write(getGeneratedNameForNode(container)); - write("."); - } - } - else if (languageVersion < 2 /* ES6 */) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 221 /* ImportClause */) { - // Identifier references default import - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); - return; - } - else if (declaration.kind === 224 /* ImportSpecifier */) { - // Identifier references named import - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); - if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); - } - else { - write("."); - write(identifier); - } - return; - } - } - declaration = resolver.getReferencedNestedRedeclaration(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function isNameOfNestedRedeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 161 /* BindingElement */: - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 209 /* VariableDeclaration */: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); - } - } - return false; - } - function emitIdentifier(node) { - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - emitExpressionIdentifier(node); - } - else if (isNameOfNestedRedeclaration(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { - write("_this"); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2 /* ES6 */) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256 /* SuperInstance */) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { - write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); - write("]"); - } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); - } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); - } - function emitYieldExpression(node) { - write(ts.tokenToString(112 /* YieldKeyword */)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } - } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(112 /* YieldKeyword */)); - write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } - } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 179 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 180 /* ConditionalExpression */ && node.parent.condition === node) { - return true; - } - return false; - } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 67 /* Identifier */: - case 162 /* ArrayLiteralExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: - case 166 /* CallExpression */: - case 170 /* ParenthesizedExpression */: - // This list is not exhaustive and only includes those cases that are relevant - // to the check in emitArrayLiteral. More cases can be added as needed. - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - // Emit using the pattern .concat(, , ...) - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 183 /* SpreadElementExpression */) { - e = e.expression; - emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162 /* ArrayLiteralExpression */) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 183 /* SpreadElementExpression */) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 183 /* SpreadElementExpression */; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); - write("]"); - } - else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, - /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } - write("{"); - if (numElements > 0) { - var properties = node.properties; - // If we are not doing a downlevel transformation for object literals, - // then try to preserve the original shape of the object literal. - // Otherwise just try to preserve the formatting. - if (numElements === properties.length) { - emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); - } - else { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - } - write("}"); - } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createAndRecordTempVariable(0 /* Auto */); - // Write out the first non-computed properties - // (or all properties if none of them are computed), - // then emit the rest through indexing on the temp variable. - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 143 /* GetAccessor */ || property.kind === 144 /* SetAccessor */) { - // TODO (drosen): Reconcile with 'emitMemberFunctions'. - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 243 /* PropertyAssignment */) { - emit(property.initializer); - } - else if (property.kind === 244 /* ShorthandPropertyAssignment */) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 141 /* MethodDeclaration */) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2 /* ES6 */) { - var numProperties = properties.length; - // Find the first computed property. - // Everything until that point can be emitted as part of the initial object literal. - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 134 /* ComputedPropertyName */) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } - } - // Ordinary case: either the object has no computed properties - // or we're compiling with an ES6+ target. - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(179 /* BinaryExpression */, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(164 /* PropertyAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(165 /* ElementAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - // When diagnosing whether the expression needs parentheses, the decision should be based - // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 169 /* TypeAssertionExpression */ || expr.kind === 187 /* AsExpression */) { - expr = expr.expression; - } - // isLeftHandSideExpression is almost the correct criterion for when it is not necessary - // to parenthesize the expression before a dot. The known exceptions are: - // - // NewExpression: - // new C.x -> not the same as (new C).x - // NumberLiteral - // 1.x -> not the same as (1).x - // - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 167 /* NewExpression */ && - expr.kind !== 8 /* NumericLiteral */) { - return expr; - } - var node = ts.createSynthesizedNode(170 /* ParenthesizedExpression */); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2 /* ES6 */) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - // This is to ensure that we emit comment in the following case: - // For example: - // obj = { - // id: /*comment1*/ ()=>void - // } - // "comment1" is not considered to be leading comment for node.initializer - // but rather a trailing comment on the previous node. - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - // Return true if identifier resolves to an exported member of a namespace - function isNamespaceExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 246 /* SourceFile */; - } - function emitShorthandPropertyAssignment(node) { - // The name property of a short-hand property assignment is considered an expression position, so here - // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentSourceFile, node.name); - // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, - // we emit a normal property assignment. For example: - // module m { - // export let y; - // } - // module m { - // let obj = { y }; - // } - // Here we need to emit obj = { y : m.y } regardless of the output target. - if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { - // Emit identifier as an identifier - write(": "); - emit(node.name); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 164 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 164 /* PropertyAccessExpression */ || node.kind === 165 /* ElementAccessExpression */ - ? resolver.getConstantValue(node) - : undefined; - } - // Returns 'true' if the code was actually indented, false otherwise. - // If the code is not indented, an optional valueToWriteWhenNotIndenting will be - // emitted instead. - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - // Always use a newline for synthesized code if the synthesizer desires it. - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - // 1 .toString is a valid property access, emit a space after the literal - // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - var shouldEmitSpace; - if (!indentedBeforeDot) { - if (node.expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; - } - else { - // check if constant enum value is integer - var constantValue = tryGetConstEnumValue(node.expression); - // isFinite handles cases when constantValue is undefined - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 67 /* Identifier */) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, /*useFallback*/ true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, /*useFallback*/ false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 67 /* Identifier */: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 133 /* QualifiedName */: - emitQualifiedNameAsExpression(node, useFallback); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 183 /* SpreadElementExpression */; }); - } - function skipParentheses(node) { - while (node.kind === 170 /* ParenthesizedExpression */ || node.kind === 169 /* TypeAssertionExpression */ || node.kind === 187 /* AsExpression */) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 67 /* Identifier */ || node.kind === 95 /* ThisKeyword */ || node.kind === 93 /* SuperKeyword */) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 164 /* PropertyAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 165 /* ElementAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 93 /* SuperKeyword */) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 93 /* SuperKeyword */) { - // Calls of form super(...) and super.foo(...) - emitThis(target); - } - else { - // Calls of form obj.foo(...) - emit(target); - } - } - else { - // Calls of form foo(...) - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); - write(")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var superCall = false; - if (node.expression.kind === 93 /* SuperKeyword */) { - emitSuper(node.expression); - superCall = true; - } - else { - emit(node.expression); - superCall = node.expression.kind === 164 /* PropertyAccessExpression */ && node.expression.expression.kind === 93 /* SuperKeyword */; - } - if (superCall && languageVersion < 2 /* ES6 */) { - write(".call("); - emitThis(node.expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - // Spread operator logic is supported in new expressions in ES5 using a combination - // of Function.prototype.bind() and Function.prototype.apply(). - // - // Example: - // - // var args = [1, 2, 3, 4, 5]; - // new Array(...args); - // - // is compiled into the following ES5: - // - // var args = [1, 2, 3, 4, 5]; - // new (Array.bind.apply(Array, [void 0].concat(args))); - // - // The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new', - // Thus, we set it to undefined ('void 0'). - if (languageVersion === 1 /* ES5 */ && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2 /* ES6 */) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - // If the node is synthesized, it means the emitter put the parentheses there, - // not the user. If we didn't want them, the emitter would not have put them - // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172 /* ArrowFunction */) { - if (node.expression.kind === 169 /* TypeAssertionExpression */ || node.expression.kind === 187 /* AsExpression */) { - var operand = node.expression.expression; - // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; - while (operand.kind === 169 /* TypeAssertionExpression */ || operand.kind === 187 /* AsExpression */) { - operand = operand.expression; - } - // We have an expression of the form: (SubExpr) - // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. - // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: - // (new A).foo should be emitted as (new A).foo and not new A.foo - // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() - // new (A()) should be emitted as new (A()) and not new A() - // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 177 /* PrefixUnaryExpression */ && - operand.kind !== 175 /* VoidExpression */ && - operand.kind !== 174 /* TypeOfExpression */ && - operand.kind !== 173 /* DeleteExpression */ && - operand.kind !== 178 /* PostfixUnaryExpression */ && - operand.kind !== 167 /* NewExpression */ && - !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && - !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 164 /* PropertyAccessExpression */)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(76 /* DeleteKeyword */)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(101 /* VoidKeyword */)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(99 /* TypeOfKeyword */)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 67 /* Identifier */ || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 /* VariableDeclaration */ || node.parent.kind === 161 /* BindingElement */); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); - } - function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - // emit - // ++x - // as - // exports('x', ++x) - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - write(ts.tokenToString(node.operator)); - // In some cases, we need to emit a space between the operator and the operand. One obvious case - // is when the operator is an identifier, like delete or typeof. We also need to do this for plus - // and minus expressions in certain cases. Specifically, consider the following two cases (parens - // are just for clarity of exposition, and not part of the source code): - // - // (+(+1)) - // (+(++1)) - // - // We need to emit a space in both cases. In the first case, the absence of a space will make - // the resulting expression a prefix increment operation. And in the second, it will make the resulting - // expression a prefix increment whose operand is a plus expression - (++(+x)) - // The same is true of minus of course. - if (node.operand.kind === 177 /* PrefixUnaryExpression */) { - var operand = node.operand; - if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 40 /* PlusPlusToken */)) { - write(" "); - } - else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 41 /* MinusMinusToken */)) { - write(" "); - } - } - emit(node.operand); - if (exportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - // export function returns the value that was passes as the second argument - // however for postfix unary expressions result value should be the value before modification. - // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 40 /* PlusPlusToken */) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); - } - /* - * Checks if given node is a source file level declaration (not nested in module/function). - * If 'isExported' is true - then declaration must also be exported. - * This function is used in two cases: - * - check if node is a exported source file level value to determine - * if we should also export the value after its it changed - * - check if node is a source level declaration to emit it differently, - * i.e non-exported variable statement 'var x = 1' is hoisted so - * we we emit variable statement 'var' should be dropped. - */ - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = node; - while (current) { - if (current.kind === 246 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); - } - else if (ts.isFunctionLike(current) || current.kind === 217 /* ModuleBlock */) { - return false; - } - else { - current = current.parent; - } - } - } - function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 55 /* EqualsToken */ && - (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 193 /* ExpressionStatement */); - } - else { - var exportChanged = node.operatorToken.kind >= 55 /* FirstAssignment */ && - node.operatorToken.kind <= 66 /* LastAssignment */ && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (exportChanged) { - // emit assignment 'x y' as 'exports("x", x y)' - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - if (exportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - // Helper function to decrease the indent if we previously indented. Allows multiple - // previous indent values to be considered at a time. This also allows caller to just - // call this once, passing in all their appropriate indent values, instead of needing - // to call this helper function multiple times. - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 190 /* Block */) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15 /* OpenBraceToken */, node.pos); - write(" "); - emitToken(16 /* CloseBraceToken */, node.statements.end); - return; - } - emitToken(15 /* OpenBraceToken */, node.pos); - increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 217 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 216 /* ModuleDeclaration */); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 217 /* ModuleBlock */) { - emitTempDeclarations(/*newLine*/ true); - } - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.statements.end); - scopeEmitEnd(); - } - function emitEmbeddedStatement(node) { - if (node.kind === 190 /* Block */) { - write(" "); - emit(node); - } - else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); - } - } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 172 /* ArrowFunction */); - write(";"); - } - function emitIfStatement(node) { - var endPos = emitToken(86 /* IfKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(78 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 194 /* IfStatement */) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - write("do"); - emitEmbeddedStatement(node.statement); - if (node.statement.kind === 190 /* Block */) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); - write(");"); - } - function emitWhileStatement(node) { - write("while ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - /** - * Returns true if start of variable declaration list was emitted. - * Returns false if nothing was written - this can happen for source file level variable declarations - * in system modules where such variable declarations are hoisted. - */ - function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { - // variables in variable declaration list were already hoisted - return false; - } - var tokenKind = 100 /* VarKeyword */; - if (decl && languageVersion >= 2 /* ES6 */) { - if (ts.isLet(decl)) { - tokenKind = 106 /* LetKeyword */; - } - else if (ts.isConst(decl)) { - tokenKind = 72 /* ConstKeyword */; - } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); - } - else { - switch (tokenKind) { - case 100 /* VarKeyword */: - write("var "); - break; - case 106 /* LetKeyword */: - write("let "); - break; - case 72 /* ConstKeyword */: - write("const "); - break; - } - } - return true; - } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { - write(", "); - } - emit(decl); - } - return started; - } - function emitForStatement(node) { - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 199 /* ForOfStatement */) { - return emitDownLevelForOfStatement(node); - } - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 210 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 198 /* ForInStatement */) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); - } - function emitDownLevelForOfStatement(node) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var endPos = emitToken(84 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - // Do not emit the LHS let declaration yet, because it might contain destructuring. - // Do not call recordTempDeclaration because we are declaring the temps - // right here. Recording means they will be declared later. - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 67 /* Identifier */; - var counter = createTempVariable(268435456 /* _i */); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); - // This is the let keyword for the counter and rhsReference. The let keyword for - // the LHS will be emitted inside the body. - emitStart(node.expression); - write("var "); - // _i = 0 - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - if (!rhsIsIdentifier) { - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } - write("; "); - // _i < _a.length; - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.initializer); - write("; "); - // _i++) - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.initializer); - emitToken(18 /* CloseParenToken */, node.expression.end); - // Body - write(" {"); - writeLine(); - increaseIndent(); - // Initialize LHS - // let v = _a[_i]; - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 210 /* VariableDeclarationList */) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - // This works whether the declaration is a var, let, or const. - // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); - } - else { - // The following call does not include the initializer, so we have - // to emit it separately. - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // It's an empty declaration list. This can only happen in an error case, if the user wrote - // for (let of []) {} - emitNodeWithoutSourceMap(createTempVariable(0 /* Auto */)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // Initializer is an expression. Emit the expression in the body, so that it's - // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, 55 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); - if (node.initializer.kind === 162 /* ArrayLiteralExpression */ || node.initializer.kind === 163 /* ObjectLiteralExpression */) { - // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause - // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (node.statement.kind === 190 /* Block */) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - writeLine(); - decreaseIndent(); - write("}"); - } - function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */, node.pos); - emitOptional(" ", node.label); - write(";"); - } - function emitReturnStatement(node) { - emitToken(92 /* ReturnKeyword */, node.pos); - emitOptional(" ", node.expression); - write(";"); - } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitSwitchStatement(node) { - var endPos = emitToken(94 /* SwitchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - endPos = emitToken(18 /* CloseParenToken */, node.expression.end); - write(" "); - emitCaseBlock(node.caseBlock, endPos); - } - function emitCaseBlock(node, startPos) { - emitToken(15 /* OpenBraceToken */, startPos); - increaseIndent(); - emitLines(node.clauses); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 239 /* CaseClause */) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(70 /* CatchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.variableDeclaration); - emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(74 /* DebuggerKeyword */, node.pos); - write(";"); - } - function emitLabelledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 216 /* ModuleDeclaration */); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { - write("exports."); - } - } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); - zero.text = "0"; - var result = ts.createSynthesizedNode(175 /* VoidExpression */); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 246 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 225 /* ExportAssignment */); - // only allow export default at a source file level - if (compilerOptions.module === 1 /* CommonJS */ || compilerOptions.module === 2 /* AMD */ || compilerOptions.module === 3 /* UMD */) { - if (!currentSourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 1 /* ES5 */) { - // default value of configurable, enumerable, writable are `false`. - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); - writeLine(); - } - else if (languageVersion === 0 /* ES3 */) { - write("exports.__esModule = true;"); - writeLine(); - } - } - } - } - } - function emitExportMemberAssignment(node) { - if (node.flags & 1 /* Export */) { - writeLine(); - emitStart(node); - // emit call to exporter only for top level nodes - if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { - // emit export default as - // export("default", ) - write(exportFunctionForFile + "(\""); - if (node.flags & 1024 /* Default */) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 1024 /* Default */) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } - } - function emitExportMemberAssignments(name) { - if (compilerOptions.module === 4 /* System */) { - return; - } - if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } - } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(compilerOptions.module === 4 /* System */); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; - } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - // An exported declaration is actually emitted as an assignment (to a property on the module object), so - // temporary variables in an exported declaration need to have real declarations elsewhere - // Also temporary variables should be explicitly allocated for source level declarations when module target is system - // because actual variable declarations are hoisted - var canDefineTempVariablesInPlace = false; - if (root.kind === 209 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 136 /* Parameter */) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 179 /* BinaryExpression */) { - emitAssignmentExpression(root); - } - else { - ts.Debug.assert(!isAssignmentExpressionStatement); - emitBindingElement(root, value); - } - function emitAssignment(name, value) { - if (emitCount++) { - write(", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 /* VariableDeclaration */ || name.parent.kind === 161 /* BindingElement */); - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - if (exportChanged) { - write(")"); - } - } - /** - * Ensures that there exists a declared identifier whose value holds the given expression. - * This function is useful to ensure that the expression's value can be read from in subsequent expressions. - * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. - * - * @param expr the expression whose value needs to be bound. - * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; - * false if it is necessary to always emit an identifier. - */ - function ensureIdentifier(expr, reuseIdentifierExpressions) { - if (expr.kind === 67 /* Identifier */ && reuseIdentifierExpressions) { - return expr; - } - var identifier = createTempVariable(0 /* Auto */); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - return identifier; - } - function createDefaultValueCheck(value, defaultValue) { - // The value expression will be evaluated twice, so for anything but a simple identifier - // we need to generate a temporary variable - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(180 /* ConditionalExpression */); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(52 /* QuestionToken */); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(53 /* ColonToken */); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8 /* NumericLiteral */); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 67 /* Identifier */) { - return createElementAccessExpression(object, syntheticName); - } - return createPropertyAccessExpression(object, syntheticName); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(166 /* CallExpression */); - var sliceIdentifier = ts.createSynthesizedNode(67 /* Identifier */); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value) { - var properties = target.properties; - if (properties.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; - if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { - var propName = p.name; - emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); - } - } - } - function emitArrayLiteralAssignment(target, value) { - var elements = target.elements; - if (elements.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 185 /* OmittedExpression */) { - if (e.kind !== 183 /* SpreadElementExpression */) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); - } - } - } - } - function emitDestructuringAssignment(target, value) { - if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { - value = createDefaultValueCheck(value, target.right); - target = target.left; - } - if (target.kind === 163 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value); - } - else if (target.kind === 162 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value); - } - else { - emitAssignment(target, value); - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { - if (root.parent.kind !== 170 /* ParenthesizedExpression */) { - write("("); - } - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - emitDestructuringAssignment(target, value); - write(", "); - emit(value); - if (root.parent.kind !== 170 /* ParenthesizedExpression */) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - if (target.initializer) { - // Combine value and initializer - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; - } - else if (!value) { - // Use 'void 0' in absence of value and initializer - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything other than a single-element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. Additionally, if we have zero elements - // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, - // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 159 /* ObjectBindingPattern */) { - // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 185 /* OmittedExpression */) { - if (!element.dotDotDotToken) { - // Rewrite element to a declaration that accesses array element at index i - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value); - } - } - } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - else { - var initializer = node.initializer; - if (!initializer && languageVersion < 2 /* ES6 */) { - // downlevel emit for non-initialized let bindings defined in loops - // for (...) { let x; } - // should be - // for (...) { var = void 0; } - // this is necessary to preserve ES6 semantic in scenarios like - // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); - // NOTE: default initialization should not be added to let bindings in for-in\for-of statements - if (isUninitializedLet && - node.parent.parent.kind !== 198 /* ForInStatement */ && - node.parent.parent.kind !== 199 /* ForOfStatement */) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 185 /* OmittedExpression */) { - return; - } - var name = node.name; - if (name.kind === 67 /* Identifier */) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 209 /* VariableDeclaration */ && node.parent.kind !== 161 /* BindingElement */)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1 /* Export */) && - languageVersion >= 2 /* ES6 */ && - node.parent.kind === 246 /* SourceFile */; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1 /* Export */) { - if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - // If we're not exporting the variables, there's nothing special here. - // Always emit comments for these nodes. - if (!(node.flags & 1 /* Export */)) { - return true; - } - // If we are exporting, but it's a top-level ES6 module exports, - // we'll emit the declaration list verbatim, so emit comments too. - if (isES6ExportedDeclaration(node)) { - return true; - } - // Otherwise, only emit if we have at least one initializer present. - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2 /* ES6 */) { - if (ts.isBindingPattern(node.name)) { - var name_23 = createTempVariable(0 /* Auto */); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_23); - emit(name_23); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2 /* ES6 */) { - var tempIndex = 0; - ts.forEach(node.parameters, function (parameter) { - // A rest parameter cannot have a binding pattern or an initializer, - // so let's just ignore it. - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - // In cases where a binding pattern is simply '[]' or '{}', - // we usually don't want to emit a var declaration; however, in the presence - // of an initializer, we must emit that expression to preserve side effects. - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); - } - else { - emit(tempParameters[tempIndex]); - write(" = "); - emit(initializer); - } - write(";"); - tempIndex++; - } - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); - } - }); - } - } - function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. - if (ts.isBindingPattern(restParam.name)) { - return; - } - var tempName = createTempVariable(268435456 /* _i */).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitAccessor(node) { - write(node.kind === 143 /* GetAccessor */ ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); - } - function shouldEmitAsArrowFunction(node) { - return node.kind === 172 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; - } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 171 /* FunctionExpression */) { - // Emit name if one is present - return !!node.name; - } - if (node.kind === 211 /* FunctionDeclaration */) { - // Emit name if one is present, or emit generated name in down-level case (for export default case) - return !!node.name || languageVersion < 2 /* ES6 */; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitCommentsOnNotEmittedNode(node); - } - // TODO (yuisu) : we should not have special cases to condition emitting comments - // but have one place to fix check for these conditions. - if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */ && - node.parent && node.parent.kind !== 243 /* PropertyAssignment */ && - node.parent.kind !== 166 /* CallExpression */) { - // 1. Methods will emit the comments as part of emitting method declaration - // 2. If the function is a property of object literal, emitting leading-comments - // is done by emitNodeWithoutSourceMap which then call this function. - // In particular, we would like to avoid emit comments twice in following case: - // For example: - // var obj = { - // id: - // /*comment*/ () => void - // } - // 3. If the function is an argument in call expression, emitting of comments will be - // taken care of in emit list of arguments inside of emitCallexpression - emitLeadingComments(node); - } - emitStart(node); - // For targeting below es6, emit functions-like declaration including arrow function using function keyword. - // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024 /* Default */) { - write("default "); - } - } - write("function"); - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); - } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 211 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - // Check whether the parameter list needs parentheses and preserve no-parenthesis - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 172 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; - var args; - // An async function is emit as an outer function that calls an inner - // generator function. To preserve lexical bindings, we pass the current - // `this` and `arguments` objects to `__awaiter`. The generator function - // passed to `__awaiter` is executed inside of the callback to the - // promise constructor. - // - // The emit for an async arrow without a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await b; } - // - // // output - // let a = (b) => __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // - // The emit for an async arrow with a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await arguments[0]; } - // - // // output - // let a = (b) => __awaiter(this, arguments, void 0, function* (arguments) { - // yield arguments[0]; - // }); - // - // The emit for an async function expression without a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await b; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, void 0, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // and a return type annotation might be: - // - // // input - // let a = async function (b): MyPromise { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, MyPromise, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // If this is not an async arrow, emit the opening brace of the function body - // and the start of the return statement. - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments"); - } - else { - write(", void 0"); - } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); - } - else { - write(", Promise"); - } - // Emit the call to __awaiter. - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } - // Emit the signature and body for the inner generator function. - emitFunctionBody(node); - write(")"); - // If this is not an async arrow, emit the closing brace of the outer function body. - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitFunctionBody(node) { - if (!node.body) { - // There can be no body when there are parse errors. Just emit an empty block - // in that case. - write(" { }"); - } - else { - if (node.body.kind === 190 /* Block */) { - emitBlockFunctionBody(node, node.body); - } - else { - emitExpressionFunctionBody(node, node.body); - } - } - } - function emitSignatureAndBody(node) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - // When targeting ES6, emit arrow function natively in ES6 - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2 /* ES6 */) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - // Returns true if any preamble code was emitted. - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - // For es6 and higher we can emit the expression as is. However, in the case - // where the expression might end up looking like a block when emitted, we'll - // also wrap it in parentheses first. For example if you have: a => {} - // then we need to generate: a => ({}) - write(" "); - // Unwrap all type assertions. - var current = body; - while (current.kind === 169 /* TypeAssertionExpression */) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 163 /* ObjectLiteralExpression */); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedComments(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - // If we didn't have to emit any preamble code, then attempt to keep the arrow - // function on one line. - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(/*newLine*/ true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - scopeEmitEnd(); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedComments(body.statements); - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16 /* CloseBraceToken */, body.statements.end); - scopeEmitEnd(); - } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 193 /* ExpressionStatement */) { - var expr = statement.expression; - if (expr && expr.kind === 166 /* CallExpression */) { - var func = expr.expression; - if (func && func.kind === 93 /* SuperKeyword */) { - return statement; - } - } - } - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - // This does not emit source map because it is emitted by caller as caller - // is aware how the property name changes to the property access - // eg. public x = 10; becomes this.x and static x = 10 becomes className.x - if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 134 /* ComputedPropertyName */) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 139 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { - properties.push(member); - } - } - return properties; - } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; - emitPropertyDeclaration(node, property); - } - } - function emitPropertyDeclaration(node, property, receiver, isExpression) { - writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - emit(receiver); - } - else { - if (property.flags & 128 /* Static */) { - emitDeclarationName(node); - } - else { - write("this"); - } - } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 189 /* SemicolonClassElement */) { - writeLine(); - write(";"); - } - else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { - if (!member.body) { - return emitCommentsOnNotEmittedNode(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - else if (member.kind === 141 /* MethodDeclaration */ || - member.kind === 143 /* GetAccessor */ || - member.kind === 144 /* SetAccessor */) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 128 /* Static */) { - write("static "); - } - if (member.kind === 143 /* GetAccessor */) { - write("get "); - } - else if (member.kind === 144 /* SetAccessor */) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 189 /* SemicolonClassElement */) { - writeLine(); - write(";"); - } - } - } - function emitConstructor(node, baseTypeElement) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitConstructorWorker(node, baseTypeElement) { - // Check if we have property assignment inside class declaration. - // If there is property assignment, we need to emit constructor whether users define it or not - // If there is no property assignment, we can omit constructor if users do not define it - var hasInstancePropertyWithInitializer = false; - // Emit the constructor overload pinned comments - ts.forEach(node.members, function (member) { - if (member.kind === 142 /* Constructor */ && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - // Check if there is any non-static property assignment - if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - // For target ES6 and above, if there is no user-defined constructor and there is no property assignment - // do not emit constructor in class declaration. - if (languageVersion >= 2 /* ES6 */ && !ctor && !hasInstancePropertyWithInitializer) { - return; - } - if (ctor) { - emitLeadingComments(ctor); - } - emitStart(ctor || node); - if (languageVersion < 2 /* ES6 */) { - write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); - } - else { - write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - // Based on EcmaScript6 section 14.5.14: Runtime Semantics: ClassDefinitionEvaluation. - // If constructor is empty, then, - // If ClassHeritageopt is present, then - // Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition. - // Else, - // Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition - if (baseTypeElement) { - write("(...args)"); - } - else { - write("()"); - } - } - } - var startIndex = 0; - write(" {"); - scopeEmitStart(node, "constructor"); - increaseIndent(); - if (ctor) { - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedComments(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); - } - else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2 /* ES6 */) { - write("_super.apply(this, arguments);"); - } - else { - write("super(...args);"); - } - emitEnd(baseTypeElement); - } - } - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } - } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); - } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - emitClassLikeDeclarationBelowES6(node); - } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 212 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { - // To preserve the correct runtime semantics when decorators are applied to the class, - // the emit needs to follow one of the following rules: - // - // * For a local class declaration: - // - // @dec class C { - // } - // - // The emit should be: - // - // let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For an exported class declaration: - // - // @dec export class C { - // } - // - // The emit should be: - // - // export let C = class { - // }; - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // - // * For a default export of a class declaration with a name: - // - // @dec default export class C { - // } - // - // The emit should be: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // C = __decorate([dec], C); - // export default C; - // - // * For a default export of a class declaration without a name: - // - // @dec default export class { - // } - // - // The emit should be: - // - // let _default = class { - // } - // _default = __decorate([dec], _default); - // export default _default; - // - if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024 /* Default */) { - write("default "); - } - } - } - // If the class has static properties, and it's a class expression, then we'll need - // to specialize the emit a bit. for a class expression of the form: - // - // class C { static a = 1; static b = 2; ... } - // - // We'll emit: - // - // (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp) - // - // This keeps the expression as an expression, while ensuring that the static parts - // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, /*static:*/ true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184 /* ClassExpression */; - var tempVariable; - if (isClassExpressionWithStaticProperties) { - tempVariable = createAndRecordTempVariable(0 /* Auto */); - write("("); - increaseIndent(); - emit(tempVariable); - write(" = "); - } - write("class"); - // check if this is an "export default class" as it may not have a name. Do not emit the name if the class is decorated. - if ((node.name || !(node.flags & 1024 /* Default */)) && !thisNodeIsDecorated) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - scopeEmitStart(node); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. - // For a decorated class, we need to assign its name (if it has one). This is because we emit - // the class as a class expression to avoid the double-binding of the identifier: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // - if (thisNodeIsDecorated) { - write(";"); - } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); - } - write(","); - writeLine(); - emit(tempVariable); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); - } - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { - // if this is a top level default export of decorated class, write the export after the declaration. - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 212 /* ClassDeclaration */) { - // source file level classes in system modules are hoisted so 'var's for them are already defined - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - scopeEmitStart(node); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); - writeLine(); - emitDecoratorsOfClass(node); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(/*newLine*/ true); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - emitStart(node); - write(")("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write(")"); - if (node.kind === 212 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - if (node.kind === 212 /* ClassDeclaration */) { - emitExportMemberAssignment(node); - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 128 /* Static */)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 128 /* Static */); - emitDecoratorsOfConstructor(node); - } - function emitDecoratorsOfConstructor(node) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !hasDecoratedParameters) { - return; - } - // Emit the call to __decorate. Given the class: - // - // @dec - // class C { - // } - // - // The emit for the class is: - // - // C = __decorate([dec], C); - // - writeLine(); - emitStart(node); - emitDeclarationName(node); - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); - emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(");"); - emitEnd(node); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - // only emit members in the correct group - if ((member.flags & 128 /* Static */) !== staticFlag) { - continue; - } - // skip members that cannot be decorated (such as the constructor) - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - // skip a member if it or any of its parameters are not decorated - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } - // skip an accessor declaration if it is not the first accessor - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - // get the decorators from the first accessor with decorators - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - // we only decorate parameters of the set accessor - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - // we only decorate the parameters here if this is a method - if (member.kind === 141 /* MethodDeclaration */) { - functionLikeMember = member; - } - } - // Emit the call to __decorate. Given the following: - // - // class C { - // @dec method(@dec2 x) {} - // @dec get accessor() {} - // @dec prop; - // } - // - // The emit for a method is: - // - // Object.defineProperty(C.prototype, "method", - // __decorate([ - // dec, - // __param(0, dec2), - // __metadata("design:type", Function), - // __metadata("design:paramtypes", [Object]), - // __metadata("design:returntype", void 0) - // ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); - // - // The emit for an accessor is: - // - // Object.defineProperty(C.prototype, "accessor", - // __decorate([ - // dec - // ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); - // - // The emit for a property is: - // - // __decorate([ - // dec - // ], C.prototype, "prop"); - // - writeLine(); - emitStart(member); - if (member.kind !== 139 /* PropertyDeclaration */) { - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(","); - increaseIndent(); - writeLine(); - } - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - if (member.kind !== 139 /* PropertyDeclaration */) { - write(", Object.getOwnPropertyDescriptor("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write("))"); - decreaseIndent(); - } - write(");"); - emitEnd(member); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); - emit(decorator.expression); - write(")"); - emitEnd(decorator); - }); - leadingComma = true; - } - ++parameterIndex; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - // This method determines whether to emit the "design:type" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 141 /* MethodDeclaration */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 139 /* PropertyDeclaration */: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - // This method determines whether to emit the "design:returntype" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 141 /* MethodDeclaration */: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 212 /* ClassDeclaration */: - case 141 /* MethodDeclaration */: - case 144 /* SetAccessor */: - return true; - } - return false; - } - /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ - function emitSerializedTypeOfNode(node) { - // serialization of the type of a declaration uses the following rules: - // - // * The serialized type of a ClassDeclaration is "Function" - // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. - // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. - // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. - // * The serialized type of any other FunctionLikeDeclaration is "Function". - // * The serialized type of any other node is "void 0". - // - // For rules on serializing type annotations, see `serializeTypeNode`. - switch (node.kind) { - case 212 /* ClassDeclaration */: - write("Function"); - return; - case 139 /* PropertyDeclaration */: - emitSerializedTypeNode(node.type); - return; - case 136 /* Parameter */: - emitSerializedTypeNode(node.type); - return; - case 143 /* GetAccessor */: - emitSerializedTypeNode(node.type); - return; - case 144 /* SetAccessor */: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 101 /* VoidKeyword */: - write("void 0"); - return; - case 158 /* ParenthesizedType */: - emitSerializedTypeNode(node.type); - return; - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - write("Function"); - return; - case 154 /* ArrayType */: - case 155 /* TupleType */: - write("Array"); - return; - case 148 /* TypePredicate */: - case 118 /* BooleanKeyword */: - write("Boolean"); - return; - case 128 /* StringKeyword */: - case 9 /* StringLiteral */: - write("String"); - return; - case 126 /* NumberKeyword */: - write("Number"); - return; - case 129 /* SymbolKeyword */: - write("Symbol"); - return; - case 149 /* TypeReference */: - emitSerializedTypeReferenceNode(node); - return; - case 152 /* TypeQuery */: - case 153 /* TypeLiteral */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 115 /* AnyKeyword */: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - // Clone the type name and parent it to a location outside of the current declaration. - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0 /* Auto */); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, /*useFallback*/ true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, /*useFallback*/ false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2 /* ES6 */) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ - function emitSerializedParameterTypesOfNode(node) { - // serialization of parameter types uses the following rules: - // - // * If the declaration is a class, the parameters of the first constructor with a body are used. - // * If the declaration is function-like and has a body, the parameters of the function are used. - // - // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. - if (node) { - var valueDeclaration; - if (node.kind === 212 /* ClassDeclaration */) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; - if (parameterCount > 0) { - for (var i = 0; i < parameterCount; i++) { - if (i > 0) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType.kind === 154 /* ArrayType */) { - parameterType = parameterType.elementType; - } - else if (parameterType.kind === 149 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - /** Serializes the return type of function. Used by the __metadata decorator for a method. */ - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node) && node.type) { - emitSerializedTypeNode(node.type); - return; - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - // This method emits the serialized type metadata for a decorator target. - // The caller should have already tested whether the node has decorators. - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitCommentsOnNotEmittedNode(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - // const enums are completely erased during compilation. - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - scopeEmitStart(node); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { - // write the call to exporter for enum - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); - } - function emitModuleDeclaration(node) { - // Emit only if this module is non-ambient. - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitCommentsOnNotEmittedNode(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - if (node.body.kind === 217 /* ModuleBlock */) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - scopeEmitStart(node); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); - scopeEmitEnd(); - } - write(")("); - // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 67 /* Identifier */ && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - /* - * Some bundlers (SystemJS builder) sometimes want to rename dependencies. - * Here we check if alternative name was provided for a given moduleName and return it if possible. - */ - function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9 /* StringLiteral */) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18 /* CloseParenToken */, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 219 /* ImportEqualsDeclaration */) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222 /* NamespaceImport */) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 220 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - return emitExternalImportDeclaration(node); - } - // ES6 import - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 219 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (compilerOptions.module !== 2 /* AMD */) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - // import x = require("foo") - // import * as x from "foo" - if (!isExportedImport) - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - // import "foo" - // import x from "foo" - // import { x, y } from "foo" - // import d, * as x from "foo" - // import d, { x, y } from "foo" - var isNakedImport = 220 /* ImportDeclaration */ && !node.importClause; - if (!isNakedImport) { - write("var "); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when - // - current file is not external module - // - import declaration is top level and target is value imported by entity name - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - // variable declaration for import-equals declaration can be hoisted in system modules - // in this case 'var' should be omitted and emit should contain only initialization - var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); - // is it top level export import v = a.b.c in system module? - // if yes - it needs to be rewritten as exporter('v', v = a.b.c) - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1 /* Export */)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(compilerOptions.module !== 4 /* System */); - if (languageVersion < 2 /* ES6 */) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - // export { x, y, ... } from "foo" - if (compilerOptions.module !== 2 /* AMD */) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - // export * from "foo" - writeLine(); - write("__export("); - if (compilerOptions.module !== 2 /* AMD */) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - // export { x, y, ... } - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(languageVersion >= 2 /* ES6 */); - var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= 2 /* ES6 */) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 211 /* FunctionDeclaration */ && - expression.kind !== 212 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4 /* System */) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = {}; - exportEquals = undefined; - hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 220 /* ImportDeclaration */: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { - // import "mod" - // import x from "mod" where x is referenced - // import * as x from "mod" where x is referenced - // import { x, y } from "mod" where at least one import is referenced - externalImports.push(node); - } - break; - case 219 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 230 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { - // import x = require("mod") where x is referenced - externalImports.push(node); - } - break; - case 226 /* ExportDeclaration */: - if (node.moduleSpecifier) { - if (!node.exportClause) { - // export * from "mod" - externalImports.push(node); - hasExportStars = true; - } - else if (resolver.isValueAliasDeclaration(node)) { - // export { x, y } from "mod" where at least one export is a value symbol - externalImports.push(node); - } - } - else { - // export { x, y } - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_24 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_24] || (exportSpecifiers[name_24] = [])).push(specifier); - } - } - break; - case 225 /* ExportAssignment */: - if (node.isExportEquals && !exportEquals) { - // export = x - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStars) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - if (node.kind === 220 /* ImportDeclaration */ && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 226 /* ExportDeclaration */ && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9 /* StringLiteral */) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; - // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 226 /* ExportDeclaration */ || - (importNode.kind === 220 /* ImportDeclaration */ && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - // when resolving exports local exported entries/indirect exported entries in the module - // should always win over entries with similar names that were added via star exports - // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - if (!hasExportStars) { - // local names set is needed only in presence of star exports - return undefined; - } - // local names set should only be added if we have anything exported - if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { - // no exported declarations (export var ...) or export specifiers (export {x}) - // check if we have any non star export declarations. - var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; - if (externalImport.kind === 226 /* ExportDeclaration */ && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - // we still need to emit exportStar helper - return emitExportStarFunction(/*localNames*/ undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { - // write name of exported declaration, i.e 'export var x...' - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - // write name of export specified, i.e. 'export {x}' - writeExportedName(specifier.name); - } - } - } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; - if (externalImport.kind !== 226 /* ExportDeclaration */) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - // export * from ... - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - // write name of indirectly exported entry, i.e. 'export {x} from ...' - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - // define an export star helper function - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - // do not record default exports - // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 67 /* Identifier */ && node.flags & 1024 /* Default */) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 67 /* Identifier */) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - // per ES6 spec: - // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method - // - var declarations are initialized to undefined - 14.a.ii - // - function/generator declarations are instantiated - 16.a.iv - // this means that after module is instantiated but before its evaluation - // exported functions are already accessible at import sites - // in theory we should hoist only exported functions and its dependencies - // in practice to simplify things we'll hoist all source level functions and variable declaration - // including variables declarations for module and class declarations - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { - var local = hoistedVars[i]; - var name_25 = local.kind === 67 /* Identifier */ - ? local - : local.name; - if (name_25) { - // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_25.text); - if (ts.hasProperty(seen, text)) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 212 /* ClassDeclaration */ || local.kind === 216 /* ModuleDeclaration */ || local.kind === 215 /* EnumDeclaration */) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 67 /* Identifier */ ? local.parent : local); - if (flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; - writeLine(); - emit(f); - if (f.flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2 /* Ambient */) { - return; - } - if (node.kind === 211 /* FunctionDeclaration */) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 212 /* ClassDeclaration */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 215 /* EnumDeclaration */) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 216 /* ModuleDeclaration */) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { - if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_26 = node.name; - if (name_26.kind === 67 /* Identifier */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_26); - } - else { - ts.forEachChild(name_26, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - // hoist variable if - // - it is not block scoped - // - it is top level block scoped - // if block scoped variables are nested in some another block then - // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 246 /* SourceFile */; - } - function isCurrentFileSystemExternalModule() { - return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - // shape of the body in system modules: - // function (exports) { - // - // - // - // return { - // setters: [ - // - // ], - // execute: function() { - // - // } - // } - // - // } - // I.e: - // import {x} from 'file1' - // var y = 1; - // export function foo() { return y + x(); } - // console.log(y); - // will be transformed to - // function(exports) { - // var file1; // local alias - // var y; - // function foo() { return y + file1.x(); } - // exports("foo", foo); - // return { - // setters: [ - // function(v) { file1 = v } - // ], - // execute(): function() { - // y = 1; - // console.log(y); - // } - // }; - // } - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); // return - emitTempDeclarations(/*newLine*/ true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - // derive a unique name for parameter from the first named entry in the group - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 220 /* ImportDeclaration */: - if (!entry.importClause) { - // 'import "..."' case - // module is imported only for side-effects, no emit required - break; - } - // fall-through - case 219 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - // save import into the local - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 226 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - // export {a, b as c} from 'foo' - // emit as: - // exports_({ - // "a": _["a"], - // "c": _["b"] - // }); - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_2]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - writeLine(); - // export * from 'foo' - // emit as: - // exportStar(_foo); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { - var statement = node.statements[i]; - switch (statement.kind) { - // - function declarations are not emitted because they were already hoisted - // - import declarations are not emitted since they are already handled in setters - // - export declarations with module specifiers are not emitted since they were already written in setters - // - export declarations without module specifiers are emitted preserving the order - case 211 /* FunctionDeclaration */: - case 220 /* ImportDeclaration */: - continue; - case 226 /* ExportDeclaration */: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - // write call to exporter function for every export specifier in exports list - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 219 /* ImportEqualsDeclaration */: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - // - import equals declarations that import external modules are not emitted - continue; - } - // fall-though for import declarations that import internal modules - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); // execute - } - function emitSystemModule(node, startIndex) { - collectExternalModuleInfo(node); - // System modules has the following shape - // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) - // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. - // 'exports' returns its 'value' argument so in most cases expressions - // that mutate exported values can be rewritten as: - // expr -> exports('name', expr). - // The only exception in this rule is postfix unary operators, - // see comment to 'emitPostfixUnaryExpression' for more details - ts.Debug.assert(!exportFunctionForFile); - // make sure that name of 'exports' function does not conflict with existing identifiers - exportFunctionForFile = makeUniqueName("exports"); - writeLine(); - write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - write("["); - var groupIndices = {}; - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ") {"); - writeLine(); - increaseIndent(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitAMDDependencies(node, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list - // names of modules with corresponding parameter in the factory function - var aliasedModuleNames = []; - // names of modules with no corresponding parameters in factory function - var unaliasedModuleNames = []; - var importAliasNames = []; // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding - // module names in aliasedModuleNames. - // Fill in amd-dependency tags - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); - } - } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; - // Find the name of the external module - var externalModuleName = getExternalModuleNameText(importNode); - // Find the name of the module alias, if there is one - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - write("[\"require\", \"exports\""); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } - write("], function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - } - function emitAMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ false); - } - function emitUMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - // Module is detected first to support Browserify users that load into a browser with an AMD loader - writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); - emitAMDDependencies(node, false); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - emitExportEquals(/*emitAsReturn*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node, startIndex) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - // Emit exportDefault if it exists will happen as part - // or normal statement emit. - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); - } - } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - jsxEmitReact(node); - break; - case 1 /* Preserve */: - // Fall back to preserve if None was specified (we'll error earlier) - default: - jsxEmitPreserve(node); - break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpace(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - if (result) { - // Replace entities like   - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); - } - else { - return s; - } - }); - } - return result; - } - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1 /* Preserve */: - default: - return ts.getTextOfNode(node, /*includeTrivia*/ true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - write("\""); - write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); - break; - case 1 /* Preserve */: - default: - writer.writeLiteral(ts.getTextOfNode(node, /*includeTrivia*/ true)); - break; - } - } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1 /* Preserve */: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2 /* React */: - emit(node.expression); - break; - } - } - } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - // return index of the first non prologue directive - return i; - } - } - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - // Only emit helpers if the user did not say otherwise. - if (!compilerOptions.noEmitHelpers) { - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - // Start new file on new line - writeLine(); - emitShebang(); - emitDetachedComments(node); - // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= 2 /* ES6 */) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === 2 /* AMD */) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === 4 /* System */) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === 3 /* UMD */) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } - } - else { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - } - emitLeadingComments(node.endOfFileToken); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2 /* Ambient */) { - return emitCommentsOnNotEmittedNode(node); - } - if (isSpecializedCommentHandling(node)) { - // This is the node that will handle its own comments and sourcemap - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - // All of these entities are emitted in a specialized fashion. As such, we allow - // the specialized methods for each to handle the comments on the nodes. - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 225 /* ExportAssignment */: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 191 /* VariableStatement */: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 216 /* ModuleDeclaration */: - // Only emit the leading/trailing comments for a module if we're actually - // emitting the module as well. - return shouldEmitModuleDeclaration(node); - case 215 /* EnumDeclaration */: - // Only emit the leading/trailing comments for an enum if we're actually - // emitting the module as well. - return shouldEmitEnumDeclaration(node); - } - // If the node is emitted in specialized fashion, dont emit comments as this node will handle - // emitting comments when emitting itself - ts.Debug.assert(!isSpecializedCommentHandling(node)); - // If this is the expression body of an arrow function that we're down-leveling, - // then we don't want to emit comments when we emit the body. It will have already - // been taken care of when we emitted the 'return' statement for the function - // expression body. - if (node.kind !== 190 /* Block */ && - node.parent && - node.parent.kind === 172 /* ArrowFunction */ && - node.parent.body === node && - compilerOptions.target <= 1 /* ES5 */) { - return false; - } - // Emit comments for everything else. - return true; - } - function emitJavaScriptWorker(node) { - // Check if the node can be emitted regardless of the ScriptTarget - switch (node.kind) { - case 67 /* Identifier */: - return emitIdentifier(node); - case 136 /* Parameter */: - return emitParameter(node); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - return emitMethod(node); - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - return emitAccessor(node); - case 95 /* ThisKeyword */: - return emitThis(node); - case 93 /* SuperKeyword */: - return emitSuper(node); - case 91 /* NullKeyword */: - return write("null"); - case 97 /* TrueKeyword */: - return write("true"); - case 82 /* FalseKeyword */: - return write("false"); - case 8 /* NumericLiteral */: - case 9 /* StringLiteral */: - case 10 /* RegularExpressionLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 12 /* TemplateHead */: - case 13 /* TemplateMiddle */: - case 14 /* TemplateTail */: - return emitLiteral(node); - case 181 /* TemplateExpression */: - return emitTemplateExpression(node); - case 188 /* TemplateSpan */: - return emitTemplateSpan(node); - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - return emitJsxElement(node); - case 234 /* JsxText */: - return emitJsxText(node); - case 238 /* JsxExpression */: - return emitJsxExpression(node); - case 133 /* QualifiedName */: - return emitQualifiedName(node); - case 159 /* ObjectBindingPattern */: - return emitObjectBindingPattern(node); - case 160 /* ArrayBindingPattern */: - return emitArrayBindingPattern(node); - case 161 /* BindingElement */: - return emitBindingElement(node); - case 162 /* ArrayLiteralExpression */: - return emitArrayLiteral(node); - case 163 /* ObjectLiteralExpression */: - return emitObjectLiteral(node); - case 243 /* PropertyAssignment */: - return emitPropertyAssignment(node); - case 244 /* ShorthandPropertyAssignment */: - return emitShorthandPropertyAssignment(node); - case 134 /* ComputedPropertyName */: - return emitComputedPropertyName(node); - case 164 /* PropertyAccessExpression */: - return emitPropertyAccess(node); - case 165 /* ElementAccessExpression */: - return emitIndexedAccess(node); - case 166 /* CallExpression */: - return emitCallExpression(node); - case 167 /* NewExpression */: - return emitNewExpression(node); - case 168 /* TaggedTemplateExpression */: - return emitTaggedTemplateExpression(node); - case 169 /* TypeAssertionExpression */: - return emit(node.expression); - case 187 /* AsExpression */: - return emit(node.expression); - case 170 /* ParenthesizedExpression */: - return emitParenExpression(node); - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - return emitFunctionDeclaration(node); - case 173 /* DeleteExpression */: - return emitDeleteExpression(node); - case 174 /* TypeOfExpression */: - return emitTypeOfExpression(node); - case 175 /* VoidExpression */: - return emitVoidExpression(node); - case 176 /* AwaitExpression */: - return emitAwaitExpression(node); - case 177 /* PrefixUnaryExpression */: - return emitPrefixUnaryExpression(node); - case 178 /* PostfixUnaryExpression */: - return emitPostfixUnaryExpression(node); - case 179 /* BinaryExpression */: - return emitBinaryExpression(node); - case 180 /* ConditionalExpression */: - return emitConditionalExpression(node); - case 183 /* SpreadElementExpression */: - return emitSpreadElementExpression(node); - case 182 /* YieldExpression */: - return emitYieldExpression(node); - case 185 /* OmittedExpression */: - return; - case 190 /* Block */: - case 217 /* ModuleBlock */: - return emitBlock(node); - case 191 /* VariableStatement */: - return emitVariableStatement(node); - case 192 /* EmptyStatement */: - return write(";"); - case 193 /* ExpressionStatement */: - return emitExpressionStatement(node); - case 194 /* IfStatement */: - return emitIfStatement(node); - case 195 /* DoStatement */: - return emitDoStatement(node); - case 196 /* WhileStatement */: - return emitWhileStatement(node); - case 197 /* ForStatement */: - return emitForStatement(node); - case 199 /* ForOfStatement */: - case 198 /* ForInStatement */: - return emitForInOrForOfStatement(node); - case 200 /* ContinueStatement */: - case 201 /* BreakStatement */: - return emitBreakOrContinueStatement(node); - case 202 /* ReturnStatement */: - return emitReturnStatement(node); - case 203 /* WithStatement */: - return emitWithStatement(node); - case 204 /* SwitchStatement */: - return emitSwitchStatement(node); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: - return emitCaseOrDefaultClause(node); - case 205 /* LabeledStatement */: - return emitLabelledStatement(node); - case 206 /* ThrowStatement */: - return emitThrowStatement(node); - case 207 /* TryStatement */: - return emitTryStatement(node); - case 242 /* CatchClause */: - return emitCatchClause(node); - case 208 /* DebuggerStatement */: - return emitDebuggerStatement(node); - case 209 /* VariableDeclaration */: - return emitVariableDeclaration(node); - case 184 /* ClassExpression */: - return emitClassExpression(node); - case 212 /* ClassDeclaration */: - return emitClassDeclaration(node); - case 213 /* InterfaceDeclaration */: - return emitInterfaceDeclaration(node); - case 215 /* EnumDeclaration */: - return emitEnumDeclaration(node); - case 245 /* EnumMember */: - return emitEnumMember(node); - case 216 /* ModuleDeclaration */: - return emitModuleDeclaration(node); - case 220 /* ImportDeclaration */: - return emitImportDeclaration(node); - case 219 /* ImportEqualsDeclaration */: - return emitImportEqualsDeclaration(node); - case 226 /* ExportDeclaration */: - return emitExportDeclaration(node); - case 225 /* ExportAssignment */: - return emitExportAssignment(node); - case 246 /* SourceFile */: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } - /** - * Determine if the given comment is a triple-slash - * - * @return true if the comment is a triple-slash comment else false - **/ - function isTripleSlashComment(comment) { - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text - // so that we don't end up computing comment string and doing match for all // comments - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; - } - function getLeadingCommentsToEmit(node) { - // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 246 /* SourceFile */ || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - // get comments without detached comments - return getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - } - } - } - function getTrailingCommentsToEmit(node) { - // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 246 /* SourceFile */ || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - } - } - } - /** - * Emit comments associated with node that will not be emitted into JS file - */ - function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); - } - function emitLeadingCommentsWorker(node, isEmittedNode) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (isEmittedNode) { - leadingComments = getLeadingCommentsToEmit(node); - } - else { - // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, - // unless it is a triple slash comment at the top of the file. - // For Example: - // /// - // declare var x; - // /// - // interface F {} - // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted - if (node.pos === 0) { - leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); - } - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); - } - function emitTrailingComments(node) { - if (compilerOptions.removeComments) { - return; - } - // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = getTrailingCommentsToEmit(node); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); - } - /** - * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: - * x, /comment1/ y - * ^ => pos; the function will emit "comment1" in the emitJS - */ - function emitTrailingCommentsOfPosition(pos) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitLeadingCommentsOfPositionWorker(pos) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (hasDetachedComments(pos)) { - // get comments without detached comments - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); - } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - // removeComments is true, only reserve pinned comment at the top of file - // For example: - // /*! Pinned Comment */ - // - // var x = 10; - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); - } - } - else { - // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - // Valid detachedComments - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - } - } - function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); - if (shebang) { - write(shebang); - } - } - } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); - } - } - } - ts.emitFiles = emitFiles; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -35261,6 +29422,6531 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }; + // Flags enum to track count of temp variables and a few dedicated names + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature + function emitFiles(resolver, host, targetSourceFile) { + // emit output for the __extends helper function + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + // emit output for the __decorate helper function + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + // emit output for the __metadata helper function + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + // emit output for the __param helper function + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; + var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + else { + // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) + if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + // Sort and make the unique list of diagnostics + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + // We conservatively include alias symbols to cover cases where they're emitted as locals + if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + return false; + } + } + } + return true; + } + function emitJavaScript(jsFilePath, root) { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + // name of an exporter function if file is a System external module + // System.register([...], function () {...}) + // exporting in System modules looks like: + // export var x; ... x = 1 + // => + // var x;... exporter("x", x = 1) + var exportFunctionForFile; + var generatedNameSet = {}; + var nodeToGeneratedName = []; + var computedPropertyNamesToGeneratedNames; + var extendsEmitted = false; + var decorateEmitted = false; + var paramEmitted = false; + var awaiterEmitted = false; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStars; + /** Write emitted output to disk */ + var writeEmittedFiles = writeJavaScriptFile; + var detachedCommentsInfo; + var writeComment = ts.writeCommentRange; + /** Emit a node */ + var emit = emitNodeWithCommentsAndWithoutSourcemap; + /** Called just before starting emit of a node */ + var emitStart = function (node) { }; + /** Called once the emit of the node is done */ + var emitEnd = function (node) { }; + /** Emit the text for the given token that comes after startPos + * This by default writes the text provided with the given tokenKind + * but if optional emitFn callback is provided the text is emitted using the callback instead of default text + * @param tokenKind the kind of the token to search and emit + * @param startPos the position in the source to start searching for the token + * @param emitFn if given will be invoked to emit the text instead of actual token emit */ + var emitToken = emitTokenText; + /** Called to before starting the lexical scopes as in function/class in the emitted code because of node + * @param scopeDeclaration node that starts the lexical scope + * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + /** Called after coming out of the scope */ + var scopeEmitEnd = function () { }; + /** Sourcemap data that will get encoded */ + var sourceMapData; + /** If removeComments is true, no leading-comments needed to be emitted **/ + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var moduleEmitDelegates = (_a = {}, + _a[5 /* ES6 */] = emitES6Module, + _a[2 /* AMD */] = emitAMDModule, + _a[4 /* System */] = emitSystemModule, + _a[3 /* UMD */] = emitUMDModule, + _a[1 /* CommonJS */] = emitCommonJSModule, + _a + ); + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); + return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + emit(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + // Return the next available name in the pattern _a ... _z, _0, _1, ... + // TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. + // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_19)) { + tempFlags |= flags; + return name_19; + } + } + while (true) { + var count = tempFlags & 268435455 /* CountMask */; + tempFlags++; + // Skip over 'i' and 'n' + if (count !== 8 && count !== 13) { + var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_20)) { + return name_20; + } + } + } + } + // Generate a name that is unique within the current file and doesn't conflict with any names + // in global scope. The name is formed by adding an '_n' suffix to the specified base name, + // where n is a positive integer. Note that names generated by makeTempVariableName and + // makeUniqueName are guaranteed to never conflict. + function makeUniqueName(baseName) { + // Find the first unique 'name_n', where n is a positive number + if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + // Use module/enum name itself if it is unique, otherwise make a unique variation + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 /* StringLiteral */ ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69 /* Identifier */: + return makeUniqueName(node.text); + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + return generateNameForModuleOrEnum(node); + case 222 /* ImportDeclaration */: + case 228 /* ExportDeclaration */: + return generateNameForImportOrExportDeclaration(node); + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + case 227 /* ExportAssignment */: + return generateNameForExportDefault(); + case 186 /* ClassExpression */: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function initializeEmitterWithSourceMaps() { + var sourceMapDir; // The directory in which sourcemap will be + // Current source map file and its index in the sources list + var sourceMapSourceIndex = -1; + // Names and its index map + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + } + // Last recorded and encoded spans + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + // Encoding for sourcemap span + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Line/Comma delimiters + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + // Emit comma to separate the entry + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + // Emit line delimiters + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + // 1. Relative Column 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + // 3. Relative sourceLine 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + // 4. Relative sourceColumn 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + // 5. Relative namePosition 0 based + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + // Add a new least significant bit that has the sign of the value. + // if negative number the least significant bit that gets added to the number has value 1 + // else least significant bit value that gets added is 0 + // eg. -1 changes to binary : 01 [1] => 3 + // +1 changes to binary : 01 [0] => 2 + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + // Encode 5 bits at a time starting from least significant bits + var encodedStr = ""; + do { + var currentDigit = inValue & 31; // 11111 + inValue = inValue >> 5; + if (inValue > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + // If this location wasn't recorded or the location in source is going backwards, record the span + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + // Encode the last recordedSpan before assigning new + encodeLastRecordedSourceMapSpan(); + // New span + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + // Take the new pos instead since there is no change in emittedLine and column since last location + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + // Get the token pos after skipping to the token (ignoring the leading trivia) + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + // Add the file to tsFilePaths + // If sourceroot option: Use the relative path corresponding to the common directory path + // otherwise source locations relative to map file location + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + // The one that can be used from program to get the actual source file + sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + // Child scopes are always shown with a dot (even if they have no name), + // unless it is a computed property. Then it is shown with brackets, + // but the brackets are included in the name. + var name_21 = node.name; + if (!name_21 || name_21.kind !== 136 /* ComputedPropertyName */) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + // The scope was already given a name use it + recordScopeNameStart(scopeName); + } + else if (node.kind === 213 /* FunctionDeclaration */ || + node.kind === 173 /* FunctionExpression */ || + node.kind === 143 /* MethodDeclaration */ || + node.kind === 142 /* MethodSignature */ || + node.kind === 145 /* GetAccessor */ || + node.kind === 146 /* SetAccessor */ || + node.kind === 218 /* ModuleDeclaration */ || + node.kind === 214 /* ClassDeclaration */ || + node.kind === 217 /* EnumDeclaration */) { + // Declaration and has associated name use it + if (node.name) { + var name_22 = node.name; + // For computed property names, the text will include the brackets + scopeName = name_22.kind === 136 /* ComputedPropertyName */ + ? ts.getTextOfNode(name_22) + : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + // Block just use the name from upper level scope + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { + if (typeof JSON !== "undefined") { + var map_1 = { + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); + sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + // Write source map file + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + // Write sourcemap url to the js file and write the js file + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + } + // Initialize source map data + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: undefined, + sourceMapDecodedMappings: [] + }; + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // relative paths of the sources list in the sourcemap + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + // For modules or multiple emit files the mapRoot will have directory structure like the sources + // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + // The relative paths are relative to the common directory + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithSourceMap(node) { + if (node) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind !== 248 /* SourceFile */) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMap(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNodeWithoutSourceMap(node); + } + } + } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithCommentsAndWithSourcemap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + // Create a temporary variable with a unique unused name. + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69 /* Identifier */); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + // This emitting is to make sure we emit following comment properly + // ...(x, /*comment1*/ y)... + // ^ => node.pos + // "comment1" is not considered leading comment for "y" but rather + // considered as trailing comment of the previous node. + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, /*startIndex*/ 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98 /* b */: + case 66 /* B */: + case 111 /* o */: + case 79 /* O */: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + // Any template literal or string literal with an extended escape + // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. + if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText("\"", node.text, "\""); + } + // If we don't need to downlevel and we can reach the original source text using + // the node's parent reference, then simply get the text as it was originally written. + if (node.parent) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + // If we can't reach the original source text, use the canonical form if it's a number, + // or an escaped quoted form of the original text if it's string-like. + switch (node.kind) { + case 9 /* StringLiteral */: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11 /* NoSubstitutionTemplateLiteral */: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12 /* TemplateHead */: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13 /* TemplateMiddle */: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14 /* TemplateTail */: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8 /* NumericLiteral */: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + // Find original source text, since we need to emit the raw strings of the tagged template. + // The raw strings contain the (escaped) strings of what the user wrote. + // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // thus we need to remove those characters. + // First template piece starts with "`", others with "}" + // Last template piece ends with "`", others with "${" + var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + // Newline normalization: + // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's + // and LineTerminatorSequences are normalized to for both TV and TRV. + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0 /* Auto */); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + // Now we emit the expressions + if (node.template.kind === 183 /* TemplateExpression */) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 181 /* BinaryExpression */ + && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + // In ES6 mode and above, we can simply emit each portion of a template in order, but in + // ES3 & ES5 we must convert the template expression into a series of string concatenations. + if (languageVersion >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + // Check if the expression has operands and binds its operands less closely than binary '+'. + // If it does, we need to wrap the expression in parentheses. Otherwise, something like + // `abc${ 1 << 2 }` + // becomes + // "abc" + 1 << 2 + "" + // which is really + // ("abc" + 1) << (2 + "") + // rather than + // "abc" + (1 << 2) + "" + var needsParens = templateSpan.expression.kind !== 172 /* ParenthesizedExpression */ + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + if (i > 0 || headEmitted) { + // If this is the first span and the head was not emitted, then this templateSpan's + // expression will be the first to be emitted. Don't emit the preceding ' + ' in that + // case. + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + // Only emit if the literal is non-empty. + // The binary '+' operator is left-associative, so the first string concatenation + // with the head will force the result up to this point to be a string. + // Emitting a '+ ""' has no semantic effect for middles and tails. + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + // If this expression has an empty head literal and the first template span has a non-empty + // literal, then emitting the empty head literal is not necessary. + // `${ foo } and ${ bar }` + // can be emitted as + // foo + " and " + bar + // This is because it is only required that one of the first two operands in the emit + // output must be a string literal, so that the other operand and all following operands + // are forced into strings. + // + // If the first template span has an empty literal, then the head must still be emitted. + // `${ foo }${ bar }` + // must still be emitted as + // "" + foo + bar + // There is always atleast one templateSpan in this code path, since + // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 168 /* CallExpression */: + case 169 /* NewExpression */: + return parent.expression === template; + case 170 /* TaggedTemplateExpression */: + case 172 /* ParenthesizedExpression */: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; + } + } + /** + * Returns whether the expression has lesser, greater, + * or equal precedence to the binary '+' operator + */ + function comparePrecedenceToBinaryPlus(expression) { + // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' + // which have greater precedence and '-' which has equal precedence. + // All unary operators have a higher precedence apart from yield. + // Arrow functions and conditionals have a lower precedence, + // although we convert the former into regular function expressions in ES5 mode, + // and in ES6 mode this function won't get called anyway. + // + // TODO (drosen): Note that we need to account for the upcoming 'yield' and + // spread ('...') unary operators that are anticipated for ES6. + switch (expression.kind) { + case 181 /* BinaryExpression */: + switch (expression.operatorToken.kind) { + case 37 /* AsteriskToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: + return 1 /* GreaterThan */; + case 35 /* PlusToken */: + case 36 /* MinusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 184 /* YieldExpression */: + case 182 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + /// Emit a tag name, which is either '"div"' for lower-cased names, or + /// 'Div' for upper-cased or dotted names + function emitTagName(name) { + if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + /// Emit an attribute name, which is quoted if it needs to be quoted. Because + /// these emit into an object literal property name, we don't need to be worried + /// about keywords, just non-identifier characters + function emitAttributeName(name) { + if (/[A-Za-z_]+[\w*]/.test(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + /// Emit an name/value pair for an attribute (e.g. "x: 3") + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69 /* Identifier */); + syntheticReactRef.text = "React"; + syntheticReactRef.parent = openingNode; + // Call React.createElement(tag, ... + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + // Attribute list + if (openingNode.attributes.length === 0) { + // When there are no attributes, React wants "null" + write("null"); + } + else { + // Either emit one big object literal (no spread attribs), or + // a call to React.__spread + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 239 /* JsxSpreadAttribute */; })) { + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); + var haveOpenedObjectLiteral = false; + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 239 /* JsxSpreadAttribute */) { + // If this is the first argument, we need to emit a {} as the first argument + if (i_1 === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i_1 > 0) { + write(", "); + } + emit(attrs[i_1].expression); + } + else { + ts.Debug.assert(attrs[i_1].kind === 238 /* JsxAttribute */); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i_1 > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i_1]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); // closing paren to React.__spread( + } + else { + // One object literal with all the attributes in them + write("{"); + for (var i = 0; i < attrs.length; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + // Children + if (children) { + for (var i = 0; i < children.length; i++) { + // Don't emit empty expressions + if (children[i].kind === 240 /* JsxExpression */ && !(children[i].expression)) { + continue; + } + // Don't emit empty strings + if (children[i].kind === 236 /* JsxText */) { + var text = getTextToEmit(children[i]); + if (text !== undefined) { + write(", \""); + write(text); + write("\""); + } + } + else { + write(", "); + emit(children[i]); + } + } + } + // Closing paren + write(")"); // closes "React.createElement(" + emitTrailingComments(openingNode); + } + if (node.kind === 233 /* JsxElement */) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 239 /* JsxSpreadAttribute */) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 238 /* JsxAttribute */); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 234 /* JsxSelfClosingElement */)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 234 /* JsxSelfClosingElement */) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 233 /* JsxElement */) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + emitJsxOpeningOrSelfClosingElement(node); + } + } + // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. + // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. + // For example, this is utilized when feeding in a result to Object.defineProperty. + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 163 /* BindingElement */); + if (node.kind === 9 /* StringLiteral */) { + emitLiteral(node); + } + else if (node.kind === 136 /* ComputedPropertyName */) { + // if this is a decorated computed property, we will need to capture the result + // of the property expression so that we can apply decorators later. This is to ensure + // we don't introduce unintended side effects: + // + // class C { + // [_a = x]() { } + // } + // + // The emit for the decorated computed property decorator is: + // + // __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)); + // + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + // we have already generated a variable for this node, write that value instead. + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0 /* Auto */).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write("\""); + if (node.kind === 8 /* NumericLiteral */) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 164 /* ArrayLiteralExpression */: + case 189 /* AsExpression */: + case 181 /* BinaryExpression */: + case 168 /* CallExpression */: + case 241 /* CaseClause */: + case 136 /* ComputedPropertyName */: + case 182 /* ConditionalExpression */: + case 139 /* Decorator */: + case 175 /* DeleteExpression */: + case 197 /* DoStatement */: + case 167 /* ElementAccessExpression */: + case 227 /* ExportAssignment */: + case 195 /* ExpressionStatement */: + case 188 /* ExpressionWithTypeArguments */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 196 /* IfStatement */: + case 234 /* JsxSelfClosingElement */: + case 235 /* JsxOpeningElement */: + case 239 /* JsxSpreadAttribute */: + case 240 /* JsxExpression */: + case 169 /* NewExpression */: + case 172 /* ParenthesizedExpression */: + case 180 /* PostfixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: + case 204 /* ReturnStatement */: + case 246 /* ShorthandPropertyAssignment */: + case 185 /* SpreadElementExpression */: + case 206 /* SwitchStatement */: + case 170 /* TaggedTemplateExpression */: + case 190 /* TemplateSpan */: + case 208 /* ThrowStatement */: + case 171 /* TypeAssertionExpression */: + case 176 /* TypeOfExpression */: + case 177 /* VoidExpression */: + case 198 /* WhileStatement */: + case 205 /* WithStatement */: + case 184 /* YieldExpression */: + return true; + case 163 /* BindingElement */: + case 247 /* EnumMember */: + case 138 /* Parameter */: + case 245 /* PropertyAssignment */: + case 141 /* PropertyDeclaration */: + case 211 /* VariableDeclaration */: + return parent.initializer === node; + case 166 /* PropertyAccessExpression */: + return parent.expression === node; + case 174 /* ArrowFunction */: + case 173 /* FunctionExpression */: + return parent.body === node; + case 221 /* ImportEqualsDeclaration */: + return parent.moduleReference === node; + case 135 /* QualifiedName */: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { + write("_arguments"); + return; + } + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 248 /* SourceFile */) { + // Identifier references module export + if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + write("exports."); + } + } + else { + // Identifier references namespace export + write(getGeneratedNameForNode(container)); + write("."); + } + } + else if (modulekind !== 5 /* ES6 */) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 223 /* ImportClause */) { + // Identifier references default import + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + return; + } + else if (declaration.kind === 226 /* ImportSpecifier */) { + // Identifier references named import + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_23 = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + if (languageVersion === 0 /* ES3 */ && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } + return; + } + } + declaration = resolver.getReferencedNestedRedeclaration(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function isNameOfNestedRedeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + var parent_6 = node.parent; + switch (parent_6.kind) { + case 163 /* BindingElement */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 211 /* VariableDeclaration */: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + } + } + return false; + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedRedeclaration(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2 /* ES6 */) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256 /* SuperInstance */) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114 /* YieldKeyword */)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114 /* YieldKeyword */)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 181 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 182 /* ConditionalExpression */ && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 164 /* ArrayLiteralExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 172 /* ParenthesizedExpression */: + // This list is not exhaustive and only includes those cases that are relevant + // to the check in emitArrayLiteral. More cases can be added as needed. + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + // Emit using the pattern .concat(, , ...) + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 185 /* SpreadElementExpression */) { + e = e.expression; + emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164 /* ArrayLiteralExpression */) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 185 /* SpreadElementExpression */) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 185 /* SpreadElementExpression */; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); + write("]"); + } + else { + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + // If we are not doing a downlevel transformation for object literals, + // then try to preserve the original shape of the object literal. + // Otherwise just try to preserve the formatting. + if (numElements === properties.length) { + emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); + } + else { + var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createAndRecordTempVariable(0 /* Auto */); + // Write out the first non-computed properties + // (or all properties if none of them are computed), + // then emit the rest through indexing on the temp variable. + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 145 /* GetAccessor */ || property.kind === 146 /* SetAccessor */) { + // TODO (drosen): Reconcile with 'emitMemberFunctions'. + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 245 /* PropertyAssignment */) { + emit(property.initializer); + } + else if (property.kind === 246 /* ShorthandPropertyAssignment */) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 143 /* MethodDeclaration */) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2 /* ES6 */) { + var numProperties = properties.length; + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 136 /* ComputedPropertyName */) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + // Ordinary case: either the object has no computed properties + // or we're compiling with an ES6+ target. + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(181 /* BinaryExpression */, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(166 /* PropertyAccessExpression */); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(167 /* ElementAccessExpression */); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + // When diagnosing whether the expression needs parentheses, the decision should be based + // on the innermost expression in a chain of nested type assertions. + while (expr.kind === 171 /* TypeAssertionExpression */ || expr.kind === 189 /* AsExpression */) { + expr = expr.expression; + } + // isLeftHandSideExpression is almost the correct criterion for when it is not necessary + // to parenthesize the expression before a dot. The known exceptions are: + // + // NewExpression: + // new C.x -> not the same as (new C).x + // NumberLiteral + // 1.x -> not the same as (1).x + // + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 169 /* NewExpression */ && + expr.kind !== 8 /* NumericLiteral */) { + return expr; + } + var node = ts.createSynthesizedNode(172 /* ParenthesizedExpression */); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2 /* ES6 */) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "comment1" is not considered to be leading comment for node.initializer + // but rather a trailing comment on the previous node. + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + // Return true if identifier resolves to an exported member of a namespace + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 248 /* SourceFile */; + } + function emitShorthandPropertyAssignment(node) { + // The name property of a short-hand property assignment is considered an expression position, so here + // we manually emit the identifier to avoid rewriting. + writeTextOfNode(currentSourceFile, node.name); + // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, + // we emit a normal property assignment. For example: + // module m { + // export let y; + // } + // module m { + // let obj = { y }; + // } + // Here we need to emit obj = { y : m.y } regardless of the output target. + if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { + // Emit identifier as an identifier + write(": "); + emit(node.name); + } + if (languageVersion >= 2 /* ES6 */ && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 166 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 166 /* PropertyAccessExpression */ || node.kind === 167 /* ElementAccessExpression */ + ? resolver.getConstantValue(node) + : undefined; + } + // Returns 'true' if the code was actually indented, false otherwise. + // If the code is not indented, an optional valueToWriteWhenNotIndenting will be + // emitted instead. + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + // Always use a newline for synthesized code if the synthesizer desires it. + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + // 1 .toString is a valid property access, emit a space after the literal + // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal + var shouldEmitSpace; + if (!indentedBeforeDot) { + if (node.expression.kind === 8 /* NumericLiteral */) { + // check if numeric literal was originally written with a dot + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; + } + else { + // check if constant enum value is integer + var constantValue = tryGetConstEnumValue(node.expression); + // isFinite handles cases when constantValue is undefined + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69 /* Identifier */) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0 /* Auto */); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, /*useFallback*/ true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, /*useFallback*/ false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69 /* Identifier */: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 135 /* QualifiedName */: + emitQualifiedNameAsExpression(node, useFallback); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 185 /* SpreadElementExpression */; }); + } + function skipParentheses(node) { + while (node.kind === 172 /* ParenthesizedExpression */ || node.kind === 171 /* TypeAssertionExpression */ || node.kind === 189 /* AsExpression */) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || node.kind === 95 /* SuperKeyword */) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0 /* Auto */); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 166 /* PropertyAccessExpression */) { + // Target will be emitted as "this" argument + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 167 /* ElementAccessExpression */) { + // Target will be emitted as "this" argument + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95 /* SuperKeyword */) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95 /* SuperKeyword */) { + // Calls of form super(...) and super.foo(...) + emitThis(target); + } + else { + // Calls of form obj.foo(...) + emit(target); + } + } + else { + // Calls of form foo(...) + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 95 /* SuperKeyword */) { + emitSuper(node.expression); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 166 /* PropertyAccessExpression */ && node.expression.expression.kind === 95 /* SuperKeyword */; + } + if (superCall && languageVersion < 2 /* ES6 */) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + // Spread operator logic is supported in new expressions in ES5 using a combination + // of Function.prototype.bind() and Function.prototype.apply(). + // + // Example: + // + // var args = [1, 2, 3, 4, 5]; + // new Array(...args); + // + // is compiled into the following ES5: + // + // var args = [1, 2, 3, 4, 5]; + // new (Array.bind.apply(Array, [void 0].concat(args))); + // + // The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new', + // Thus, we set it to undefined ('void 0'). + if (languageVersion === 1 /* ES5 */ && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2 /* ES6 */) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + // If the node is synthesized, it means the emitter put the parentheses there, + // not the user. If we didn't want them, the emitter would not have put them + // there. + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174 /* ArrowFunction */) { + if (node.expression.kind === 171 /* TypeAssertionExpression */ || node.expression.kind === 189 /* AsExpression */) { + var operand = node.expression.expression; + // Make sure we consider all nested cast expressions, e.g.: + // (-A).x; + while (operand.kind === 171 /* TypeAssertionExpression */ || operand.kind === 189 /* AsExpression */) { + operand = operand.expression; + } + // We have an expression of the form: (SubExpr) + // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. + // Omitting the parentheses, however, could cause change in the semantics of the generated + // code if the casted expression has a lower precedence than the rest of the expression, e.g.: + // (new A).foo should be emitted as (new A).foo and not new A.foo + // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() + // new (A()) should be emitted as new (A()) and not new A() + // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () + if (operand.kind !== 179 /* PrefixUnaryExpression */ && + operand.kind !== 177 /* VoidExpression */ && + operand.kind !== 176 /* TypeOfExpression */ && + operand.kind !== 175 /* DeleteExpression */ && + operand.kind !== 180 /* PostfixUnaryExpression */ && + operand.kind !== 169 /* NewExpression */ && + !(operand.kind === 168 /* CallExpression */ && node.parent.kind === 169 /* NewExpression */) && + !(operand.kind === 173 /* FunctionExpression */ && node.parent.kind === 168 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 166 /* PropertyAccessExpression */)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78 /* DeleteKeyword */)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103 /* VoidKeyword */)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101 /* TypeOfKeyword */)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 /* VariableDeclaration */ || node.parent.kind === 163 /* BindingElement */); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // emit + // ++x + // as + // exports('x', ++x) + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + // In some cases, we need to emit a space between the operator and the operand. One obvious case + // is when the operator is an identifier, like delete or typeof. We also need to do this for plus + // and minus expressions in certain cases. Specifically, consider the following two cases (parens + // are just for clarity of exposition, and not part of the source code): + // + // (+(+1)) + // (+(++1)) + // + // We need to emit a space in both cases. In the first case, the absence of a space will make + // the resulting expression a prefix increment operation. And in the second, it will make the resulting + // expression a prefix increment whose operand is a plus expression - (++(+x)) + // The same is true of minus of course. + if (node.operand.kind === 179 /* PrefixUnaryExpression */) { + var operand = node.operand; + if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { + write(" "); + } + else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 42 /* MinusMinusToken */)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // export function returns the value that was passes as the second argument + // however for postfix unary expressions result value should be the value before modification. + // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41 /* PlusPlusToken */) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); + } + /* + * Checks if given node is a source file level declaration (not nested in module/function). + * If 'isExported' is true - then declaration must also be exported. + * This function is used in two cases: + * - check if node is a exported source file level value to determine + * if we should also export the value after its it changed + * - check if node is a source level declaration to emit it differently, + * i.e non-exported variable statement 'var x = 1' is hoisted so + * we we emit variable statement 'var' should be dropped. + */ + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 248 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { + return false; + } + else { + current = current.parent; + } + } + } + /** + * Emit ES7 exponentiation operator downlevel using Math.pow + * @param node a binary expression node containing exponentiationOperator (**, **=) + */ + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { + var synthesizedLHS; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(167 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && + leftHandSideExpression.argumentExpression.kind !== 9 /* StringLiteral */) { + var tempArgumentExpression = createAndRecordTempVariable(268435456 /* _i */); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(166 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && + (node.left.kind === 165 /* ObjectLiteralExpression */ || node.left.kind === 164 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 195 /* ExpressionStatement */); + } + else { + var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && + node.operatorToken.kind <= 68 /* LastAssignment */ && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + // emit assignment 'x y' as 'exports("x", x y)' + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 /* AsteriskAsteriskToken */ || node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { + // Downleveled emit exponentiation operator using Math.pow + emitExponentiationOperator(node); + } + else { + emit(node.left); + // Add indentation before emit the operator if the operator is on different line + // For example: + // 3 + // + 2; + // emitted as + // 3 + // + 2; + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + // Helper function to decrease the indent if we previously indented. Allows multiple + // previous indent values to be considered at a time. This also allows caller to just + // call this once, passing in all their appropriate indent values, instead of needing + // to call this helper function multiple times. + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 192 /* Block */) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15 /* OpenBraceToken */, node.pos); + write(" "); + emitToken(16 /* CloseBraceToken */, node.statements.end); + return; + } + emitToken(15 /* OpenBraceToken */, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 219 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 218 /* ModuleDeclaration */); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 219 /* ModuleBlock */) { + emitTempDeclarations(/*newLine*/ true); + } + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 192 /* Block */) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 174 /* ArrowFunction */); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88 /* IfKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + emit(node.expression); + emitToken(18 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 196 /* IfStatement */) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 192 /* Block */) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + /** + * Returns true if start of variable declaration list was emitted. + * Returns false if nothing was written - this can happen for source file level variable declarations + * in system modules where such variable declarations are hoisted. + */ + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { + // variables in variable declaration list were already hoisted + return false; + } + var tokenKind = 102 /* VarKeyword */; + if (decl && languageVersion >= 2 /* ES6 */) { + if (ts.isLet(decl)) { + tokenKind = 108 /* LetKeyword */; + } + else if (ts.isConst(decl)) { + tokenKind = 74 /* ConstKeyword */; + } + } + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + write(" "); + } + else { + switch (tokenKind) { + case 102 /* VarKeyword */: + write("var "); + break; + case 108 /* LetKeyword */: + write("let "); + break; + case 74 /* ConstKeyword */: + write("const "); + break; + } + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function emitForStatement(node) { + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* ForOfStatement */) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer.kind === 212 /* VariableDeclarationList */) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 200 /* ForInStatement */) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitDownLevelForOfStatement(node) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (let _i = 0, _a = expr; _i < _a.length; _i++) { + // let v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var endPos = emitToken(86 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(17 /* OpenParenToken */, endPos); + // Do not emit the LHS let declaration yet, because it might contain destructuring. + // Do not call recordTempDeclaration because we are declaring the temps + // right here. Recording means they will be declared later. + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var rhsIsIdentifier = node.expression.kind === 69 /* Identifier */; + var counter = createTempVariable(268435456 /* _i */); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); + // This is the let keyword for the counter and rhsReference. The let keyword for + // the LHS will be emitted inside the body. + emitStart(node.expression); + write("var "); + // _i = 0 + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + // , _a = expr + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + // _i < _a.length; + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + // _i++) + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(18 /* CloseParenToken */, node.expression.end); + // Body + write(" {"); + writeLine(); + increaseIndent(); + // Initialize LHS + // let v = _a[_i]; + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 212 /* VariableDeclarationList */) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + // This works whether the declaration is a var, let, or const. + // It will use rhsIterationValue _a[_i] as the initializer. + emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); + } + else { + // The following call does not include the initializer, so we have + // to emit it separately. + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + // It's an empty declaration list. This can only happen in an error case, if the user wrote + // for (let of []) {} + emitNodeWithoutSourceMap(createTempVariable(0 /* Auto */)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + // Initializer is an expression. Emit the expression in the body, so that it's + // evaluated on every iteration. + var assignmentExpression = createBinaryExpression(node.initializer, 56 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); + if (node.initializer.kind === 164 /* ArrayLiteralExpression */ || node.initializer.kind === 165 /* ObjectLiteralExpression */) { + // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause + // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. + emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 192 /* Block */) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(94 /* ReturnKeyword */, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96 /* SwitchKeyword */, node.pos); + write(" "); + emitToken(17 /* OpenParenToken */, endPos); + emit(node.expression); + endPos = emitToken(18 /* CloseParenToken */, node.expression.end); + write(" "); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(15 /* OpenBraceToken */, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 241 /* CaseClause */) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72 /* CatchKeyword */, node.pos); + write(" "); + emitToken(17 /* OpenParenToken */, endPos); + emit(node.variableDeclaration); + emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76 /* DebuggerKeyword */, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 218 /* ModuleDeclaration */); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); + zero.text = "0"; + var result = ts.createSynthesizedNode(177 /* VoidExpression */); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 248 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 227 /* ExportAssignment */); + // only allow export default at a source file level + if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1 /* ES5 */) { + // default value of configurable, enumerable, writable are `false`. + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0 /* ES3 */) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + // emit call to exporter only for top level nodes + if (modulekind === 4 /* System */ && node.parent === currentSourceFile) { + // emit export default as + // export("default", ) + write(exportFunctionForFile + "(\""); + if (node.flags & 1024 /* Default */) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 1024 /* Default */) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0 /* ES3 */) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === 4 /* System */) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === 4 /* System */); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + /** + * Emit an assignment to a given identifier, 'name', with a given expression, 'value'. + * @param name an identifier as a left-hand-side operand of the assignment + * @param value an expression as a right-hand-side operand of the assignment + * @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma + */ + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 /* VariableDeclaration */ || name.parent.kind === 163 /* BindingElement */); + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + if (exportChanged) { + write(")"); + } + } + /** + * Create temporary variable, emit an assignment of the variable the given expression + * @param expression an expression to assign to the newly created temporary variable + * @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location + * @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma + */ + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + var identifier = createTempVariable(0 /* Auto */); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + return identifier; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + // An exported declaration is actually emitted as an assignment (to a property on the module object), so + // temporary variables in an exported declaration need to have real declarations elsewhere + // Also temporary variables should be explicitly allocated for source level declarations when module target is system + // because actual variable declarations are hoisted + var canDefineTempVariablesInPlace = false; + if (root.kind === 211 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 138 /* Parameter */) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 181 /* BinaryExpression */) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + emitBindingElement(root, value); + } + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * This function is useful to ensure that the expression's value can be read from in subsequent expressions. + * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. + * + * @param expr the expression whose value needs to be bound. + * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; + * false if it is necessary to always emit an identifier. + */ + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue) { + // The value expression will be evaluated twice, so for anything but a simple identifier + // we need to generate a temporary variable + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // Return the expression 'value === void 0 ? defaultValue : value' + var equals = ts.createSynthesizedNode(181 /* BinaryExpression */); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(182 /* ConditionalExpression */); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54 /* ColonToken */); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8 /* NumericLiteral */); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + // We create a synthetic copy of the identifier in order to avoid the rewriting that might + // otherwise occur when the identifier is emitted. + var syntheticName = ts.createSynthesizedNode(propName.kind); + syntheticName.text = propName.text; + if (syntheticName.kind !== 69 /* Identifier */) { + return createElementAccessExpression(object, syntheticName); + } + return createPropertyAccessExpression(object, syntheticName); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(168 /* CallExpression */); + var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + // For anything but a single element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + } + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { + var propName = p.name; + var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + // For anything but a single element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 187 /* OmittedExpression */) { + if (e.kind !== 185 /* SpreadElementExpression */) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 246 /* ShorthandPropertyAssignment */) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + } + target = target.name; + } + else if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 165 /* ObjectLiteralExpression */) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 164 /* ArrayLiteralExpression */) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + write("("); + } + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + // Combine value and initializer + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + // Use 'void 0' in absence of value and initializer + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 161 /* ObjectBindingPattern */) { + // Rewrite element to a declaration with an initializer that fetches property + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 187 /* OmittedExpression */) { + if (!element.dotDotDotToken) { + // Rewrite element to a declaration that accesses array element at index i + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2 /* ES6 */) { + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + var initializer = node.initializer; + if (!initializer && languageVersion < 2 /* ES6 */) { + // downlevel emit for non-initialized let bindings defined in loops + // for (...) { let x; } + // should be + // for (...) { var = void 0; } + // this is necessary to preserve ES6 semantic in scenarios like + // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && + (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); + // NOTE: default initialization should not be added to let bindings in for-in\for-of statements + if (isUninitializedLet && + node.parent.parent.kind !== 200 /* ForInStatement */ && + node.parent.parent.kind !== 201 /* ForOfStatement */) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 187 /* OmittedExpression */) { + return; + } + var name = node.name; + if (name.kind === 69 /* Identifier */) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function getCombinedFlagsForIdentifier(node) { + if (!node.parent || (node.parent.kind !== 211 /* VariableDeclaration */ && node.parent.kind !== 163 /* BindingElement */)) { + return 0; + } + return ts.getCombinedNodeFlags(node.parent); + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1 /* Export */) && + modulekind === 5 /* ES6 */ && + node.parent.kind === 248 /* SourceFile */; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + // If we're not exporting the variables, there's nothing special here. + // Always emit comments for these nodes. + if (!(node.flags & 1 /* Export */)) { + return true; + } + // If we are exporting, but it's a top-level ES6 module exports, + // we'll emit the declaration list verbatim, so emit comments too. + if (isES6ExportedDeclaration(node)) { + return true; + } + // Otherwise, only emit if we have at least one initializer present. + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2 /* ES6 */) { + if (ts.isBindingPattern(node.name)) { + var name_24 = createTempVariable(0 /* Auto */); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_24); + emit(name_24); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2 /* ES6 */) { + var tempIndex = 0; + ts.forEach(node.parameters, function (parameter) { + // A rest parameter cannot have a binding pattern or an initializer, + // so let's just ignore it. + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + // In cases where a binding pattern is simply '[]' or '{}', + // we usually don't want to emit a var declaration; however, in the presence + // of an initializer, we must emit that expression to preserve side effects. + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); + } + else { + emit(tempParameters[tempIndex]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456 /* _i */).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 145 /* GetAccessor */ ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 174 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 173 /* FunctionExpression */) { + // Emit name if one is present + return !!node.name; + } + if (node.kind === 213 /* FunctionDeclaration */) { + // Emit name if one is present, or emit generated name in down-level case (for export default case) + return !!node.name || languageVersion < 2 /* ES6 */; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + // TODO (yuisu) : we should not have special cases to condition emitting comments + // but have one place to fix check for these conditions. + if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */ && + node.parent && node.parent.kind !== 245 /* PropertyAssignment */ && + node.parent.kind !== 168 /* CallExpression */) { + // 1. Methods will emit the comments as part of emitting method declaration + // 2. If the function is a property of object literal, emitting leading-comments + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // For example: + // var obj = { + // id: + // /*comment*/ () => void + // } + // 3. If the function is an argument in call expression, emitting of comments will be + // taken care of in emit list of arguments inside of emitCallexpression + emitLeadingComments(node); + } + emitStart(node); + // For targeting below es6, emit functions-like declaration including arrow function using function keyword. + // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024 /* Default */) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== 5 /* ES6 */ && node.kind === 213 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + // Check whether the parameter list needs parentheses and preserve no-parenthesis + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 174 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; + var args; + // An async function is emit as an outer function that calls an inner + // generator function. To preserve lexical bindings, we pass the current + // `this` and `arguments` objects to `__awaiter`. The generator function + // passed to `__awaiter` is executed inside of the callback to the + // promise constructor. + // + // The emit for an async arrow without a lexical `arguments` binding might be: + // + // // input + // let a = async (b) => { await b; } + // + // // output + // let a = (b) => __awaiter(this, void 0, void 0, function* () { + // yield b; + // }); + // + // The emit for an async arrow with a lexical `arguments` binding might be: + // + // // input + // let a = async (b) => { await arguments[0]; } + // + // // output + // let a = (b) => __awaiter(this, arguments, void 0, function* (arguments) { + // yield arguments[0]; + // }); + // + // The emit for an async function expression without a lexical `arguments` binding + // might be: + // + // // input + // let a = async function (b) { + // await b; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, void 0, void 0, function* () { + // yield b; + // }); + // } + // + // The emit for an async function expression with a lexical `arguments` binding + // might be: + // + // // input + // let a = async function (b) { + // await arguments[0]; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, arguments, void 0, function* (_arguments) { + // yield _arguments[0]; + // }); + // } + // + // The emit for an async function expression with a lexical `arguments` binding + // and a return type annotation might be: + // + // // input + // let a = async function (b): MyPromise { + // await arguments[0]; + // } + // + // // output + // let a = function (b) { + // return __awaiter(this, arguments, MyPromise, function* (_arguments) { + // yield _arguments[0]; + // }); + // } + // + // If this is not an async arrow, emit the opening brace of the function body + // and the start of the return statement. + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments"); + } + else { + write(", void 0"); + } + if (promiseConstructor) { + write(", "); + emitNodeWithoutSourceMap(promiseConstructor); + } + else { + write(", Promise"); + } + // Emit the call to __awaiter. + if (hasLexicalArguments) { + write(", function* (_arguments)"); + } + else { + write(", function* ()"); + } + // Emit the signature and body for the inner generator function. + emitFunctionBody(node); + write(")"); + // If this is not an async arrow, emit the closing brace of the outer function body. + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + // There can be no body when there are parse errors. Just emit an empty block + // in that case. + write(" { }"); + } + else { + if (node.body.kind === 192 /* Block */) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + // When targeting ES6, emit arrow function natively in ES6 + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync && languageVersion === 2 /* ES6 */) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + // For es6 and higher we can emit the expression as is. However, in the case + // where the expression might end up looking like a block when emitted, we'll + // also wrap it in parentheses first. For example if you have: a => {} + // then we need to generate: a => ({}) + write(" "); + // Unwrap all type assertions. + var current = body; + while (current.kind === 171 /* TypeAssertionExpression */) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 165 /* ObjectLiteralExpression */); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + // If we didn't have to emit any preamble code, then attempt to keep the arrow + // function on one line. + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16 /* CloseBraceToken */, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 195 /* ExpressionStatement */) { + var expr = statement.expression; + if (expr && expr.kind === 168 /* CallExpression */) { + var func = expr.expression; + if (func && func.kind === 95 /* SuperKeyword */) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x + if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 136 /* ComputedPropertyName */) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0; _a < properties.length; _a++) { + var property = properties[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 128 /* Static */) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 191 /* SemicolonClassElement */) { + writeLine(); + write(";"); + } + else if (member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 143 /* MethodDeclaration */ || + member.kind === 145 /* GetAccessor */ || + member.kind === 146 /* SetAccessor */) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 128 /* Static */) { + write("static "); + } + if (member.kind === 145 /* GetAccessor */) { + write("get "); + } + else if (member.kind === 146 /* SetAccessor */) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 191 /* SemicolonClassElement */) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + // Check if we have property assignment inside class declaration. + // If there is property assignment, we need to emit constructor whether users define it or not + // If there is no property assignment, we can omit constructor if users do not define it + var hasInstancePropertyWithInitializer = false; + // Emit the constructor overload pinned comments + ts.forEach(node.members, function (member) { + if (member.kind === 144 /* Constructor */ && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + // Check if there is any non-static property assignment + if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + // For target ES6 and above, if there is no user-defined constructor and there is no property assignment + // do not emit constructor in class declaration. + if (languageVersion >= 2 /* ES6 */ && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2 /* ES6 */) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + // Based on EcmaScript6 section 14.5.14: Runtime Semantics: ClassDefinitionEvaluation. + // If constructor is empty, then, + // If ClassHeritageopt is present, then + // Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition. + // Else, + // Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2 /* ES6 */) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(/*newLine*/ true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var thisNodeIsDecorated = ts.nodeIsDecorated(node); + if (node.kind === 214 /* ClassDeclaration */) { + if (thisNodeIsDecorated) { + // To preserve the correct runtime semantics when decorators are applied to the class, + // the emit needs to follow one of the following rules: + // + // * For a local class declaration: + // + // @dec class C { + // } + // + // The emit should be: + // + // let C = class { + // }; + // C = __decorate([dec], C); + // + // * For an exported class declaration: + // + // @dec export class C { + // } + // + // The emit should be: + // + // export let C = class { + // }; + // C = __decorate([dec], C); + // + // * For a default export of a class declaration with a name: + // + // @dec default export class C { + // } + // + // The emit should be: + // + // let C = class { + // } + // C = __decorate([dec], C); + // export default C; + // + // * For a default export of a class declaration without a name: + // + // @dec default export class { + // } + // + // The emit should be: + // + // let _default = class { + // } + // _default = __decorate([dec], _default); + // export default _default; + // + if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024 /* Default */) { + write("default "); + } + } + } + // If the class has static properties, and it's a class expression, then we'll need + // to specialize the emit a bit. for a class expression of the form: + // + // class C { static a = 1; static b = 2; ... } + // + // We'll emit: + // + // (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp) + // + // This keeps the expression as an expression, while ensuring that the static parts + // of it have been initialized by the time it is used. + var staticProperties = getInitializedProperties(node, /*static:*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186 /* ClassExpression */; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0 /* Auto */); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + // emit name if + // - node has a name + // - this is default export with static initializers + if ((node.name || (node.flags & 1024 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + scopeEmitStart(node); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. + // For a decorated class, we need to assign its name (if it has one). This is because we emit + // the class as a class expression to avoid the double-binding of the identifier: + // + // let C = class { + // } + // Object.defineProperty(C, "name", { value: "C", configurable: true }); + // + if (thisNodeIsDecorated) { + write(";"); + } + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + if (isClassExpressionWithStaticProperties) { + for (var _a = 0; _a < staticProperties.length; _a++) { + var property = staticProperties[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node); + } + // If this is an exported class, but not on the top level (i.e. on an internal + // module), export it + if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { + // if this is a top level default export of decorated class, write the export after the declaration. + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 214 /* ClassDeclaration */) { + // source file level classes in system modules are hoisted so 'var's for them are already defined + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); + writeLine(); + emitDecoratorsOfClass(node); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(/*newLine*/ true); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 214 /* ClassDeclaration */) { + write(";"); + } + emitEnd(node); + if (node.kind === 214 /* ClassDeclaration */) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node) { + emitDecoratorsOfMembers(node, /*staticFlag*/ 0); + emitDecoratorsOfMembers(node, 128 /* Static */); + emitDecoratorsOfConstructor(node); + } + function emitDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + // skip decoration of the constructor if neither it nor its parameters are decorated + if (!decorators && !hasDecoratedParameters) { + return; + } + // Emit the call to __decorate. Given the class: + // + // @dec + // class C { + // } + // + // The emit for the class is: + // + // C = __decorate([dec], C); + // + writeLine(); + emitStart(node); + emitDeclarationName(node); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(");"); + emitEnd(node); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + // only emit members in the correct group + if ((member.flags & 128 /* Static */) !== staticFlag) { + continue; + } + // skip members that cannot be decorated (such as the constructor) + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + // skip a member if it or any of its parameters are not decorated + if (!ts.nodeOrChildIsDecorated(member)) { + continue; + } + // skip an accessor declaration if it is not the first accessor + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + // get the decorators from the first accessor with decorators + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + // we only decorate parameters of the set accessor + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + // we only decorate the parameters here if this is a method + if (member.kind === 143 /* MethodDeclaration */) { + functionLikeMember = member; + } + } + // Emit the call to __decorate. Given the following: + // + // class C { + // @dec method(@dec2 x) {} + // @dec get accessor() {} + // @dec prop; + // } + // + // The emit for a method is: + // + // __decorate([ + // dec, + // __param(0, dec2), + // __metadata("design:type", Function), + // __metadata("design:paramtypes", [Object]), + // __metadata("design:returntype", void 0) + // ], C.prototype, "method", undefined); + // + // The emit for an accessor is: + // + // __decorate([ + // dec + // ], C.prototype, "accessor", undefined); + // + // The emit for a property is: + // + // __decorate([ + // dec + // ], C.prototype, "prop"); + // + writeLine(); + emitStart(member); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + if (languageVersion > 0 /* ES3 */) { + if (member.kind !== 141 /* PropertyDeclaration */) { + // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly. + // We have this extra argument here so that we can inject an explicit property descriptor at a later date. + write(", null"); + } + else { + // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it + // should not invoke `Object.getOwnPropertyDescriptor`. + write(", void 0"); + } + } + write(");"); + emitEnd(member); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { + emitStart(decorator); + write("__param(" + parameterIndex + ", "); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + // This method determines whether to emit the "design:type" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 143 /* MethodDeclaration */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + // This method determines whether to emit the "design:returntype" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 143 /* MethodDeclaration */: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case 214 /* ClassDeclaration */: + case 143 /* MethodDeclaration */: + case 146 /* SetAccessor */: + return true; + } + return false; + } + /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ + function emitSerializedTypeOfNode(node) { + // serialization of the type of a declaration uses the following rules: + // + // * The serialized type of a ClassDeclaration is "Function" + // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. + // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. + // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. + // * The serialized type of any other FunctionLikeDeclaration is "Function". + // * The serialized type of any other node is "void 0". + // + // For rules on serializing type annotations, see `serializeTypeNode`. + switch (node.kind) { + case 214 /* ClassDeclaration */: + write("Function"); + return; + case 141 /* PropertyDeclaration */: + emitSerializedTypeNode(node.type); + return; + case 138 /* Parameter */: + emitSerializedTypeNode(node.type); + return; + case 145 /* GetAccessor */: + emitSerializedTypeNode(node.type); + return; + case 146 /* SetAccessor */: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103 /* VoidKeyword */: + write("void 0"); + return; + case 160 /* ParenthesizedType */: + emitSerializedTypeNode(node.type); + return; + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + write("Function"); + return; + case 156 /* ArrayType */: + case 157 /* TupleType */: + write("Array"); + return; + case 150 /* TypePredicate */: + case 120 /* BooleanKeyword */: + write("Boolean"); + return; + case 130 /* StringKeyword */: + case 9 /* StringLiteral */: + write("String"); + return; + case 128 /* NumberKeyword */: + write("Number"); + return; + case 131 /* SymbolKeyword */: + write("Symbol"); + return; + case 151 /* TypeReference */: + emitSerializedTypeReferenceNode(node); + return; + case 154 /* TypeQuery */: + case 155 /* TypeLiteral */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: + case 117 /* AnyKeyword */: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + // Clone the type name and parent it to a location outside of the current declaration. + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0 /* Auto */); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, /*useFallback*/ true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, /*useFallback*/ false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2 /* ES6 */) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ + function emitSerializedParameterTypesOfNode(node) { + // serialization of parameter types uses the following rules: + // + // * If the declaration is a class, the parameters of the first constructor with a body are used. + // * If the declaration is function-like and has a body, the parameters of the function are used. + // + // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. + if (node) { + var valueDeclaration; + if (node.kind === 214 /* ClassDeclaration */) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 156 /* ArrayType */) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 151 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + /** Serializes the return type of function. Used by the __metadata decorator for a method. */ + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + // This method emits the serialized type metadata for a decorator target. + // The caller should have already tested whether the node has decorators. + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + // const enums are completely erased during compilation. + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); + } + function emitModuleDeclaration(node) { + // Emit only if this module is non-ambient. + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 219 /* ModuleBlock */) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + // write moduleDecl = containingModule.m only if it is not exported es6 module member + if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { + if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + /* + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9 /* StringLiteral */) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18 /* CloseParenToken */, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 221 /* ImportEqualsDeclaration */) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224 /* NamespaceImport */) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 222 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== 5 /* ES6 */) { + return emitExternalImportDeclaration(node); + } + // ES6 import + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (modulekind !== 2 /* AMD */) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + // import x = require("foo") + // import * as x from "foo" + if (!isExportedImport) + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + // import "foo" + // import x from "foo" + // import { x, y } from "foo" + // import d, * as x from "foo" + // import d, { x, y } from "foo" + var isNakedImport = 222 /* ImportDeclaration */ && !node.importClause; + if (!isNakedImport) { + write("var "); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + // import d, * as x from "foo" + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + // import d, * as x from "foo" + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when + // - current file is not external module + // - import declaration is top level and target is value imported by entity name + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + // variable declaration for import-equals declaration can be hoisted in system modules + // in this case 'var' should be omitted and emit should contain only initialization + var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + // is it top level export import v = a.b.c in system module? + // if yes - it needs to be rewritten as exporter('v', v = a.b.c) + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1 /* Export */)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== 4 /* System */); + if (modulekind !== 5 /* ES6 */) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + // export { x, y, ... } from "foo" + if (modulekind !== 2 /* AMD */) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + // export * from "foo" + writeLine(); + write("__export("); + if (modulekind !== 2 /* AMD */) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + // export { x, y, ... } + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === 5 /* ES6 */); + var needsComma = false; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === 5 /* ES6 */) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 213 /* FunctionDeclaration */ && + expression.kind !== 214 /* ClassDeclaration */) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === 4 /* System */) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0 /* ES3 */) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStars = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 222 /* ImportDeclaration */: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { + // import "mod" + // import x from "mod" where x is referenced + // import * as x from "mod" where x is referenced + // import { x, y } from "mod" where at least one import is referenced + externalImports.push(node); + } + break; + case 221 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 232 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + // import x = require("mod") where x is referenced + externalImports.push(node); + } + break; + case 228 /* ExportDeclaration */: + if (node.moduleSpecifier) { + if (!node.exportClause) { + // export * from "mod" + externalImports.push(node); + hasExportStars = true; + } + else if (resolver.isValueAliasDeclaration(node)) { + // export { x, y } from "mod" where at least one export is a value symbol + externalImports.push(node); + } + } + else { + // export { x, y } + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_25 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_25] || (exportSpecifiers[name_25] = [])).push(specifier); + } + } + break; + case 227 /* ExportAssignment */: + if (node.isExportEquals && !exportEquals) { + // export = x + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStars) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 228 /* ExportDeclaration */ && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9 /* StringLiteral */) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + // do not create variable declaration for exports and imports that lack import clause + var skipNode = importNode.kind === 228 /* ExportDeclaration */ || + (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + if (!hasExportStars) { + // local names set is needed only in presence of star exports + return undefined; + } + // local names set should only be added if we have anything exported + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + return emitExportStarFunction(/*localNames*/ undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + // write name of exported declaration, i.e 'export var x...' + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + // write name of export specified, i.e. 'export {x}' + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 228 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + // define an export star helper function + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + // do not record default exports + // they are local to module and never overwritten (explicitly skipped) by star export + if (node.kind !== 69 /* Identifier */ && node.flags & 1024 /* Default */) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69 /* Identifier */) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + // per ES6 spec: + // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method + // - var declarations are initialized to undefined - 14.a.ii + // - function/generator declarations are instantiated - 16.a.iv + // this means that after module is instantiated but before its evaluation + // exported functions are already accessible at import sites + // in theory we should hoist only exported functions and its dependencies + // in practice to simplify things we'll hoist all source level functions and variable declaration + // including variables declarations for module and class declarations + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + var name_26 = local.kind === 69 /* Identifier */ + ? local + : local.name; + if (name_26) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_26.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 214 /* ClassDeclaration */ || local.kind === 218 /* ModuleDeclaration */ || local.kind === 217 /* EnumDeclaration */) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); + if (flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } + if (node.kind === 213 /* FunctionDeclaration */) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 214 /* ClassDeclaration */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 217 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { + var name_27 = node.name; + if (name_27.kind === 69 /* Identifier */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_27); + } + else { + ts.forEachChild(name_27, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + // hoist variable if + // - it is not block scoped + // - it is top level block scoped + // if block scoped variables are nested in some another block then + // no other functions can use them except ones that are defined at least in the same block + return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; + } + function isCurrentFileSystemExternalModule() { + return modulekind === 4 /* System */ && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + // shape of the body in system modules: + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } + // I.e: + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); + // will be transformed to + // function(exports) { + // var file1; // local alias + // var y; + // function foo() { return y + file1.x(); } + // exports("foo", foo); + // return { + // setters: [ + // function(v) { file1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); // return + emitTempDeclarations(/*newLine*/ true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + // derive a unique name for parameter from the first named entry in the group + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 222 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // fall-through + case 221 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 228 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + // - function declarations are not emitted because they were already hoisted + // - import declarations are not emitted since they are already handled in setters + // - export declarations with module specifiers are not emitted since they were already written in setters + // - export declarations without module specifiers are emitted preserving the order + case 213 /* FunctionDeclaration */: + case 222 /* ImportDeclaration */: + continue; + case 228 /* ExportDeclaration */: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + // write call to exporter function for every export specifier in exports list + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 221 /* ImportEqualsDeclaration */: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + // - import equals declarations that import external modules are not emitted + continue; + } + // fall-though for import declarations that import internal modules + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); // execute + } + function emitSystemModule(node) { + collectExternalModuleInfo(node); + // System modules has the following shape + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. + // 'exports' returns its 'value' argument so in most cases expressions + // that mutate exported values can be rewritten as: + // expr -> exports('name', expr). + // The only exception in this rule is postfix unary operators, + // see comment to 'emitPostfixUnaryExpression' for more details + ts.Debug.assert(!exportFunctionForFile); + // make sure that name of 'exports' function does not conflict with existing identifiers + exportFunctionForFile = makeUniqueName("exports"); + writeLine(); + write("System.register("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + // deduplicate/group entries in dependency list by the dependency name + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies) { + // names of modules with corresponding parameter in the factory function + var aliasedModuleNames = []; + // names of modules with no corresponding parameters in factory function + var unaliasedModuleNames = []; + var importAliasNames = []; // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding + // module names in aliasedModuleNames. + // Fill in amd-dependency tags + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push("\"" + amdDependency.path + "\""); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + } + } + for (var _c = 0; _c < externalImports.length; _c++) { + var importNode = externalImports[_c]; + // Find the name of the external module + var externalModuleName = getExternalModuleNameText(importNode); + // Find the name of the module alias, if there is one + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies) { + // An AMD define function has the following shape: + // define(id?, dependencies?, factory); + // + // This has the shape of + // define(name, ["module1", "module2"], function (module1Alias) { + // The location of the alias in the parameter list in the factory function needs to + // match the position of the module name in the dependency list. + // + // To ensure this is true in cases of modules with no aliases, e.g.: + // `import "module"` or `` + // we need to add modules without alias names to the end of the dependencies list + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write("[\"require\", \"exports\""); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ false); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false); + // Module is detected first to support Browserify users that load into a browser with an AMD loader + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + // Emit exportDefault if it exists will happen as part + // or normal statement emit. + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + jsxEmitReact(node); + break; + case 1 /* Preserve */: + // Fall back to preserve if None was specified (we'll error earlier) + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, /*includeTrivia*/ true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + // JSX trims whitespace at the end and beginning of lines, except that the + // start/end of a tag is considered a start/end of a line only if that line is + // on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + // Replace entities like   + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; + } + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1 /* Preserve */: + default: + return ts.getTextOfNode(node, /*includeTrivia*/ true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2 /* React */: + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); + break; + case 1 /* Preserve */: + default: + writer.writeLiteral(ts.getTextOfNode(node, /*includeTrivia*/ true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1 /* Preserve */: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2 /* React */: + emit(node.expression); + break; + } + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + // return index of the first non prologue directive + return i; + } + } + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + // Only emit helpers if the user did not say otherwise. + if (!compilerOptions.noEmitHelpers) { + // Only Emit __extends function when target ES5. + // For target ES6 and above, we can emit classDeclaration as is. + if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + // Start new file on new line + writeLine(); + emitShebang(); + emitDetachedComments(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + emitModule(node); + } + else { + // emit prologue directives prior to __extends + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2 /* Ambient */) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + // All of these entities are emitted in a specialized fashion. As such, we allow + // the specialized methods for each to handle the comments on the nodes. + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 227 /* ExportAssignment */: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 193 /* VariableStatement */: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 218 /* ModuleDeclaration */: + // Only emit the leading/trailing comments for a module if we're actually + // emitting the module as well. + return shouldEmitModuleDeclaration(node); + case 217 /* EnumDeclaration */: + // Only emit the leading/trailing comments for an enum if we're actually + // emitting the module as well. + return shouldEmitEnumDeclaration(node); + } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + ts.Debug.assert(!isSpecializedCommentHandling(node)); + // If this is the expression body of an arrow function that we're down-leveling, + // then we don't want to emit comments when we emit the body. It will have already + // been taken care of when we emitted the 'return' statement for the function + // expression body. + if (node.kind !== 192 /* Block */ && + node.parent && + node.parent.kind === 174 /* ArrowFunction */ && + node.parent.body === node && + compilerOptions.target <= 1 /* ES5 */) { + return false; + } + // Emit comments for everything else. + return true; + } + function emitJavaScriptWorker(node) { + // Check if the node can be emitted regardless of the ScriptTarget + switch (node.kind) { + case 69 /* Identifier */: + return emitIdentifier(node); + case 138 /* Parameter */: + return emitParameter(node); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + return emitMethod(node); + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + return emitAccessor(node); + case 97 /* ThisKeyword */: + return emitThis(node); + case 95 /* SuperKeyword */: + return emitSuper(node); + case 93 /* NullKeyword */: + return write("null"); + case 99 /* TrueKeyword */: + return write("true"); + case 84 /* FalseKeyword */: + return write("false"); + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 10 /* RegularExpressionLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 13 /* TemplateMiddle */: + case 14 /* TemplateTail */: + return emitLiteral(node); + case 183 /* TemplateExpression */: + return emitTemplateExpression(node); + case 190 /* TemplateSpan */: + return emitTemplateSpan(node); + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + return emitJsxElement(node); + case 236 /* JsxText */: + return emitJsxText(node); + case 240 /* JsxExpression */: + return emitJsxExpression(node); + case 135 /* QualifiedName */: + return emitQualifiedName(node); + case 161 /* ObjectBindingPattern */: + return emitObjectBindingPattern(node); + case 162 /* ArrayBindingPattern */: + return emitArrayBindingPattern(node); + case 163 /* BindingElement */: + return emitBindingElement(node); + case 164 /* ArrayLiteralExpression */: + return emitArrayLiteral(node); + case 165 /* ObjectLiteralExpression */: + return emitObjectLiteral(node); + case 245 /* PropertyAssignment */: + return emitPropertyAssignment(node); + case 246 /* ShorthandPropertyAssignment */: + return emitShorthandPropertyAssignment(node); + case 136 /* ComputedPropertyName */: + return emitComputedPropertyName(node); + case 166 /* PropertyAccessExpression */: + return emitPropertyAccess(node); + case 167 /* ElementAccessExpression */: + return emitIndexedAccess(node); + case 168 /* CallExpression */: + return emitCallExpression(node); + case 169 /* NewExpression */: + return emitNewExpression(node); + case 170 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 171 /* TypeAssertionExpression */: + return emit(node.expression); + case 189 /* AsExpression */: + return emit(node.expression); + case 172 /* ParenthesizedExpression */: + return emitParenExpression(node); + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + return emitFunctionDeclaration(node); + case 175 /* DeleteExpression */: + return emitDeleteExpression(node); + case 176 /* TypeOfExpression */: + return emitTypeOfExpression(node); + case 177 /* VoidExpression */: + return emitVoidExpression(node); + case 178 /* AwaitExpression */: + return emitAwaitExpression(node); + case 179 /* PrefixUnaryExpression */: + return emitPrefixUnaryExpression(node); + case 180 /* PostfixUnaryExpression */: + return emitPostfixUnaryExpression(node); + case 181 /* BinaryExpression */: + return emitBinaryExpression(node); + case 182 /* ConditionalExpression */: + return emitConditionalExpression(node); + case 185 /* SpreadElementExpression */: + return emitSpreadElementExpression(node); + case 184 /* YieldExpression */: + return emitYieldExpression(node); + case 187 /* OmittedExpression */: + return; + case 192 /* Block */: + case 219 /* ModuleBlock */: + return emitBlock(node); + case 193 /* VariableStatement */: + return emitVariableStatement(node); + case 194 /* EmptyStatement */: + return write(";"); + case 195 /* ExpressionStatement */: + return emitExpressionStatement(node); + case 196 /* IfStatement */: + return emitIfStatement(node); + case 197 /* DoStatement */: + return emitDoStatement(node); + case 198 /* WhileStatement */: + return emitWhileStatement(node); + case 199 /* ForStatement */: + return emitForStatement(node); + case 201 /* ForOfStatement */: + case 200 /* ForInStatement */: + return emitForInOrForOfStatement(node); + case 202 /* ContinueStatement */: + case 203 /* BreakStatement */: + return emitBreakOrContinueStatement(node); + case 204 /* ReturnStatement */: + return emitReturnStatement(node); + case 205 /* WithStatement */: + return emitWithStatement(node); + case 206 /* SwitchStatement */: + return emitSwitchStatement(node); + case 241 /* CaseClause */: + case 242 /* DefaultClause */: + return emitCaseOrDefaultClause(node); + case 207 /* LabeledStatement */: + return emitLabelledStatement(node); + case 208 /* ThrowStatement */: + return emitThrowStatement(node); + case 209 /* TryStatement */: + return emitTryStatement(node); + case 244 /* CatchClause */: + return emitCatchClause(node); + case 210 /* DebuggerStatement */: + return emitDebuggerStatement(node); + case 211 /* VariableDeclaration */: + return emitVariableDeclaration(node); + case 186 /* ClassExpression */: + return emitClassExpression(node); + case 214 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 215 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 217 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 247 /* EnumMember */: + return emitEnumMember(node); + case 218 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 222 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 221 /* ImportEqualsDeclaration */: + return emitImportEqualsDeclaration(node); + case 228 /* ExportDeclaration */: + return emitExportDeclaration(node); + case 227 /* ExportAssignment */: + return emitExportAssignment(node); + case 248 /* SourceFile */: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + // get the leading comments from detachedPos + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + /** + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(comment) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments + if (node.parent) { + if (node.parent.kind === 248 /* SourceFile */ || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + // get comments without detached comments + return getLeadingCommentsWithoutDetachedComments(); + } + else { + // get the leading comments from the node + return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + } + } + } + function getTrailingCommentsToEmit(node) { + // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments + if (node.parent) { + if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + } + } + } + /** + * Emit comments associated with node that will not be emitted into JS file + */ + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + // Emit the trailing comments only if the parent's end doesn't match + var trailingComments = getTrailingCommentsToEmit(node); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + } + /** + * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: + * x, /comment1/ y + * ^ => pos; the function will emit "comment1" in the emitJS + */ + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + // get comments without detached comments + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + // get the leading comments from the node + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + } + function emitDetachedComments(node) { + var leadingComments; + if (compilerOptions.removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + // There was a blank line between the last comment and this comment. This + // comment is not part of the copyright comments. Return what we have so + // far. + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + // All comments look like they could have been part of the copyright header. Make + // sure there is at least one blank line between it and the node. If not, it's not + // a copyright header. + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + // Valid detachedComments + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } + var _a; + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + } + } + } + ts.emitFiles = emitFiles; })(ts || (ts = {})); /// /// @@ -35311,11 +35997,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -35325,13 +36011,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, loadOnlyDts, failedLookupLocation, host) { - if (loadOnlyDts) { - return tryLoad(".d.ts"); - } - else { - return ts.forEach(ts.supportedExtensions, tryLoad); - } + function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { + return ts.forEach(ts.supportedJsExtensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -35343,7 +36024,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, loadOnlyDts, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -35356,7 +36037,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -35366,7 +36047,7 @@ var ts; // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -35376,11 +36057,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -35399,16 +36080,17 @@ var ts; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk - if (moduleName.indexOf('!') != -1) { + if (moduleName.indexOf("!") != -1) { return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { // resolve .tsx files only if jsx support is enabled // 'logical not' handles both undefined and None cases @@ -35746,7 +36428,9 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(fileName); + // first try to use file name as is to find file + // then try to convert relative file name to absolute and use it to retrieve source file + return filesByName.get(fileName) || filesByName.get(ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory())); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -35842,13 +36526,18 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; + collect(node, /* allowRelativeModuleNames */ true); + } + file.imports = imports || emptyArray; + function collect(node, allowRelativeModuleNames) { switch (node.kind) { - case 220 /* ImportDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 226 /* ExportDeclaration */: + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -35856,9 +36545,24 @@ var ts; if (!moduleNameExpr.text) { break; } - (imports || (imports = [])).push(moduleNameExpr); + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - case 216 /* ModuleDeclaration */: + case 168 /* CallExpression */: + if (isJavaScriptFile && ts.isRequireCall(node)) { + var jsImports = node.arguments; + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === 9 /* StringLiteral */) { + imports.push(jsImports[i]); + } + } + } + } + break; + case 218 /* ModuleDeclaration */: if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An AmbientExternalModuleDeclaration declares an external module. @@ -35866,22 +36570,18 @@ var ts; // The StringLiteral must specify a top - level external module name. // Relative external module names are not permitted ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9 /* StringLiteral */) { - var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - if (moduleName) { - (imports || (imports = [])).push(moduleName); - } - } + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + collect(node, /* allowRelativeModuleNames */ false); }); } break; } + if (ts.isSourceFileJavaScript(file)) { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames); }); + } } - file.imports = imports || emptyArray; } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; @@ -35925,52 +36625,52 @@ var ts; } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); - if (filesByName.contains(canonicalName)) { + if (filesByName.contains(fileName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); + return getSourceFileFromCache(fileName, /*useAbsolutePath*/ false); } - else { - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); - if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); - } - // We haven't looked for this file, do so now and cache result - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(canonicalName, file); - if (file) { - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - // Set the source file for normalized absolute path - filesByName.set(canonicalAbsolutePath, file); - var basePath = ts.getDirectoryPath(fileName); - if (!options.noResolve) { - processReferencedFiles(file, basePath); - } - // always process imported modules to record module name resolutions - processImportedModules(file, basePath); - if (isDefaultLib) { - file.isDefaultLib = true; - files.unshift(file); - } - else { - files.push(file); - } - } - return file; + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + if (filesByName.contains(normalizedAbsolutePath)) { + var file_1 = getSourceFileFromCache(normalizedAbsolutePath, /*useAbsolutePath*/ true); + // we don't have resolution for this relative file name but the match was found by absolute file name + // store resolution for relative name as well + filesByName.set(fileName, file_1); + return file_1; } - function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName.get(canonicalName); + // We haven't looked for this file, do so now and cache result + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(fileName, file); + if (file) { + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + // Set the source file for normalized absolute path + filesByName.set(normalizedAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath); + } + // always process imported modules to record module name resolutions + processImportedModules(file, basePath); + if (isDefaultLib) { + file.isDefaultLib = true; + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + function getSourceFileFromCache(fileName, useAbsolutePath) { + var file = filesByName.get(fileName); if (file && host.useCaseSensitiveFileNames()) { var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; - if (canonicalName !== sourceFileName) { + if (ts.normalizeSlashes(fileName) !== ts.normalizeSlashes(sourceFileName)) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } @@ -36138,9 +36838,9 @@ var ts; var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - // Cannot specify module gen target when in es6 or above - if (options.module && languageVersion >= 2 /* ES6 */) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + // Cannot specify module gen target of es6 when below es6 + if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -36181,10 +36881,6 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.experimentalAsyncFunctions && - options.target !== 2 /* ES6 */) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); - } } } ts.createProgram = createProgram; @@ -36266,11 +36962,12 @@ var ts; "commonjs": 1 /* CommonJS */, "amd": 2 /* AMD */, "system": 4 /* System */, - "umd": 3 /* UMD */ + "umd": 3 /* UMD */, + "es6": 5 /* ES6 */ }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", @@ -36412,11 +37109,6 @@ var ts; type: "boolean", description: ts.Diagnostics.Watch_input_files }, - { - name: "experimentalAsyncFunctions", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions - }, { name: "experimentalDecorators", type: "boolean", @@ -36622,6 +37314,9 @@ var ts; } if (opt.isFilePath) { value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } options[opt.name] = value; } @@ -36650,20 +37345,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_27 = sysFiles[i]; - if (ts.fileExtensionIs(name_27, ".d.ts")) { - var baseName = name_27.substr(0, name_27.length - ".d.ts".length); + var name_28 = sysFiles[i]; + if (ts.fileExtensionIs(name_28, ".d.ts")) { + var baseName = name_28.substr(0, name_28.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_27); + fileNames.push(name_28); } } - else if (ts.fileExtensionIs(name_27, ".ts")) { - if (!ts.contains(sysFiles, name_27 + "x")) { - fileNames.push(name_27); + else if (ts.fileExtensionIs(name_28, ".ts")) { + if (!ts.contains(sysFiles, name_28 + "x")) { + fileNames.push(name_28); } } else { - fileNames.push(name_27); + fileNames.push(name_28); } } } @@ -36744,7 +37439,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 172 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 174 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -36756,7 +37451,7 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 190 /* Block */: + case 192 /* Block */: if (!ts.isFunctionBlock(n)) { var parent_7 = n.parent; var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); @@ -36764,18 +37459,18 @@ var ts; // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_7.kind === 195 /* DoStatement */ || - parent_7.kind === 198 /* ForInStatement */ || - parent_7.kind === 199 /* ForOfStatement */ || - parent_7.kind === 197 /* ForStatement */ || - parent_7.kind === 194 /* IfStatement */ || - parent_7.kind === 196 /* WhileStatement */ || - parent_7.kind === 203 /* WithStatement */ || - parent_7.kind === 242 /* CatchClause */) { + if (parent_7.kind === 197 /* DoStatement */ || + parent_7.kind === 200 /* ForInStatement */ || + parent_7.kind === 201 /* ForOfStatement */ || + parent_7.kind === 199 /* ForStatement */ || + parent_7.kind === 196 /* IfStatement */ || + parent_7.kind === 198 /* WhileStatement */ || + parent_7.kind === 205 /* WithStatement */ || + parent_7.kind === 244 /* CatchClause */) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 207 /* TryStatement */) { + if (parent_7.kind === 209 /* TryStatement */) { // Could be the try-block, or the finally-block. var tryStatement = parent_7; if (tryStatement.tryBlock === n) { @@ -36783,7 +37478,7 @@ var ts; break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -36802,23 +37497,23 @@ var ts; break; } // Fallthrough. - case 217 /* ModuleBlock */: { + case 219 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 163 /* ObjectLiteralExpression */: - case 218 /* CaseBlock */: { + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 165 /* ObjectLiteralExpression */: + case 220 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -36846,12 +37541,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_28 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_28); + for (var name_29 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_29); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_28); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_29); if (!matches) { continue; } @@ -36864,14 +37559,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_28); + matches = patternMatcher.getMatches(containers, name_29); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_28, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_29, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -36895,7 +37590,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 /* Identifier */ || + if (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -36909,7 +37604,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 134 /* ComputedPropertyName */) { + else if (declaration.name.kind === 136 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); } else { @@ -36930,7 +37625,7 @@ var ts; } return true; } - if (expression.kind === 164 /* PropertyAccessExpression */) { + if (expression.kind === 166 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -36943,7 +37638,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (declaration.name.kind === 136 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { return undefined; } @@ -37019,17 +37714,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 216 /* ModuleDeclaration */); + } while (current.kind === 218 /* ModuleDeclaration */); // fall through - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -37040,21 +37735,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -37066,7 +37761,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -37075,21 +37770,21 @@ var ts; } } break; - case 161 /* BindingElement */: - case 209 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 211 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: - case 216 /* ModuleDeclaration */: - case 211 /* FunctionDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 228 /* ExportSpecifier */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: + case 218 /* ModuleDeclaration */: + case 213 /* FunctionDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: childNodes.push(node); break; } @@ -37137,17 +37832,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 215 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -37158,12 +37853,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 211 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 213 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 190 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 192 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -37223,7 +37918,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 136 /* Parameter */: + case 138 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -37231,36 +37926,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 143 /* GetAccessor */: + case 145 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 144 /* SetAccessor */: + case 146 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 245 /* EnumMember */: + case 247 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145 /* CallSignature */: + case 147 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 146 /* ConstructSignature */: + case 148 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: var variableDeclarationNode; - var name_29; - if (node.kind === 161 /* BindingElement */) { - name_29 = node.name; + var name_30; + if (node.kind === 163 /* BindingElement */) { + name_30 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 209 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 211 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -37268,24 +37963,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_29 = node.name; + name_30 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.variableElement); } - case 142 /* Constructor */: + case 144 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 228 /* ExportSpecifier */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: + case 230 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -37315,17 +38010,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 246 /* SourceFile */: + case 248 /* SourceFile */: return createSourceFileItem(node); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: return createClassItem(node); - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: return createEnumItem(node); - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return createModuleItem(node); - case 211 /* FunctionDeclaration */: + case 213 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -37337,7 +38032,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -37349,7 +38044,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 190 /* Block */) { + if (node.body && node.body.kind === 192 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -37370,7 +38065,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 142 /* Constructor */ && member; + return member.kind === 144 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -37394,7 +38089,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -37403,13 +38098,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 216 /* ModuleDeclaration */) { + while (node.body.kind === 218 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 246 /* SourceFile */ + return node.kind === 248 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -38197,22 +38892,22 @@ var ts; if (!candidates.length) { // We didn't have any sig help items produced by the TS compiler. If this is a JS // file, then see if we can figure out anything better. - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 166 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 168 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 67 /* Identifier */ + var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 164 /* PropertyAccessExpression */ + : expression.kind === 166 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -38245,7 +38940,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 166 /* CallExpression */ || node.parent.kind === 167 /* NewExpression */) { + if (node.parent.kind === 168 /* CallExpression */ || node.parent.kind === 169 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -38298,25 +38993,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 170 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 170 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 188 /* TemplateSpan */ && node.parent.parent.parent.kind === 168 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 190 /* TemplateSpan */ && node.parent.parent.parent.kind === 170 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -38434,7 +39129,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 181 /* TemplateExpression */) { + if (template.kind === 183 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -38443,7 +39138,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 246 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 248 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -38643,40 +39338,40 @@ var ts; return false; } switch (n.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 163 /* ObjectLiteralExpression */: - case 159 /* ObjectBindingPattern */: - case 153 /* TypeLiteral */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 218 /* CaseBlock */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 165 /* ObjectLiteralExpression */: + case 161 /* ObjectBindingPattern */: + case 155 /* TypeLiteral */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 220 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 167 /* NewExpression */: + case 169 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 166 /* CallExpression */: - case 170 /* ParenthesizedExpression */: - case 158 /* ParenthesizedType */: + case 168 /* CallExpression */: + case 172 /* ParenthesizedExpression */: + case 160 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 150 /* FunctionType */: - case 151 /* ConstructorType */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 146 /* ConstructSignature */: - case 145 /* CallSignature */: - case 172 /* ArrowFunction */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 148 /* ConstructSignature */: + case 147 /* CallSignature */: + case 174 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -38686,63 +39381,64 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 194 /* IfStatement */: + case 196 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 193 /* ExpressionStatement */: - return isCompletedNode(n.expression, sourceFile); - case 162 /* ArrayLiteralExpression */: - case 160 /* ArrayBindingPattern */: - case 165 /* ElementAccessExpression */: - case 134 /* ComputedPropertyName */: - case 155 /* TupleType */: + case 195 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 23 /* SemicolonToken */); + case 164 /* ArrayLiteralExpression */: + case 162 /* ArrayBindingPattern */: + case 167 /* ElementAccessExpression */: + case 136 /* ComputedPropertyName */: + case 157 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 147 /* IndexSignature */: + case 149 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 195 /* DoStatement */: + case 197 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, 102 /* WhileKeyword */, sourceFile); + var hasWhileKeyword = findChildOfKind(n, 104 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 152 /* TypeQuery */: + case 154 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 174 /* TypeOfExpression */: - case 173 /* DeleteExpression */: - case 175 /* VoidExpression */: - case 182 /* YieldExpression */: - case 183 /* SpreadElementExpression */: + case 176 /* TypeOfExpression */: + case 175 /* DeleteExpression */: + case 177 /* VoidExpression */: + case 184 /* YieldExpression */: + case 185 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 168 /* TaggedTemplateExpression */: + case 170 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 181 /* TemplateExpression */: + case 183 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 188 /* TemplateSpan */: + case 190 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 177 /* PrefixUnaryExpression */: + case 179 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 179 /* BinaryExpression */: + case 181 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 180 /* ConditionalExpression */: + case 182 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -38798,7 +39494,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 269 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 271 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -38904,7 +39600,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 234 /* JsxText */) { + if (isToken(n) || n.kind === 236 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38912,7 +39608,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 234 /* JsxText */) { + if (isToken(n) || n.kind === 236 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38926,10 +39622,10 @@ var ts; // if no - position is in the node itself so we should recurse in it. // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). // if this is the case - then we should assume that token in question is located in previous child. - if (position < child.end && (nodeHasTokens(child) || child.kind === 234 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 236 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 234 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 236 /* JsxText */ && start === child.end); // whitespace only JsxText if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); @@ -38941,7 +39637,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 246 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 248 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -39016,9 +39712,9 @@ var ts; var node = ts.getTokenAtPosition(sourceFile, position); if (isToken(node)) { switch (node.kind) { - case 100 /* VarKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: + case 102 /* VarKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: // if the current token is var, let or const, skip the VariableDeclarationList node = node.parent === undefined ? undefined : node.parent.parent; break; @@ -39067,21 +39763,21 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 149 /* TypeReference */ || node.kind === 166 /* CallExpression */) { + if (node.kind === 151 /* TypeReference */ || node.kind === 168 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 212 /* ClassDeclaration */ || node.kind === 213 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 214 /* ClassDeclaration */ || node.kind === 215 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 132 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 134 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { - return kind === 67 /* Identifier */ || ts.isKeyword(kind); + return kind === 69 /* Identifier */ || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { @@ -39091,8 +39787,17 @@ var ts; return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 /* StringLiteral */ + || kind === 10 /* RegularExpressionLiteral */ + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; function isPunctuation(kind) { - return 15 /* FirstPunctuation */ <= kind && kind <= 66 /* LastPunctuation */; + return 15 /* FirstPunctuation */ <= kind && kind <= 68 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -39102,9 +39807,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: return true; } return false; @@ -39132,7 +39837,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -39154,7 +39859,8 @@ var ts; increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; function writeIndent() { if (lineStart) { @@ -39319,7 +40025,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 224 /* ImportSpecifier */ || location.parent.kind === 228 /* ExportSpecifier */) && + (location.parent.kind === 226 /* ImportSpecifier */ || location.parent.kind === 230 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -39347,7 +40053,12 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); + var standardScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); + var jsxScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); + /** + * Scanner that is currently used for formatting + */ + var scanner; var ScanAction; (function (ScanAction) { ScanAction[ScanAction["Scan"] = 0] = "Scan"; @@ -39357,6 +40068,8 @@ var ts; ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; })(ScanAction || (ScanAction = {})); function getFormattingScanner(sourceFile, startPos, endPos) { + ts.Debug.assert(scanner === undefined); + scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; scanner.setText(sourceFile.text); scanner.setTextPos(startPos); var wasNewLine = true; @@ -39371,11 +40084,14 @@ var ts; isOnToken: isOnToken, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; scanner.setText(undefined); + scanner = undefined; } }; function advance() { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; var isStarted = scanner.getStartPos() !== startPos; if (isStarted) { @@ -39419,10 +40135,10 @@ var ts; if (node) { switch (node.kind) { case 29 /* GreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanToken */: return true; } } @@ -39431,11 +40147,11 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 236 /* JsxAttribute */: - case 233 /* JsxOpeningElement */: - case 235 /* JsxClosingElement */: - case 232 /* JsxSelfClosingElement */: - return node.kind === 67 /* Identifier */; + case 238 /* JsxAttribute */: + case 235 /* JsxOpeningElement */: + case 237 /* JsxClosingElement */: + case 234 /* JsxSelfClosingElement */: + return node.kind === 69 /* Identifier */; } } return false; @@ -39448,9 +40164,10 @@ var ts; container.kind === 14 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 38 /* SlashToken */ || t === 59 /* SlashEqualsToken */; + return t === 39 /* SlashToken */ || t === 61 /* SlashEqualsToken */; } function readTokenInfo(n) { + ts.Debug.assert(scanner !== undefined); if (!isOnToken()) { // scanner is not on the token (either advance was not called yet or scanner is already past the end position) return { @@ -39500,7 +40217,7 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } - else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 67 /* Identifier */) { + else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 69 /* Identifier */) { currentToken = scanner.scanJsxIdentifier(); lastScanAction = 4 /* RescanJsxIdentifier */; } @@ -39544,6 +40261,7 @@ var ts; return fixTokenKind(lastTokenInfo, n); } function isOnToken() { + ts.Debug.assert(scanner !== undefined); var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); @@ -39822,17 +40540,17 @@ var ts; this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Space after }. this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 78 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 102 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); @@ -39844,10 +40562,10 @@ var ts; this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */, 71 /* ClassKeyword */]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 3 /* MultiLineCommentTrivia */, 73 /* ClassKeyword */]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 79 /* DoKeyword */, 100 /* TryKeyword */, 85 /* FinallyKeyword */, 80 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); @@ -39861,55 +40579,55 @@ var ts; // Prefix operators generally shouldn't have a space between // them and their target unary expression. this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */, 117 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 77 /* DoKeyword */, 78 /* ElseKeyword */, 69 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98 /* TryKeyword */, 83 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121 /* GetKeyword */, 127 /* SetKeyword */]), 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 129 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 127 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */, 130 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 129 /* SetKeyword */, 113 /* StaticKeyword */, 132 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); // generics and type assertions this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); @@ -39920,17 +40638,20 @@ var ts; // Remove spaces in empty interface literals. e.g.: x: {} this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 67 /* Identifier */, 80 /* ExportKeyword */, 75 /* DefaultKeyword */, 71 /* ClassKeyword */, 111 /* StaticKeyword */, 110 /* PublicKeyword */, 108 /* PrivateKeyword */, 109 /* ProtectedKeyword */, 121 /* GetKeyword */, 127 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 129 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // template string - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39957,8 +40678,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -40026,14 +40747,14 @@ var ts; this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space after function keyword for anonymous functions - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_30 in o) { - if (o[name_30] === rule) { - return name_30; + for (var name_31 in o) { + if (o[name_31] === rule) { + return name_31; } } throw new Error("Unknown rule"); @@ -40042,40 +40763,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 197 /* ForStatement */; + return context.contextNode.kind === 199 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 179 /* BinaryExpression */: - case 180 /* ConditionalExpression */: - case 187 /* AsExpression */: - case 148 /* TypePredicate */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: + case 181 /* BinaryExpression */: + case 182 /* ConditionalExpression */: + case 189 /* AsExpression */: + case 150 /* TypePredicate */: + case 158 /* UnionType */: + case 159 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 161 /* BindingElement */: + case 163 /* BindingElement */: // equals in type X = ... - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: // equal in p = 0; - case 136 /* Parameter */: - case 245 /* EnumMember */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - return context.currentTokenSpan.kind === 55 /* EqualsToken */ || context.nextTokenSpan.kind === 55 /* EqualsToken */; + case 138 /* Parameter */: + case 247 /* EnumMember */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 198 /* ForInStatement */: - return context.currentTokenSpan.kind === 88 /* InKeyword */ || context.nextTokenSpan.kind === 88 /* InKeyword */; + case 200 /* ForInStatement */: + return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 199 /* ForOfStatement */: - return context.currentTokenSpan.kind === 132 /* OfKeyword */ || context.nextTokenSpan.kind === 132 /* OfKeyword */; + case 201 /* ForOfStatement */: + return context.currentTokenSpan.kind === 134 /* OfKeyword */ || context.nextTokenSpan.kind === 134 /* OfKeyword */; } return false; }; @@ -40083,7 +40804,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 180 /* ConditionalExpression */; + return context.contextNode.kind === 182 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -40127,93 +40848,93 @@ var ts; return true; } switch (node.kind) { - case 190 /* Block */: - case 218 /* CaseBlock */: - case 163 /* ObjectLiteralExpression */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 220 /* CaseBlock */: + case 165 /* ObjectLiteralExpression */: + case 219 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 145 /* CallSignature */: - case 171 /* FunctionExpression */: - case 142 /* Constructor */: - case 172 /* ArrowFunction */: + case 147 /* CallSignature */: + case 173 /* FunctionExpression */: + case 144 /* Constructor */: + case 174 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 211 /* FunctionDeclaration */ || context.contextNode.kind === 171 /* FunctionExpression */; + return context.contextNode.kind === 213 /* FunctionDeclaration */ || context.contextNode.kind === 173 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 153 /* TypeLiteral */: - case 216 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 218 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 212 /* ClassDeclaration */: - case 216 /* ModuleDeclaration */: - case 215 /* EnumDeclaration */: - case 190 /* Block */: - case 242 /* CatchClause */: - case 217 /* ModuleBlock */: - case 204 /* SwitchStatement */: + case 214 /* ClassDeclaration */: + case 218 /* ModuleDeclaration */: + case 217 /* EnumDeclaration */: + case 192 /* Block */: + case 244 /* CatchClause */: + case 219 /* ModuleBlock */: + case 206 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 194 /* IfStatement */: - case 204 /* SwitchStatement */: - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: - case 207 /* TryStatement */: - case 195 /* DoStatement */: - case 203 /* WithStatement */: + case 196 /* IfStatement */: + case 206 /* SwitchStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 209 /* TryStatement */: + case 197 /* DoStatement */: + case 205 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 242 /* CatchClause */: + case 244 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 163 /* ObjectLiteralExpression */; + return context.contextNode.kind === 165 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 166 /* CallExpression */; + return context.contextNode.kind === 168 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 167 /* NewExpression */; + return context.contextNode.kind === 169 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -40221,6 +40942,9 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 174 /* ArrowFunction */; + }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); }; @@ -40237,41 +40961,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 137 /* Decorator */; + return node.kind === 139 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 210 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 212 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 216 /* ModuleDeclaration */; + return context.contextNode.kind === 218 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 153 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 155 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 149 /* TypeReference */: - case 169 /* TypeAssertionExpression */: - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 186 /* ExpressionWithTypeArguments */: + case 151 /* TypeReference */: + case 171 /* TypeAssertionExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 188 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -40282,13 +41006,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 169 /* TypeAssertionExpression */; + return context.contextNode.kind === 171 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 101 /* VoidKeyword */ && context.currentTokenParent.kind === 175 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 177 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 182 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 184 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -40312,7 +41036,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 132 /* LastToken */ + 1; + this.mapRowLength = 134 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -40507,7 +41231,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 132 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 134 /* LastToken */; token++) { result.push(token); } return result; @@ -40549,17 +41273,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(68 /* FirstKeyword */, 132 /* LastKeyword */); - TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 66 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88 /* InKeyword */, 89 /* InstanceOfKeyword */, 132 /* OfKeyword */, 114 /* AsKeyword */, 122 /* IsKeyword */]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40 /* PlusPlusToken */, 41 /* MinusMinusToken */, 49 /* TildeToken */, 48 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 67 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 134 /* LastKeyword */); + TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 134 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41 /* PlusPlusToken */, 42 /* MinusMinusToken */, 50 /* TildeToken */, 49 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 69 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([67 /* Identifier */, 126 /* NumberKeyword */, 128 /* StringKeyword */, 118 /* BooleanKeyword */, 129 /* SymbolKeyword */, 101 /* VoidKeyword */, 115 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 128 /* NumberKeyword */, 130 /* StringKeyword */, 120 /* BooleanKeyword */, 131 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -40773,17 +41497,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 190 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 246 /* SourceFile */: - case 190 /* Block */: - case 217 /* ModuleBlock */: + return body && body.kind === 192 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 248 /* SourceFile */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -40956,9 +41680,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 246 /* SourceFile */ || - parent.kind === 239 /* CaseClause */ || - parent.kind === 240 /* DefaultClause */) { + parent.kind === 248 /* SourceFile */ || + parent.kind === 241 /* CaseClause */ || + parent.kind === 242 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -40994,19 +41718,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 212 /* ClassDeclaration */: return 71 /* ClassKeyword */; - case 213 /* InterfaceDeclaration */: return 105 /* InterfaceKeyword */; - case 211 /* FunctionDeclaration */: return 85 /* FunctionKeyword */; - case 215 /* EnumDeclaration */: return 215 /* EnumDeclaration */; - case 143 /* GetAccessor */: return 121 /* GetKeyword */; - case 144 /* SetAccessor */: return 127 /* SetKeyword */; - case 141 /* MethodDeclaration */: + case 214 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 215 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 213 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 217 /* EnumDeclaration */: return 217 /* EnumDeclaration */; + case 145 /* GetAccessor */: return 123 /* GetKeyword */; + case 146 /* SetAccessor */: return 129 /* SetKeyword */; + case 143 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 139 /* PropertyDeclaration */: - case 136 /* Parameter */: + case 141 /* PropertyDeclaration */: + case 138 /* Parameter */: return node.name.kind; } } @@ -41040,9 +41764,9 @@ var ts; case 20 /* CloseBracketToken */: case 17 /* OpenParenToken */: case 18 /* CloseParenToken */: - case 78 /* ElseKeyword */: - case 102 /* WhileKeyword */: - case 54 /* AtToken */: + case 80 /* ElseKeyword */: + case 104 /* WhileKeyword */: + case 55 /* AtToken */: return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation @@ -41142,7 +41866,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 137 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 139 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -41399,8 +42123,8 @@ var ts; for (var line = line1; line < line2; ++line) { var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); var lineEndPosition = ts.getEndLinePosition(line, sourceFile); - // do not trim whitespaces in comments - if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + // do not trim whitespaces in comments or template expression + if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } var pos = lineEndPosition; @@ -41466,20 +42190,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 190 /* Block */: - case 217 /* ModuleBlock */: + case 192 /* Block */: + case 219 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 142 /* Constructor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 172 /* ArrowFunction */: + case 144 /* Constructor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 174 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -41487,8 +42211,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -41496,7 +42220,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 149 /* TypeReference */: + case 151 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -41580,22 +42304,39 @@ var ts; if (position > sourceFile.text.length) { return 0; // past EOF } + // no indentation when the indent style is set to none, + // so we can return fast + if (options.IndentStyle === ts.IndentStyle.None) { + return 0; + } var precedingToken = ts.findPrecedingToken(position, sourceFile); if (!precedingToken) { return 0; } // no indentation in string \regex\template literals - var precedingTokenIsLiteral = precedingToken.kind === 9 /* StringLiteral */ || - precedingToken.kind === 10 /* RegularExpressionLiteral */ || - precedingToken.kind === 11 /* NoSubstitutionTemplateLiteral */ || - precedingToken.kind === 12 /* TemplateHead */ || - precedingToken.kind === 13 /* TemplateMiddle */ || - precedingToken.kind === 14 /* TemplateTail */; + var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 179 /* BinaryExpression */) { + // indentation is first non-whitespace character in a previous line + // for block indentation, we should look for a line which contains something that's not + // whitespace. + if (options.IndentStyle === ts.IndentStyle.Block) { + // move backwards until we find a line with a non-whitespace character, + // then find the first non-whitespace character for that line. + var current_1 = position; + while (current_1 > 0) { + var char = sourceFile.text.charCodeAt(current_1); + if (!ts.isWhiteSpace(char) && !ts.isLineBreak(char)) { + break; + } + current_1--; + } + var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); + return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); + } + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 181 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -41714,7 +42455,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 246 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 248 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -41747,8 +42488,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 194 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 78 /* ElseKeyword */, sourceFile); + if (parent.kind === 196 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -41759,23 +42500,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 149 /* TypeReference */: + case 151 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 163 /* ObjectLiteralExpression */: + case 165 /* ObjectLiteralExpression */: return node.parent.properties; - case 162 /* ArrayLiteralExpression */: + case 164 /* ArrayLiteralExpression */: return node.parent.elements; - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: { + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -41786,8 +42527,8 @@ var ts; } break; } - case 167 /* NewExpression */: - case 166 /* CallExpression */: { + case 169 /* NewExpression */: + case 168 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -41817,8 +42558,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 166 /* CallExpression */ || - node.parent.kind === 167 /* NewExpression */) && + if (node.parent && (node.parent.kind === 168 /* CallExpression */ || + node.parent.kind === 169 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -41836,10 +42577,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 164 /* PropertyAccessExpression */: - case 165 /* ElementAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 166 /* PropertyAccessExpression */: + case 167 /* ElementAccessExpression */: node = node.expression; break; default: @@ -41904,42 +42645,43 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 162 /* ArrayLiteralExpression */: - case 190 /* Block */: - case 217 /* ModuleBlock */: - case 163 /* ObjectLiteralExpression */: - case 153 /* TypeLiteral */: - case 155 /* TupleType */: - case 218 /* CaseBlock */: - case 240 /* DefaultClause */: - case 239 /* CaseClause */: - case 170 /* ParenthesizedExpression */: - case 164 /* PropertyAccessExpression */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: - case 191 /* VariableStatement */: - case 209 /* VariableDeclaration */: - case 225 /* ExportAssignment */: - case 202 /* ReturnStatement */: - case 180 /* ConditionalExpression */: - case 160 /* ArrayBindingPattern */: - case 159 /* ObjectBindingPattern */: - case 231 /* JsxElement */: - case 232 /* JsxSelfClosingElement */: - case 140 /* MethodSignature */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 136 /* Parameter */: - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - case 158 /* ParenthesizedType */: - case 168 /* TaggedTemplateExpression */: - case 176 /* AwaitExpression */: + case 195 /* ExpressionStatement */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 164 /* ArrayLiteralExpression */: + case 192 /* Block */: + case 219 /* ModuleBlock */: + case 165 /* ObjectLiteralExpression */: + case 155 /* TypeLiteral */: + case 157 /* TupleType */: + case 220 /* CaseBlock */: + case 242 /* DefaultClause */: + case 241 /* CaseClause */: + case 172 /* ParenthesizedExpression */: + case 166 /* PropertyAccessExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: + case 193 /* VariableStatement */: + case 211 /* VariableDeclaration */: + case 227 /* ExportAssignment */: + case 204 /* ReturnStatement */: + case 182 /* ConditionalExpression */: + case 162 /* ArrayBindingPattern */: + case 161 /* ObjectBindingPattern */: + case 233 /* JsxElement */: + case 234 /* JsxSelfClosingElement */: + case 142 /* MethodSignature */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 138 /* Parameter */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 160 /* ParenthesizedType */: + case 170 /* TaggedTemplateExpression */: + case 178 /* AwaitExpression */: return true; } return false; @@ -41949,20 +42691,20 @@ var ts; return true; } switch (parent) { - case 195 /* DoStatement */: - case 196 /* WhileStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 197 /* ForStatement */: - case 194 /* IfStatement */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 141 /* MethodDeclaration */: - case 172 /* ArrowFunction */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - return child !== 190 /* Block */; + case 197 /* DoStatement */: + case 198 /* WhileStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 199 /* ForStatement */: + case 196 /* IfStatement */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 143 /* MethodDeclaration */: + case 174 /* ArrowFunction */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + return child !== 192 /* Block */; default: return false; } @@ -42104,7 +42846,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(269 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -42123,7 +42865,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 133 /* FirstNode */) { + if (this.kind >= 135 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -42170,7 +42912,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 133 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 135 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -42178,7 +42920,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 133 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 135 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -42227,7 +42969,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 136 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 138 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -42236,15 +42978,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 216 /* ModuleDeclaration */ && declaration.body.kind === 216 /* ModuleDeclaration */) { + if (declaration.kind === 218 /* ModuleDeclaration */ && declaration.body.kind === 218 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 216 /* ModuleDeclaration */ && declaration.parent.kind === 216 /* ModuleDeclaration */) { + while (declaration.kind === 218 /* ModuleDeclaration */ && declaration.parent.kind === 218 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -42588,9 +43330,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (declaration.name.kind === 136 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 164 /* PropertyAccessExpression */) { + if (expr.kind === 166 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -42600,7 +43342,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 /* Identifier */ || + if (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -42610,9 +43352,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -42632,60 +43374,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 215 /* EnumDeclaration */: - case 216 /* ModuleDeclaration */: - case 219 /* ImportEqualsDeclaration */: - case 228 /* ExportSpecifier */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 221 /* ImportClause */: - case 222 /* NamespaceImport */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 153 /* TypeLiteral */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 217 /* EnumDeclaration */: + case 218 /* ModuleDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 230 /* ExportSpecifier */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 223 /* ImportClause */: + case 224 /* NamespaceImport */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 155 /* TypeLiteral */: addDeclaration(node); // fall through - case 142 /* Constructor */: - case 191 /* VariableStatement */: - case 210 /* VariableDeclarationList */: - case 159 /* ObjectBindingPattern */: - case 160 /* ArrayBindingPattern */: - case 217 /* ModuleBlock */: + case 144 /* Constructor */: + case 193 /* VariableStatement */: + case 212 /* VariableDeclarationList */: + case 161 /* ObjectBindingPattern */: + case 162 /* ArrayBindingPattern */: + case 219 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 136 /* Parameter */: + case 138 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 245 /* EnumMember */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 247 /* EnumMember */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: addDeclaration(node); break; - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -42697,7 +43439,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -42724,6 +43466,12 @@ var ts; HighlightSpanKind.reference = "reference"; HighlightSpanKind.writtenReference = "writtenReference"; })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(ts.IndentStyle || (ts.IndentStyle = {})); + var IndentStyle = ts.IndentStyle; (function (SymbolDisplayPartKind) { SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; @@ -42901,16 +43649,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 171 /* FunctionExpression */) { + if (declaration.kind === 173 /* FunctionExpression */) { return true; } - if (declaration.kind !== 209 /* VariableDeclaration */ && declaration.kind !== 211 /* FunctionDeclaration */) { + if (declaration.kind !== 211 /* VariableDeclaration */ && declaration.kind !== 213 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { // Reached source file or module block - if (parent_8.kind === 246 /* SourceFile */ || parent_8.kind === 217 /* ModuleBlock */) { + if (parent_8.kind === 248 /* SourceFile */ || parent_8.kind === 219 /* ModuleBlock */) { return false; } } @@ -43047,8 +43795,8 @@ var ts; // We are not doing a full typecheck, we are not resolving the whole context, // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; - // Parse - var inputFileName = transpileOptions.fileName || "module.ts"; + // if jsx is specified then treat file as .tsx + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; @@ -43260,8 +44008,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -43295,9 +44044,207 @@ var ts; end: pos + importPath.length }); } - function processImport() { + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122 /* DeclareKeyword */) { + // declare module "mod" + token = scanner.scan(); + if (token === 125 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + else if (token === 24 /* CommaToken */) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + return true; + } + } + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 116 /* AsKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82 /* ExportKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17 /* OpenParenToken */) { + return true; + } + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // looks like define ("modname", ... - skip string literal and comma + token = scanner.scan(); + if (token === 24 /* CommaToken */) { + token = scanner.scan(); + } + else { + // unexpected token + return true; + } + } + // should be start of dependency list + if (token !== 19 /* OpenBracketToken */) { + return true; + } + // skip open bracket + token = scanner.scan(); + var i = 0; + // scan until ']' or EOF + while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + // record string literals as module names + if (token === 9 /* StringLiteral */) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { scanner.setText(sourceText); - var token = scanner.scan(); + scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -43309,152 +44256,26 @@ var ts; // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") - while (token !== 1 /* EndOfFileToken */) { - if (token === 120 /* DeclareKeyword */) { - // declare module "mod" - token = scanner.scan(); - if (token === 123 /* ModuleKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - recordAmbientExternalModule(); - continue; - } - } + // (for JavaScript files) require("mod") + while (true) { + if (scanner.getToken() === 1 /* EndOfFileToken */) { + break; } - else if (token === 87 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import "mod"; - recordModuleName(); - continue; - } - else { - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import d from "mod"; - recordModuleName(); - continue; - } - } - else if (token === 55 /* EqualsToken */) { - token = scanner.scan(); - if (token === 125 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import i = require("mod"); - recordModuleName(); - continue; - } - } - } - } - else if (token === 24 /* CommaToken */) { - // consume comma and keep going - token = scanner.scan(); - } - else { - // unknown syntax - continue; - } - } - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 114 /* AsKeyword */) { - token = scanner.scan(); - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + continue; } - else if (token === 80 /* ExportKeyword */) { - token = scanner.scan(); - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 131 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === 87 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 67 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 55 /* EqualsToken */) { - token = scanner.scan(); - if (token === 125 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export import i = require("mod"); - recordModuleName(); - } - } - } - } - } - } + else { + scanner.scan(); } - token = scanner.scan(); } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -43463,7 +44284,7 @@ var ts; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 205 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 207 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -43471,13 +44292,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 67 /* Identifier */ && - (node.parent.kind === 201 /* BreakStatement */ || node.parent.kind === 200 /* ContinueStatement */) && + return node.kind === 69 /* Identifier */ && + (node.parent.kind === 203 /* BreakStatement */ || node.parent.kind === 202 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 67 /* Identifier */ && - node.parent.kind === 205 /* LabeledStatement */ && + return node.kind === 69 /* Identifier */ && + node.parent.kind === 207 /* LabeledStatement */ && node.parent.label === node; } /** @@ -43485,7 +44306,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 205 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 207 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -43496,49 +44317,49 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 216 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 218 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 67 /* Identifier */ && + return node.kind === 69 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { - return (node.kind === 67 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 243 /* PropertyAssignment */ || node.parent.kind === 244 /* ShorthandPropertyAssignment */) && node.parent.name === node; + return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + (node.parent.kind === 245 /* PropertyAssignment */ || node.parent.kind === 246 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 245 /* EnumMember */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 216 /* ModuleDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 247 /* EnumMember */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 218 /* ModuleDeclaration */: return node.parent.name === node; - case 165 /* ElementAccessExpression */: + case 167 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -43597,7 +44418,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 68 /* FirstKeyword */; i <= 132 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 134 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -43612,17 +44433,17 @@ var ts; return undefined; } switch (node.kind) { - case 246 /* SourceFile */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 215 /* EnumDeclaration */: - case 216 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 218 /* ModuleDeclaration */: return node; } } @@ -43630,38 +44451,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 216 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 212 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 213 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 214 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 215 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 209 /* VariableDeclaration */: + case 218 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 214 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 215 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 216 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 217 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 211 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 211 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 143 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 144 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 213 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 145 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 146 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 147 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 146 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 145 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 142 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 135 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 245 /* EnumMember */: return ScriptElementKind.variableElement; - case 136 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 219 /* ImportEqualsDeclaration */: - case 224 /* ImportSpecifier */: - case 221 /* ImportClause */: - case 228 /* ExportSpecifier */: - case 222 /* NamespaceImport */: + case 149 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 148 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 147 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 247 /* EnumMember */: return ScriptElementKind.variableElement; + case 138 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 221 /* ImportEqualsDeclaration */: + case 226 /* ImportSpecifier */: + case 223 /* ImportClause */: + case 230 /* ExportSpecifier */: + case 224 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -43885,7 +44706,7 @@ var ts; // For JavaScript files, we don't want to report the normal typescript semantic errors. // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. @@ -43907,44 +44728,44 @@ var ts; return false; } switch (node.kind) { - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 241 /* HeritageClause */: + case 243 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 104 /* ImplementsKeyword */) { + if (heritageClause.token === 106 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214 /* TypeAliasDeclaration */: + case 216 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 211 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -43952,20 +44773,20 @@ var ts; return true; } break; - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 209 /* VariableDeclaration */: + case 211 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -43973,7 +44794,7 @@ var ts; return true; } break; - case 136 /* Parameter */: + case 138 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -43989,17 +44810,17 @@ var ts; return true; } break; - case 139 /* PropertyDeclaration */: + case 141 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 169 /* TypeAssertionExpression */: + case 171 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 137 /* Decorator */: + case 139 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -44025,18 +44846,18 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - case 120 /* DeclareKeyword */: + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 122 /* DeclareKeyword */: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; // These are all legal modifiers. - case 111 /* StaticKeyword */: - case 80 /* ExportKeyword */: - case 72 /* ConstKeyword */: - case 75 /* DefaultKeyword */: - case 113 /* AbstractKeyword */: + case 113 /* StaticKeyword */: + case 82 /* ExportKeyword */: + case 74 /* ConstKeyword */: + case 77 /* DefaultKeyword */: + case 115 /* AbstractKeyword */: } } } @@ -44097,7 +44918,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -44122,9 +44943,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 267 /* JSDocTypeTag */: - case 265 /* JSDocParameterTag */: - case 266 /* JSDocReturnTag */: + case 269 /* JSDocTypeTag */: + case 267 /* JSDocParameterTag */: + case 268 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -44161,6 +44982,7 @@ var ts; var node = currentToken; var isRightOfDot = false; var isRightOfOpenTag = false; + var isStartingCloseTag = false; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { // Bail out if this is a known invalid completion location @@ -44170,11 +44992,11 @@ var ts; } var parent_9 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_9.kind === 164 /* PropertyAccessExpression */) { + if (parent_9.kind === 166 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 133 /* QualifiedName */) { + else if (parent_9.kind === 135 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -44184,9 +45006,14 @@ var ts; return undefined; } } - else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { - isRightOfOpenTag = true; - location = contextToken; + else if (sourceFile.languageVariant === 1 /* JSX */) { + if (kind === 25 /* LessThanToken */) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) { + isStartingCloseTag = true; + } } } var semanticStart = new Date().getTime(); @@ -44207,6 +45034,12 @@ var ts; isMemberCompletion = true; isNewIdentifierLocation = false; } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + symbols = [typeChecker.getSymbolAtLocation(tagName)]; + isMemberCompletion = true; + isNewIdentifierLocation = false; + } else { // For JavaScript or TypeScript, if we're not after a dot, then just try to get the // global symbols in scope. These results should be valid for either language as @@ -44221,7 +45054,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -44277,7 +45110,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 232 /* JsxSelfClosingElement */) || (jsxContainer.kind === 233 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 234 /* JsxSelfClosingElement */) || (jsxContainer.kind === 235 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -44343,49 +45176,64 @@ var ts; var start = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || isSolelyIdentifierDefinitionLocation(contextToken) || - isDotOfNumericLiteral(contextToken); + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } + function isInJsxText(contextToken) { + if (contextToken.kind === 236 /* JsxText */) { + return true; + } + if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { + if (contextToken.parent.kind === 235 /* JsxOpeningElement */) { + return true; + } + if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */; + } + } + return false; + } function isNewIdentifierDefinitionLocation(previousToken) { if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 166 /* CallExpression */ // func( a, | - || containingNodeKind === 142 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 167 /* NewExpression */ // new C(a, | - || containingNodeKind === 162 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 179 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 150 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 168 /* CallExpression */ // func( a, | + || containingNodeKind === 144 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 169 /* NewExpression */ // new C(a, | + || containingNodeKind === 164 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 181 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 152 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 166 /* CallExpression */ // func( | - || containingNodeKind === 142 /* Constructor */ // constructor( | - || containingNodeKind === 167 /* NewExpression */ // new C(a| - || containingNodeKind === 170 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 158 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 168 /* CallExpression */ // func( | + || containingNodeKind === 144 /* Constructor */ // constructor( | + || containingNodeKind === 169 /* NewExpression */ // new C(a| + || containingNodeKind === 172 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 160 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 162 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 147 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 134 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 123 /* ModuleKeyword */: // module | - case 124 /* NamespaceKeyword */: + return containingNodeKind === 164 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 149 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 136 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 125 /* ModuleKeyword */: // module | + case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 216 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 218 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 212 /* ClassDeclaration */; // class A{ | - case 55 /* EqualsToken */: - return containingNodeKind === 209 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 179 /* BinaryExpression */; // x = a| + return containingNodeKind === 214 /* ClassDeclaration */; // class A{ | + case 56 /* EqualsToken */: + return containingNodeKind === 211 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 181 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 181 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 183 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 188 /* TemplateSpan */; // `aa ${10} dd ${| - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - return containingNodeKind === 139 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 190 /* TemplateSpan */; // `aa ${10} dd ${| + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + return containingNodeKind === 141 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -44428,14 +45276,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 163 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 165 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 159 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 161 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -44481,9 +45329,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 223 /* NamedImports */ ? - 220 /* ImportDeclaration */ : - 226 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 225 /* NamedImports */ ? + 222 /* ImportDeclaration */ : + 228 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -44509,7 +45357,7 @@ var ts; case 15 /* OpenBraceToken */: // let x = { | case 24 /* CommaToken */: var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 163 /* ObjectLiteralExpression */ || parent_10.kind === 159 /* ObjectBindingPattern */)) { + if (parent_10 && (parent_10.kind === 165 /* ObjectLiteralExpression */ || parent_10.kind === 161 /* ObjectBindingPattern */)) { return parent_10; } break; @@ -44527,8 +45375,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 223 /* NamedImports */: - case 227 /* NamedExports */: + case 225 /* NamedImports */: + case 229 /* NamedExports */: return contextToken.parent; } } @@ -44540,30 +45388,33 @@ var ts; var parent_11 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: - case 38 /* SlashToken */: - case 67 /* Identifier */: - case 236 /* JsxAttribute */: - case 237 /* JsxSpreadAttribute */: - if (parent_11 && (parent_11.kind === 232 /* JsxSelfClosingElement */ || parent_11.kind === 233 /* JsxOpeningElement */)) { + case 39 /* SlashToken */: + case 69 /* Identifier */: + case 238 /* JsxAttribute */: + case 239 /* JsxSpreadAttribute */: + if (parent_11 && (parent_11.kind === 234 /* JsxSelfClosingElement */ || parent_11.kind === 235 /* JsxOpeningElement */)) { return parent_11; } + else if (parent_11.kind === 238 /* JsxAttribute */) { + return parent_11.parent; + } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_11 && ((parent_11.kind === 236 /* JsxAttribute */) || (parent_11.kind === 237 /* JsxSpreadAttribute */))) { + if (parent_11 && ((parent_11.kind === 238 /* JsxAttribute */) || (parent_11.kind === 239 /* JsxSpreadAttribute */))) { return parent_11.parent; } break; case 16 /* CloseBraceToken */: if (parent_11 && - parent_11.kind === 238 /* JsxExpression */ && + parent_11.kind === 240 /* JsxExpression */ && parent_11.parent && - (parent_11.parent.kind === 236 /* JsxAttribute */)) { + (parent_11.parent.kind === 238 /* JsxAttribute */)) { return parent_11.parent.parent; } - if (parent_11 && parent_11.kind === 237 /* JsxSpreadAttribute */) { + if (parent_11 && parent_11.kind === 239 /* JsxSpreadAttribute */) { return parent_11.parent; } break; @@ -44573,16 +45424,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 145 /* CallSignature */: - case 146 /* ConstructSignature */: - case 147 /* IndexSignature */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: return true; } return false; @@ -44594,78 +45445,84 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 209 /* VariableDeclaration */ || - containingNodeKind === 210 /* VariableDeclarationList */ || - containingNodeKind === 191 /* VariableStatement */ || - containingNodeKind === 215 /* EnumDeclaration */ || + return containingNodeKind === 211 /* VariableDeclaration */ || + containingNodeKind === 212 /* VariableDeclarationList */ || + containingNodeKind === 193 /* VariableStatement */ || + containingNodeKind === 217 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 212 /* ClassDeclaration */ || - containingNodeKind === 184 /* ClassExpression */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 160 /* ArrayBindingPattern */ || - containingNodeKind === 214 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 214 /* ClassDeclaration */ || + containingNodeKind === 186 /* ClassExpression */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* ArrayBindingPattern */ || + containingNodeKind === 216 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 160 /* ArrayBindingPattern */; // var [.| - case 53 /* ColonToken */: - return containingNodeKind === 161 /* BindingElement */; // var {x :html| + return containingNodeKind === 162 /* ArrayBindingPattern */; // var [.| + case 54 /* ColonToken */: + return containingNodeKind === 163 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 160 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 162 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 242 /* CatchClause */ || + return containingNodeKind === 244 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 215 /* EnumDeclaration */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 153 /* TypeLiteral */; // let x : { | + return containingNodeKind === 217 /* EnumDeclaration */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 155 /* TypeLiteral */; // let x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 138 /* PropertySignature */ && + return containingNodeKind === 140 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 213 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 153 /* TypeLiteral */); // let x : { a; | + (contextToken.parent.parent.kind === 215 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 155 /* TypeLiteral */); // let x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 212 /* ClassDeclaration */ || - containingNodeKind === 184 /* ClassExpression */ || - containingNodeKind === 213 /* InterfaceDeclaration */ || - containingNodeKind === 214 /* TypeAliasDeclaration */ || + return containingNodeKind === 214 /* ClassDeclaration */ || + containingNodeKind === 186 /* ClassExpression */ || + containingNodeKind === 215 /* InterfaceDeclaration */ || + containingNodeKind === 216 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); - case 111 /* StaticKeyword */: - return containingNodeKind === 139 /* PropertyDeclaration */; + case 113 /* StaticKeyword */: + return containingNodeKind === 141 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 136 /* Parameter */ || + return containingNodeKind === 138 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 160 /* ArrayBindingPattern */); // var [...z| - case 110 /* PublicKeyword */: - case 108 /* PrivateKeyword */: - case 109 /* ProtectedKeyword */: - return containingNodeKind === 136 /* Parameter */; - case 114 /* AsKeyword */: - containingNodeKind === 224 /* ImportSpecifier */ || - containingNodeKind === 228 /* ExportSpecifier */ || - containingNodeKind === 222 /* NamespaceImport */; - case 71 /* ClassKeyword */: - case 79 /* EnumKeyword */: - case 105 /* InterfaceKeyword */: - case 85 /* FunctionKeyword */: - case 100 /* VarKeyword */: - case 121 /* GetKeyword */: - case 127 /* SetKeyword */: - case 87 /* ImportKeyword */: - case 106 /* LetKeyword */: - case 72 /* ConstKeyword */: - case 112 /* YieldKeyword */: - case 130 /* TypeKeyword */: + contextToken.parent.parent.kind === 162 /* ArrayBindingPattern */); // var [...z| + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + return containingNodeKind === 138 /* Parameter */; + case 116 /* AsKeyword */: + return containingNodeKind === 226 /* ImportSpecifier */ || + containingNodeKind === 230 /* ExportSpecifier */ || + containingNodeKind === 224 /* NamespaceImport */; + case 73 /* ClassKeyword */: + case 81 /* EnumKeyword */: + case 107 /* InterfaceKeyword */: + case 87 /* FunctionKeyword */: + case 102 /* VarKeyword */: + case 123 /* GetKeyword */: + case 129 /* SetKeyword */: + case 89 /* ImportKeyword */: + case 108 /* LetKeyword */: + case 74 /* ConstKeyword */: + case 114 /* YieldKeyword */: + case 132 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. switch (contextToken.getText()) { + case "abstract": + case "async": case "class": - case "interface": + case "const": + case "declare": case "enum": case "function": - case "var": - case "static": + case "interface": case "let": - case "const": + case "private": + case "protected": + case "public": + case "static": + case "var": case "yield": return true; } @@ -44695,8 +45552,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_31 = element.propertyName || element.name; - exisingImportsOrExports[name_31.text] = true; + var name_32 = element.propertyName || element.name; + exisingImportsOrExports[name_32.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -44717,9 +45574,9 @@ var ts; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 243 /* PropertyAssignment */ && - m.kind !== 244 /* ShorthandPropertyAssignment */ && - m.kind !== 161 /* BindingElement */) { + if (m.kind !== 245 /* PropertyAssignment */ && + m.kind !== 246 /* ShorthandPropertyAssignment */ && + m.kind !== 163 /* BindingElement */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -44727,7 +45584,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 161 /* BindingElement */ && m.propertyName) { + if (m.kind === 163 /* BindingElement */ && m.propertyName) { existingName = m.propertyName.text; } else { @@ -44754,7 +45611,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 236 /* JsxAttribute */) { + if (attr.kind === 238 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -44768,46 +45625,43 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_32 in nameTable) { - if (!allNames[name_32]) { - allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, /*performCharacterChecks:*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_33 in nameTable) { + if (!uniqueNames[name_33]) { + uniqueNames[name_33] = name_33; + var displayName = getCompletionEntryDisplayName(name_33, target, /*performCharacterChecks:*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -44845,25 +45699,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -44906,7 +45759,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -45008,7 +45861,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 164 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 166 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -45017,7 +45870,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 166 /* CallExpression */ || location.kind === 167 /* NewExpression */) { + if (location.kind === 168 /* CallExpression */ || location.kind === 169 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -45030,10 +45883,11 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 167 /* NewExpression */ || callExpression.expression.kind === 93 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 169 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); - if (!ts.contains(allSignatures, signature.target || signature)) { - // Get the first signature if there + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { + // Get the first signature if there is one -- allSignatures may contain + // either the original signature or its target, so check for either signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -45047,7 +45901,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -45063,10 +45917,10 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(53 /* ColonToken */)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536 /* Anonymous */)) { @@ -45082,24 +45936,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 119 /* ConstructorKeyword */ && location.parent.kind === 142 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 144 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 142 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 144 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 142 /* Constructor */) { + if (functionDeclaration.kind === 144 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -45108,7 +45962,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -45116,7 +45970,7 @@ var ts; } else { // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(71 /* ClassKeyword */)); + displayParts.push(ts.keywordPart(73 /* ClassKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -45124,37 +45978,37 @@ var ts; } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(105 /* InterfaceKeyword */)); + displayParts.push(ts.keywordPart(107 /* InterfaceKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384 /* Enum */) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(72 /* ConstKeyword */)); + displayParts.push(ts.keywordPart(74 /* ConstKeyword */)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(79 /* EnumKeyword */)); + displayParts.push(ts.keywordPart(81 /* EnumKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 216 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 67 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 124 /* NamespaceKeyword */ : 123 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 218 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -45166,7 +46020,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(88 /* InKeyword */)); + displayParts.push(ts.keywordPart(90 /* InKeyword */)); displayParts.push(ts.spacePart()); if (symbol.parent) { // Class/Interface type parameter @@ -45177,13 +46031,13 @@ var ts; // Method/function type parameter var container = ts.getContainingFunction(location); if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 146 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(90 /* NewKeyword */)); + if (signatureDeclaration.kind === 148 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 145 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 147 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -45192,8 +46046,8 @@ var ts; // Type aliash type parameter // For example // type list = T[]; // Both T will go through same code path - var declaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; - displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; + displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -45203,11 +46057,11 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 245 /* EnumMember */) { + if (declaration.kind === 247 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -45215,17 +46069,17 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(87 /* ImportKeyword */)); + displayParts.push(ts.keywordPart(89 /* ImportKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 219 /* ImportEqualsDeclaration */) { + if (declaration.kind === 221 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(125 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(127 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); @@ -45234,7 +46088,7 @@ var ts; var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55 /* EqualsToken */)); + displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -45251,7 +46105,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(53 /* ColonToken */)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { @@ -45351,11 +46205,11 @@ var ts; if (!symbol) { // Try getting just type at this position and show switch (node.kind) { - case 67 /* Identifier */: - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: - case 95 /* ThisKeyword */: - case 93 /* SuperKeyword */: + case 69 /* Identifier */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: + case 97 /* ThisKeyword */: + case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -45408,7 +46262,7 @@ var ts; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (isNewExpressionTarget(location) || location.kind === 119 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 121 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { // Find the first class-like declaration and try to get the construct signature. for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { @@ -45433,8 +46287,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 142 /* Constructor */) || - (!selectConstructors && (d.kind === 211 /* FunctionDeclaration */ || d.kind === 141 /* MethodDeclaration */ || d.kind === 140 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 144 /* Constructor */) || + (!selectConstructors && (d.kind === 213 /* FunctionDeclaration */ || d.kind === 143 /* MethodDeclaration */ || d.kind === 142 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -45494,7 +46348,7 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 67 /* Identifier */ && node.parent === declaration) { + if (node.kind === 69 /* Identifier */ && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -45503,7 +46357,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 244 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 246 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -45577,9 +46431,9 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 67 /* Identifier */ || - node.kind === 95 /* ThisKeyword */ || - node.kind === 93 /* SuperKeyword */ || + if (node.kind === 69 /* Identifier */ || + node.kind === 97 /* ThisKeyword */ || + node.kind === 95 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); @@ -45630,77 +46484,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 86 /* IfKeyword */: - case 78 /* ElseKeyword */: - if (hasKind(node.parent, 194 /* IfStatement */)) { + case 88 /* IfKeyword */: + case 80 /* ElseKeyword */: + if (hasKind(node.parent, 196 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; - case 92 /* ReturnKeyword */: - if (hasKind(node.parent, 202 /* ReturnStatement */)) { + case 94 /* ReturnKeyword */: + if (hasKind(node.parent, 204 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; - case 96 /* ThrowKeyword */: - if (hasKind(node.parent, 206 /* ThrowStatement */)) { + case 98 /* ThrowKeyword */: + if (hasKind(node.parent, 208 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; - case 70 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 207 /* TryStatement */)) { + case 72 /* CatchKeyword */: + if (hasKind(parent(parent(node)), 209 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 98 /* TryKeyword */: - case 83 /* FinallyKeyword */: - if (hasKind(parent(node), 207 /* TryStatement */)) { + case 100 /* TryKeyword */: + case 85 /* FinallyKeyword */: + if (hasKind(parent(node), 209 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; - case 94 /* SwitchKeyword */: - if (hasKind(node.parent, 204 /* SwitchStatement */)) { + case 96 /* SwitchKeyword */: + if (hasKind(node.parent, 206 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 69 /* CaseKeyword */: - case 75 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 204 /* SwitchStatement */)) { + case 71 /* CaseKeyword */: + case 77 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 206 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 68 /* BreakKeyword */: - case 73 /* ContinueKeyword */: - if (hasKind(node.parent, 201 /* BreakStatement */) || hasKind(node.parent, 200 /* ContinueStatement */)) { + case 70 /* BreakKeyword */: + case 75 /* ContinueKeyword */: + if (hasKind(node.parent, 203 /* BreakStatement */) || hasKind(node.parent, 202 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 84 /* ForKeyword */: - if (hasKind(node.parent, 197 /* ForStatement */) || - hasKind(node.parent, 198 /* ForInStatement */) || - hasKind(node.parent, 199 /* ForOfStatement */)) { + case 86 /* ForKeyword */: + if (hasKind(node.parent, 199 /* ForStatement */) || + hasKind(node.parent, 200 /* ForInStatement */) || + hasKind(node.parent, 201 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 102 /* WhileKeyword */: - case 77 /* DoKeyword */: - if (hasKind(node.parent, 196 /* WhileStatement */) || hasKind(node.parent, 195 /* DoStatement */)) { + case 104 /* WhileKeyword */: + case 79 /* DoKeyword */: + if (hasKind(node.parent, 198 /* WhileStatement */) || hasKind(node.parent, 197 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 119 /* ConstructorKeyword */: - if (hasKind(node.parent, 142 /* Constructor */)) { + case 121 /* ConstructorKeyword */: + if (hasKind(node.parent, 144 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; - case 121 /* GetKeyword */: - case 127 /* SetKeyword */: - if (hasKind(node.parent, 143 /* GetAccessor */) || hasKind(node.parent, 144 /* SetAccessor */)) { + case 123 /* GetKeyword */: + case 129 /* SetKeyword */: + if (hasKind(node.parent, 145 /* GetAccessor */) || hasKind(node.parent, 146 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 191 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 193 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -45716,10 +46570,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 206 /* ThrowStatement */) { + if (node.kind === 208 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 207 /* TryStatement */) { + else if (node.kind === 209 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -45748,12 +46602,12 @@ var ts; var child = throwStatement; while (child.parent) { var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246 /* SourceFile */) { + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248 /* SourceFile */) { return parent_12; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_12.kind === 207 /* TryStatement */) { + if (parent_12.kind === 209 /* TryStatement */) { var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -45768,7 +46622,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 201 /* BreakStatement */ || node.kind === 200 /* ContinueStatement */) { + if (node.kind === 203 /* BreakStatement */ || node.kind === 202 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -45784,16 +46638,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 204 /* SwitchStatement */: - if (statement.kind === 200 /* ContinueStatement */) { + case 206 /* SwitchStatement */: + if (statement.kind === 202 /* ContinueStatement */) { continue; } // Fall through. - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 196 /* WhileStatement */: - case 195 /* DoStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 197 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -45812,24 +46666,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 212 /* ClassDeclaration */ || - container.kind === 184 /* ClassExpression */ || - (declaration.kind === 136 /* Parameter */ && hasKind(container, 142 /* Constructor */)))) { + if (!(container.kind === 214 /* ClassDeclaration */ || + container.kind === 186 /* ClassExpression */ || + (declaration.kind === 138 /* Parameter */ && hasKind(container, 144 /* Constructor */)))) { return undefined; } } - else if (modifier === 111 /* StaticKeyword */) { - if (!(container.kind === 212 /* ClassDeclaration */ || container.kind === 184 /* ClassExpression */)) { + else if (modifier === 113 /* StaticKeyword */) { + if (!(container.kind === 214 /* ClassDeclaration */ || container.kind === 186 /* ClassExpression */)) { return undefined; } } - else if (modifier === 80 /* ExportKeyword */ || modifier === 120 /* DeclareKeyword */) { - if (!(container.kind === 217 /* ModuleBlock */ || container.kind === 246 /* SourceFile */)) { + else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { + if (!(container.kind === 219 /* ModuleBlock */ || container.kind === 248 /* SourceFile */)) { return undefined; } } - else if (modifier === 113 /* AbstractKeyword */) { - if (!(container.kind === 212 /* ClassDeclaration */ || declaration.kind === 212 /* ClassDeclaration */)) { + else if (modifier === 115 /* AbstractKeyword */) { + if (!(container.kind === 214 /* ClassDeclaration */ || declaration.kind === 214 /* ClassDeclaration */)) { return undefined; } } @@ -45841,8 +46695,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 217 /* ModuleBlock */: - case 246 /* SourceFile */: + case 219 /* ModuleBlock */: + case 248 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 256 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -45851,17 +46705,17 @@ var ts; nodes = container.statements; } break; - case 142 /* Constructor */: + case 144 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 212 /* ClassDeclaration */: - case 184 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 142 /* Constructor */ && member; + return member.kind === 144 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -45882,19 +46736,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 110 /* PublicKeyword */: + case 112 /* PublicKeyword */: return 16 /* Public */; - case 108 /* PrivateKeyword */: + case 110 /* PrivateKeyword */: return 32 /* Private */; - case 109 /* ProtectedKeyword */: + case 111 /* ProtectedKeyword */: return 64 /* Protected */; - case 111 /* StaticKeyword */: + case 113 /* StaticKeyword */: return 128 /* Static */; - case 80 /* ExportKeyword */: + case 82 /* ExportKeyword */: return 1 /* Export */; - case 120 /* DeclareKeyword */: + case 122 /* DeclareKeyword */: return 2 /* Ambient */; - case 113 /* AbstractKeyword */: + case 115 /* AbstractKeyword */: return 256 /* Abstract */; default: ts.Debug.fail(); @@ -45914,13 +46768,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 144 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 145 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 146 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121 /* GetKeyword */, 127 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 129 /* SetKeyword */); }); } } } @@ -45929,19 +46783,19 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 119 /* ConstructorKeyword */); + return pushKeywordIf(keywords, token, 121 /* ConstructorKeyword */); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84 /* ForKeyword */, 102 /* WhileKeyword */, 77 /* DoKeyword */)) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86 /* ForKeyword */, 104 /* WhileKeyword */, 79 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 195 /* DoStatement */) { + if (loopNode.kind === 197 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 102 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { break; } } @@ -45950,7 +46804,7 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */, 73 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */, 75 /* ContinueKeyword */); } }); return ts.map(keywords, getHighlightSpanForNode); @@ -45959,13 +46813,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 197 /* ForStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: - case 195 /* DoStatement */: - case 196 /* WhileStatement */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 197 /* DoStatement */: + case 198 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -45973,14 +46827,14 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 94 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 96 /* SwitchKeyword */); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 69 /* CaseKeyword */, 75 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 71 /* CaseKeyword */, 77 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */); } }); }); @@ -45988,13 +46842,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 98 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 100 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 83 /* FinallyKeyword */); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 85 /* FinallyKeyword */); } return ts.map(keywords, getHighlightSpanForNode); } @@ -46005,13 +46859,13 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); }); // If the "owner" is a function, then we equate 'return' and 'throw' statements in their // ability to "jump out" of the function, and include occurrences for both. if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); }); } return ts.map(keywords, getHighlightSpanForNode); @@ -46019,36 +46873,36 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 190 /* Block */))) { + if (!(func && hasKind(func.body, 192 /* Block */))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); }); // Include 'throw' statements that do not occur within a try block. ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 194 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 196 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 86 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 88 /* IfKeyword */); // Generally the 'else' keyword is second-to-last, so we traverse backwards. for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 78 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 80 /* ElseKeyword */)) { break; } } - if (!hasKind(ifStatement.elseStatement, 194 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 196 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -46057,7 +46911,7 @@ var ts; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 78 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 80 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. var shouldCombindElseAndIf = true; @@ -46139,7 +46993,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 67 /* Identifier */ && + if (node.kind !== 69 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. //node.kind !== SyntaxKind.ThisKeyword && //node.kind !== SyntaxKind.SuperKeyword && @@ -46147,7 +47001,7 @@ var ts; !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -46165,10 +47019,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 95 /* ThisKeyword */) { + if (node.kind === 97 /* ThisKeyword */) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 93 /* SuperKeyword */) { + if (node.kind === 95 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -46228,7 +47082,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 228 /* ExportSpecifier */; + return declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 230 /* ExportSpecifier */; }); } function getInternedName(symbol, location, declarations) { @@ -46255,14 +47109,14 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 171 /* FunctionExpression */ || valueDeclaration.kind === 184 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 173 /* FunctionExpression */ || valueDeclaration.kind === 186 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 212 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -46288,7 +47142,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -46359,7 +47213,7 @@ var ts; if (node) { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: return node.getWidth() === searchSymbolName.length; case 9 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || @@ -46461,13 +47315,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -46480,7 +47334,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 93 /* SuperKeyword */) { + if (!node || node.kind !== 95 /* SuperKeyword */) { return; } var container = ts.getSuperContainer(node, /*includeFunctions*/ false); @@ -46499,27 +47353,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 246 /* SourceFile */: + case 248 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -46528,7 +47382,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 246 /* SourceFile */) { + if (searchSpaceNode.kind === 248 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -46554,33 +47408,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 95 /* ThisKeyword */) { + if (!node || node.kind !== 97 /* ThisKeyword */) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 184 /* ClassExpression */: - case 212 /* ClassDeclaration */: + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 246 /* SourceFile */: - if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { + case 248 /* SourceFile */: + if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -46634,11 +47488,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 212 /* ClassDeclaration */) { + if (declaration.kind === 214 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 213 /* InterfaceDeclaration */) { + else if (declaration.kind === 215 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -46699,19 +47553,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_33 = node.text; + var name_34 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_33); + var unionProperty = contextualType.getProperty(name_34); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_33); + var symbol = t.getProperty(name_34); if (symbol) { result_4.push(symbol); } @@ -46720,7 +47574,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_33); + var symbol_1 = contextualType.getProperty(name_34); if (symbol_1) { return [symbol_1]; } @@ -46773,17 +47627,17 @@ var ts; } /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node) { - if (node.kind === 67 /* Identifier */ && ts.isDeclarationName(node)) { + if (node.kind === 69 /* Identifier */ && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 178 /* PostfixUnaryExpression */ || parent.kind === 177 /* PrefixUnaryExpression */) { + if (parent.kind === 180 /* PostfixUnaryExpression */ || parent.kind === 179 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 179 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 181 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; - return 55 /* FirstAssignment */ <= operator && operator <= 66 /* LastAssignment */; + return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } } return false; @@ -46815,33 +47669,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 136 /* Parameter */: - case 209 /* VariableDeclaration */: - case 161 /* BindingElement */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: - case 243 /* PropertyAssignment */: - case 244 /* ShorthandPropertyAssignment */: - case 245 /* EnumMember */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 142 /* Constructor */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 211 /* FunctionDeclaration */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: - case 242 /* CatchClause */: + case 138 /* Parameter */: + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: + case 247 /* EnumMember */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 244 /* CatchClause */: return 1 /* Value */; - case 135 /* TypeParameter */: - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: - case 153 /* TypeLiteral */: + case 137 /* TypeParameter */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: + case 155 /* TypeLiteral */: return 2 /* Type */; - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (node.name.kind === 9 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } @@ -46851,15 +47705,15 @@ var ts; else { return 4 /* Namespace */; } - case 223 /* NamedImports */: - case 224 /* ImportSpecifier */: - case 219 /* ImportEqualsDeclaration */: - case 220 /* ImportDeclaration */: - case 225 /* ExportAssignment */: - case 226 /* ExportDeclaration */: + case 225 /* NamedImports */: + case 226 /* ImportSpecifier */: + case 221 /* ImportEqualsDeclaration */: + case 222 /* ImportDeclaration */: + case 227 /* ExportAssignment */: + case 228 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 246 /* SourceFile */: + case 248 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -46869,8 +47723,9 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 149 /* TypeReference */ || - (node.parent.kind === 186 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 151 /* TypeReference */ || + (node.parent.kind === 188 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -46878,50 +47733,50 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 164 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 164 /* PropertyAccessExpression */) { + if (root.parent.kind === 166 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 166 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 186 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 241 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 188 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 243 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 212 /* ClassDeclaration */ && root.parent.parent.token === 104 /* ImplementsKeyword */) || - (decl.kind === 213 /* InterfaceDeclaration */ && root.parent.parent.token === 81 /* ExtendsKeyword */); + return (decl.kind === 214 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 215 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 133 /* QualifiedName */) { - while (root.parent && root.parent.kind === 133 /* QualifiedName */) { + if (root.parent.kind === 135 /* QualifiedName */) { + while (root.parent && root.parent.kind === 135 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 149 /* TypeReference */ && !isLastClause; + return root.parent.kind === 151 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 133 /* QualifiedName */) { + while (node.parent.kind === 135 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 67 /* Identifier */); + ts.Debug.assert(node.kind === 69 /* Identifier */); // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 133 /* QualifiedName */ && + if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 219 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 221 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 225 /* ExportAssignment */) { + if (node.parent.kind === 227 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -46961,15 +47816,15 @@ var ts; return; } switch (node.kind) { - case 164 /* PropertyAccessExpression */: - case 133 /* QualifiedName */: + case 166 /* PropertyAccessExpression */: + case 135 /* QualifiedName */: case 9 /* StringLiteral */: - case 82 /* FalseKeyword */: - case 97 /* TrueKeyword */: - case 91 /* NullKeyword */: - case 93 /* SuperKeyword */: - case 95 /* ThisKeyword */: - case 67 /* Identifier */: + case 84 /* FalseKeyword */: + case 99 /* TrueKeyword */: + case 93 /* NullKeyword */: + case 95 /* SuperKeyword */: + case 97 /* ThisKeyword */: + case 69 /* Identifier */: break; // Cant create the text span default: @@ -46985,7 +47840,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 216 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 218 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -47026,10 +47881,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 216 /* ModuleDeclaration */: - case 212 /* ClassDeclaration */: - case 213 /* InterfaceDeclaration */: - case 211 /* FunctionDeclaration */: + case 218 /* ModuleDeclaration */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 213 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -47083,7 +47938,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 216 /* ModuleDeclaration */ && + return declaration.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -47093,7 +47948,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 67 /* Identifier */ && !ts.nodeIsMissing(node)) { + if (kind === 69 /* Identifier */ && !ts.nodeIsMissing(node)) { var identifier = node; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run @@ -47238,16 +48093,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 265 /* JSDocParameterTag */: + case 267 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 268 /* JSDocTemplateTag */: + case 270 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 267 /* JSDocTypeTag */: + case 269 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 266 /* JSDocReturnTag */: + case 268 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -47336,18 +48191,18 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 55 /* EqualsToken */) { + if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 209 /* VariableDeclaration */ || - token.parent.kind === 139 /* PropertyDeclaration */ || - token.parent.kind === 136 /* Parameter */) { + if (token.parent.kind === 211 /* VariableDeclaration */ || + token.parent.kind === 141 /* PropertyDeclaration */ || + token.parent.kind === 138 /* Parameter */) { return 5 /* operator */; } } - if (token.parent.kind === 179 /* BinaryExpression */ || - token.parent.kind === 177 /* PrefixUnaryExpression */ || - token.parent.kind === 178 /* PostfixUnaryExpression */ || - token.parent.kind === 180 /* ConditionalExpression */) { + if (token.parent.kind === 181 /* BinaryExpression */ || + token.parent.kind === 179 /* PrefixUnaryExpression */ || + token.parent.kind === 180 /* PostfixUnaryExpression */ || + token.parent.kind === 182 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -47367,35 +48222,35 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 67 /* Identifier */) { + else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 135 /* TypeParameter */: + case 137 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 213 /* InterfaceDeclaration */: + case 215 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 136 /* Parameter */: + case 138 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -47507,8 +48362,12 @@ var ts; * Checks if position points to a valid position to add JSDoc comments, and if so, * returns the appropriate template. Otherwise returns an empty string. * Valid positions are - * - outside of comments, statements, and expressions, and - * - preceding a function declaration. + * - outside of comments, statements, and expressions, and + * - preceding a: + * - function/constructor/method declaration + * - class declarations + * - variable statements + * - namespace declarations * * Hosts should ideally check that: * - The line is all whitespace up to 'position' before performing the insertion. @@ -47532,23 +48391,48 @@ var ts; return undefined; } // TODO: add support for: - // - methods - // - constructors - // - class decls - var containingFunction = ts.getAncestor(tokenAtPos, 211 /* FunctionDeclaration */); - if (!containingFunction || containingFunction.getStart() < position) { + // - enums/enum members + // - interfaces + // - property declarations + // - potentially property assignments + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 144 /* Constructor */: + case 214 /* ClassDeclaration */: + case 193 /* VariableStatement */: + break findOwner; + case 248 /* SourceFile */: + return undefined; + case 218 /* ModuleDeclaration */: + // If in walking up the tree, we hit a a nested namespace declaration, + // then we must be somewhere within a dotted namespace name; however we don't + // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. + if (commentOwner.parent.kind === 218 /* ModuleDeclaration */) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { return undefined; } - var parameters = containingFunction.parameters; + var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); // TODO: call a helper method instead once PR #4133 gets merged in. var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; - var docParams = parameters.reduce(function (prev, cur, index) { - return prev + - indentationStr + " * @param " + (cur.name.kind === 67 /* Identifier */ ? cur.name.text : "param" + index) + newLine; - }, ""); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 69 /* Identifier */ ? + currentName.text : + "param" + i; + docParams += indentationStr + " * @param " + paramName + newLine; + } // A doc comment consists of the following // * The opening comment line // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) @@ -47564,6 +48448,46 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 193 /* VariableStatement */) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return emptyArray; + } + /** + * Digs into an an initializer or RHS operand of an assignment operation + * to get the parameters of an apt signature corresponding to a + * function expression or a class expression. + * + * @param rightHandSide the expression which may contain an appropriate set of parameters + * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. + */ + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 172 /* ParenthesizedExpression */) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + return rightHandSide.parameters; + case 186 /* ClassExpression */: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 144 /* Constructor */) { + return member.parameters; + } + } + break; + } + return emptyArray; + } function getTodoComments(fileName, descriptors) { // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call @@ -47694,7 +48618,7 @@ var ts; var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 67 /* Identifier */) { + if (node && node.kind === 69 /* Identifier */) { var symbol = typeChecker.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol) { @@ -47795,7 +48719,7 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 67 /* Identifier */: + case 69 /* Identifier */: nameTable[node.text] = node.text; break; case 9 /* StringLiteral */: @@ -47805,7 +48729,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 230 /* ExternalModuleReference */ || + node.parent.kind === 232 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -47818,7 +48742,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 165 /* ElementAccessExpression */ && + node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -47829,18 +48753,18 @@ var ts; /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. var noRegexTable = []; - noRegexTable[67 /* Identifier */] = true; + noRegexTable[69 /* Identifier */] = true; noRegexTable[9 /* StringLiteral */] = true; noRegexTable[8 /* NumericLiteral */] = true; noRegexTable[10 /* RegularExpressionLiteral */] = true; - noRegexTable[95 /* ThisKeyword */] = true; - noRegexTable[40 /* PlusPlusToken */] = true; - noRegexTable[41 /* MinusMinusToken */] = true; + noRegexTable[97 /* ThisKeyword */] = true; + noRegexTable[41 /* PlusPlusToken */] = true; + noRegexTable[42 /* MinusMinusToken */] = true; noRegexTable[18 /* CloseParenToken */] = true; noRegexTable[20 /* CloseBracketToken */] = true; noRegexTable[16 /* CloseBraceToken */] = true; - noRegexTable[97 /* TrueKeyword */] = true; - noRegexTable[82 /* FalseKeyword */] = true; + noRegexTable[99 /* TrueKeyword */] = true; + noRegexTable[84 /* FalseKeyword */] = true; // Just a stack of TemplateHeads and OpenCurlyBraces, used to perform rudimentary (inexact) // classification on template strings. Because of the context free nature of templates, // the only precise way to classify a template portion would be by propagating the stack across @@ -47865,10 +48789,10 @@ var ts; /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 121 /* GetKeyword */ || - keyword2 === 127 /* SetKeyword */ || - keyword2 === 119 /* ConstructorKeyword */ || - keyword2 === 111 /* StaticKeyword */) { + if (keyword2 === 123 /* GetKeyword */ || + keyword2 === 129 /* SetKeyword */ || + keyword2 === 121 /* ConstructorKeyword */ || + keyword2 === 113 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; @@ -47998,22 +48922,22 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if ((token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { if (scanner.reScanSlashToken() === 10 /* RegularExpressionLiteral */) { token = 10 /* RegularExpressionLiteral */; } } else if (lastNonTriviaToken === 21 /* DotToken */ && isKeyword(token)) { - token = 67 /* Identifier */; + token = 69 /* Identifier */; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { // We have two keywords in a row. Only treat the second as a keyword if // it's a sequence that could legally occur in the language. Otherwise // treat it as an identifier. This way, if someone writes "private var" // we recognize that 'var' is actually an identifier here. - token = 67 /* Identifier */; + token = 69 /* Identifier */; } - else if (lastNonTriviaToken === 67 /* Identifier */ && + else if (lastNonTriviaToken === 69 /* Identifier */ && token === 25 /* LessThanToken */) { // Could be the start of something generic. Keep track of that by bumping // up the current count of generic contexts we may be in. @@ -48024,16 +48948,16 @@ var ts; // generic entity is complete. angleBracketStack--; } - else if (token === 115 /* AnyKeyword */ || - token === 128 /* StringKeyword */ || - token === 126 /* NumberKeyword */ || - token === 118 /* BooleanKeyword */ || - token === 129 /* SymbolKeyword */) { + else if (token === 117 /* AnyKeyword */ || + token === 130 /* StringKeyword */ || + token === 128 /* NumberKeyword */ || + token === 120 /* BooleanKeyword */ || + token === 131 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, // causing a noisy experience for the user. - token = 67 /* Identifier */; + token = 69 /* Identifier */; } } else if (token === 12 /* TemplateHead */) { @@ -48145,40 +49069,41 @@ var ts; function isBinaryExpressionOperatorToken(token) { switch (token) { case 37 /* AsteriskToken */: - case 38 /* SlashToken */: - case 39 /* PercentToken */: + case 39 /* SlashToken */: + case 40 /* PercentToken */: case 35 /* PlusToken */: case 36 /* MinusToken */: - case 42 /* LessThanLessThanToken */: - case 43 /* GreaterThanGreaterThanToken */: - case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* LessThanLessThanToken */: + case 44 /* GreaterThanGreaterThanToken */: + case 45 /* GreaterThanGreaterThanGreaterThanToken */: case 25 /* LessThanToken */: case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - case 89 /* InstanceOfKeyword */: - case 88 /* InKeyword */: + case 91 /* InstanceOfKeyword */: + case 90 /* InKeyword */: + case 116 /* AsKeyword */: case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - case 45 /* AmpersandToken */: - case 47 /* CaretToken */: - case 46 /* BarToken */: - case 50 /* AmpersandAmpersandToken */: - case 51 /* BarBarToken */: - case 65 /* BarEqualsToken */: - case 64 /* AmpersandEqualsToken */: - case 66 /* CaretEqualsToken */: - case 61 /* LessThanLessThanEqualsToken */: - case 62 /* GreaterThanGreaterThanEqualsToken */: - case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 56 /* PlusEqualsToken */: - case 57 /* MinusEqualsToken */: - case 58 /* AsteriskEqualsToken */: - case 59 /* SlashEqualsToken */: - case 60 /* PercentEqualsToken */: - case 55 /* EqualsToken */: + case 46 /* AmpersandToken */: + case 48 /* CaretToken */: + case 47 /* BarToken */: + case 51 /* AmpersandAmpersandToken */: + case 52 /* BarBarToken */: + case 67 /* BarEqualsToken */: + case 66 /* AmpersandEqualsToken */: + case 68 /* CaretEqualsToken */: + case 63 /* LessThanLessThanEqualsToken */: + case 64 /* GreaterThanGreaterThanEqualsToken */: + case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 57 /* PlusEqualsToken */: + case 58 /* MinusEqualsToken */: + case 59 /* AsteriskEqualsToken */: + case 61 /* SlashEqualsToken */: + case 62 /* PercentEqualsToken */: + case 56 /* EqualsToken */: case 24 /* CommaToken */: return true; default: @@ -48189,17 +49114,17 @@ var ts; switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: - case 49 /* TildeToken */: - case 48 /* ExclamationToken */: - case 40 /* PlusPlusToken */: - case 41 /* MinusMinusToken */: + case 50 /* TildeToken */: + case 49 /* ExclamationToken */: + case 41 /* PlusPlusToken */: + case 42 /* MinusMinusToken */: return true; default: return false; } } function isKeyword(token) { - return token >= 68 /* FirstKeyword */ && token <= 132 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 134 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -48208,7 +49133,7 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; } - else if (token >= 15 /* FirstPunctuation */ && token <= 66 /* LastPunctuation */) { + else if (token >= 15 /* FirstPunctuation */ && token <= 68 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { @@ -48225,7 +49150,7 @@ var ts; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 67 /* Identifier */: + case 69 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -48257,7 +49182,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 246 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 248 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -48327,125 +49252,125 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 197 /* ForStatement */) { + if (node.parent.kind === 199 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 179 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { + if (node.parent.kind === 181 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node) { + if (node.parent.kind === 174 /* ArrowFunction */ && node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 191 /* VariableStatement */: + case 193 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 209 /* VariableDeclaration */: - case 139 /* PropertyDeclaration */: - case 138 /* PropertySignature */: + case 211 /* VariableDeclaration */: + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: return spanInVariableDeclaration(node); - case 136 /* Parameter */: + case 138 /* Parameter */: return spanInParameterDeclaration(node); - case 211 /* FunctionDeclaration */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 171 /* FunctionExpression */: - case 172 /* ArrowFunction */: + case 213 /* FunctionDeclaration */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 217 /* ModuleBlock */: + case 219 /* ModuleBlock */: return spanInBlock(node); - case 242 /* CatchClause */: + case 244 /* CatchClause */: return spanInBlock(node.block); - case 193 /* ExpressionStatement */: + case 195 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 202 /* ReturnStatement */: + case 204 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 196 /* WhileStatement */: + case 198 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 195 /* DoStatement */: + case 197 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 208 /* DebuggerStatement */: + case 210 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 194 /* IfStatement */: + case 196 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 205 /* LabeledStatement */: + case 207 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 201 /* BreakStatement */: - case 200 /* ContinueStatement */: + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 197 /* ForStatement */: + case 199 /* ForStatement */: return spanInForStatement(node); - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 204 /* SwitchStatement */: + case 206 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 239 /* CaseClause */: - case 240 /* DefaultClause */: + case 241 /* CaseClause */: + case 242 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 207 /* TryStatement */: + case 209 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 206 /* ThrowStatement */: + case 208 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 225 /* ExportAssignment */: + case 227 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 220 /* ImportDeclaration */: + case 222 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 226 /* ExportDeclaration */: + case 228 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 212 /* ClassDeclaration */: - case 215 /* EnumDeclaration */: - case 245 /* EnumMember */: - case 166 /* CallExpression */: - case 167 /* NewExpression */: + case 214 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 247 /* EnumMember */: + case 168 /* CallExpression */: + case 169 /* NewExpression */: // span on complete node return textSpan(node); - case 203 /* WithStatement */: + case 205 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 213 /* InterfaceDeclaration */: - case 214 /* TypeAliasDeclaration */: + case 215 /* InterfaceDeclaration */: + case 216 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -48461,25 +49386,25 @@ var ts; return spanInOpenParenToken(node); case 18 /* CloseParenToken */: return spanInCloseParenToken(node); - case 53 /* ColonToken */: + case 54 /* ColonToken */: return spanInColonToken(node); case 27 /* GreaterThanToken */: case 25 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 102 /* WhileKeyword */: + case 104 /* WhileKeyword */: return spanInWhileKeyword(node); - case 78 /* ElseKeyword */: - case 70 /* CatchKeyword */: - case 83 /* FinallyKeyword */: + case 80 /* ElseKeyword */: + case 72 /* CatchKeyword */: + case 85 /* FinallyKeyword */: return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 243 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 245 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 169 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 171 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -48492,12 +49417,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 198 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 200 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -48551,7 +49476,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 212 /* ClassDeclaration */ && functionDeclaration.kind !== 142 /* Constructor */); + (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -48574,18 +49499,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 216 /* ModuleDeclaration */: + case 218 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 196 /* WhileStatement */: - case 194 /* IfStatement */: - case 198 /* ForInStatement */: - case 199 /* ForOfStatement */: + case 198 /* WhileStatement */: + case 196 /* IfStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 197 /* ForStatement */: + case 199 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -48593,7 +49518,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 210 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 212 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -48613,13 +49538,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 215 /* EnumDeclaration */: + case 217 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 212 /* ClassDeclaration */: + case 214 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -48627,25 +49552,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 217 /* ModuleBlock */: + case 219 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 215 /* EnumDeclaration */: - case 212 /* ClassDeclaration */: + case 217 /* EnumDeclaration */: + case 214 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 190 /* Block */: + case 192 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 242 /* CatchClause */: + case 244 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 218 /* CaseBlock */: + case 220 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -48659,7 +49584,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -48669,17 +49594,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 171 /* FunctionExpression */: - case 211 /* FunctionDeclaration */: - case 172 /* ArrowFunction */: - case 141 /* MethodDeclaration */: - case 140 /* MethodSignature */: - case 143 /* GetAccessor */: - case 144 /* SetAccessor */: - case 142 /* Constructor */: - case 196 /* WhileStatement */: - case 195 /* DoStatement */: - case 197 /* ForStatement */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 144 /* Constructor */: + case 198 /* WhileStatement */: + case 197 /* DoStatement */: + case 199 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -48690,19 +49615,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 243 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 245 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 169 /* TypeAssertionExpression */) { + if (node.parent.kind === 171 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 195 /* DoStatement */) { + if (node.parent.kind === 197 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -49339,7 +50264,8 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + // for now treat files as JavaScript + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); var convertResult = { referencedFiles: [], importedFiles: [], From 7a4e995f018632044133b7c50f157276aac493bd Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 20 Oct 2015 15:14:18 -0700 Subject: [PATCH 049/140] feedback form pr --- Jakefile.js | 3 +- src/compiler/declarationEmitter.ts | 4 +- src/compiler/emitter.ts | 4 +- src/compiler/utilities.ts | 96 +++++++++++++++++------------- 4 files changed, 61 insertions(+), 46 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 505ccf99384..be80edb0a67 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -247,7 +247,8 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu if (!noOutFile) { options += " --out " + outFile; - } else { + } + else { options += " --module commonjs" } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index c3d611f131c..fb1ccf5714a 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -731,7 +731,7 @@ namespace ts { } let match: RegExpMatchArray; if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { - write(makeModulePathSemiabsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); + write(makeModulePathSemiAbsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); } else { writeTextOfNode(currentSourceFile, node.moduleSpecifier); @@ -773,7 +773,7 @@ namespace ts { write(" from "); let match: RegExpMatchArray; if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { - write(makeModulePathSemiabsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); + write(makeModulePathSemiAbsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); } else { writeTextOfNode(currentSourceFile, node.moduleSpecifier); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 71c4f11e8c9..d62cec73bd9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6766,7 +6766,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (resolvePath) { - text = makeModulePathSemiabsolute(host, currentSourceFile, text); + text = makeModulePathSemiAbsolute(host, currentSourceFile, text); } write(text); } @@ -6813,7 +6813,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalModuleName = getExternalModuleNameText(importNode); if (resolvePath) { - externalModuleName = makeModulePathSemiabsolute(host, currentSourceFile, externalModuleName); + externalModuleName = makeModulePathSemiAbsolute(host, currentSourceFile, externalModuleName); } // Find the name of the module alias, if there is one diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7af0d0ea7e9..e3537ddffc9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1608,42 +1608,34 @@ namespace ts { } } + let baseCharsMap: Map = { + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\u2028": "\\u2028", // lineSeparator + "\u2029": "\\u2029", // paragraphSeparator + "\u0085": "\\u0085" // nextLine + } + // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator, // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in // the language service. These characters should be escaped when printing, and if any characters are added, // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. let escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - let escapedCharsMap: Map = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", // lineSeparator - "\u2029": "\\u2029", // paragraphSeparator - "\u0085": "\\u0085" // nextLine - }; + let escapedCharsMap: Map = extend(baseCharsMap, { + "\"": "\\\"" + }); let singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - let singleQuoteEscapedCharsMap: Map = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\'": "\\\'", - "\u2028": "\\u2028", // lineSeparator - "\u2029": "\\u2029", // paragraphSeparator - "\u0085": "\\u0085" // nextLine - }; + let singleQuoteEscapedCharsMap: Map = extend(baseCharsMap, { + "\'": "\\\'" + }); /** * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), @@ -1651,12 +1643,28 @@ namespace ts { * Note that this doesn't actually wrap the input in double quotes. */ export function escapeString(s: string): string { - return escapeStringByQuote(s, "\""); + return escapeStringByQuote(s, QuotationMark.Double); } - export function escapeStringByQuote(s: string, quotemark: string): string { - let regex = quotemark === "'" ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; - let replacementMap = quotemark === "'" ? singleQuoteEscapedCharsMap : escapedCharsMap; + export const enum QuotationMark { + Double, + Single + } + + export var QuotationMarkLookup: Map = { + [QuotationMark.Double]: "\"", + [QuotationMark.Single]: "'", + "\"": QuotationMark.Double.toString(), + "'": QuotationMark.Single.toString(), + }; + + /** + * A generalization of the escape function described by escapeString configuable to handle + * either single quotes or double quotes + */ + export function escapeStringByQuote(s: string, quoteMark: QuotationMark): string { + let regex = quoteMark === QuotationMark.Single ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; + let replacementMap = quoteMark === QuotationMark.Single ? singleQuoteEscapedCharsMap : escapedCharsMap; s = regex.test(s) ? s.replace(regex, getReplacement) : s; @@ -1667,8 +1675,12 @@ namespace ts { } } - export function quoteString(s: string, quotemark: string): string { - return quotemark + escapeStringByQuote(s, quotemark) + quotemark; + /** + * Quotes a given string akin to the abstract Quote operation from ECMA-262 (24.3.2.2) + * with the specified quotation mark + */ + export function quoteString(s: string, quotemark: QuotationMark): string { + return QuotationMarkLookup[quotemark] + escapeStringByQuote(s, quotemark) + QuotationMarkLookup[quotemark]; } export function isIntrinsicJsxName(name: string) { @@ -1784,22 +1796,24 @@ namespace ts { }; } - export function makeModulePathSemiabsolute(host: EmitHost, currentSourceFile: SourceFile, externalModuleName: string): string { - let quotemark = externalModuleName.charAt(0); + export function makeModulePathSemiAbsolute(host: EmitHost, currentSourceFile: SourceFile, externalModuleName: string): string { + let quotationMark = externalModuleName.charAt(0); let unquotedModuleName = externalModuleName.substring(1, externalModuleName.length - 1); let resolvedFileName = host.resolveModuleName(unquotedModuleName, currentSourceFile.fileName); if (resolvedFileName) { - let semiabsoluteName = resolveToSemiabsolutePath(host, resolvedFileName); - externalModuleName = quoteString(semiabsoluteName, quotemark); + let semiAbsoluteName = resolveToSemiabsolutePath(host, resolvedFileName); + externalModuleName = quoteString(semiAbsoluteName, parseInt(QuotationMarkLookup[quotationMark])); } return externalModuleName; } + /** + * Resolves a local path to a path which is absolute to the base of the emit + */ export function resolveToSemiabsolutePath(host: EmitHost, path: string): string { let dir = host.getCurrentDirectory(); - return removeFileExtension( - getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/false) - ); + let relativePath = getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); + return removeFileExtension(relativePath); } export function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string) { From 79cf984a83067e4e580927374e698c1b71793136 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 20 Oct 2015 15:14:28 -0700 Subject: [PATCH 050/140] feedback form pr --- src/compiler/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e3537ddffc9..cc7f1ce5d3e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1620,7 +1620,7 @@ namespace ts { "\u2028": "\\u2028", // lineSeparator "\u2029": "\\u2029", // paragraphSeparator "\u0085": "\\u0085" // nextLine - } + }; // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator, // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in @@ -1650,7 +1650,7 @@ namespace ts { Double, Single } - + export var QuotationMarkLookup: Map = { [QuotationMark.Double]: "\"", [QuotationMark.Single]: "'", From d178945cd47fae104ba7b9718ed04766bfddab76 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 20 Oct 2015 15:29:21 -0700 Subject: [PATCH 051/140] rename variable --- src/compiler/utilities.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index cc7f1ce5d3e..d95d53f97ef 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1662,9 +1662,9 @@ namespace ts { * A generalization of the escape function described by escapeString configuable to handle * either single quotes or double quotes */ - export function escapeStringByQuote(s: string, quoteMark: QuotationMark): string { - let regex = quoteMark === QuotationMark.Single ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; - let replacementMap = quoteMark === QuotationMark.Single ? singleQuoteEscapedCharsMap : escapedCharsMap; + export function escapeStringByQuote(s: string, quotationMark: QuotationMark): string { + let regex = quotationMark === QuotationMark.Single ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; + let replacementMap = quotationMark === QuotationMark.Single ? singleQuoteEscapedCharsMap : escapedCharsMap; s = regex.test(s) ? s.replace(regex, getReplacement) : s; From 37bc2773a3a23d39b42a5c93d899662494f39277 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 15:27:33 -0700 Subject: [PATCH 052/140] feedback form pr --- src/compiler/checker.ts | 3 +- src/compiler/declarationEmitter.ts | 35 ++++++++------ src/compiler/emitter.ts | 18 ++++++-- src/compiler/program.ts | 52 ++++++++++----------- src/compiler/types.ts | 1 + src/compiler/utilities.ts | 74 +++++------------------------- src/harness/projectsRunner.ts | 2 +- 7 files changed, 75 insertions(+), 110 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 04cc9a2e426..de7f3e45346 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14867,7 +14867,8 @@ namespace ts { collectLinkedAliases, getReferencedValueDeclaration, getTypeReferenceSerializationKind, - isOptionalParameter + isOptionalParameter, + getSymbolAtLocation }; } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index fb1ccf5714a..82983dab394 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -729,17 +729,30 @@ namespace ts { } write(" from "); } - let match: RegExpMatchArray; - if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { - write(makeModulePathSemiAbsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); - } - else { - writeTextOfNode(currentSourceFile, node.moduleSpecifier); - } + emitExternalModuleSpecifier(node.moduleSpecifier); write(";"); writer.writeLine(); } + function emitExternalModuleSpecifier(moduleSpecifier: Expression) { + Debug.assert(moduleSpecifier.kind === SyntaxKind.StringLiteral); + + if ((!root) && (compilerOptions.out || compilerOptions.outFile)) { + let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol && moduleSymbol.valueDeclaration && + moduleSymbol.valueDeclaration.kind === SyntaxKind.SourceFile && + !isDeclarationFile(moduleSymbol.valueDeclaration)) { + let nonRelativeModuleName = getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName); + write("\""); + write(nonRelativeModuleName); + write("\""); + return; + } + } + + writeTextOfNode(currentSourceFile, moduleSpecifier); + } + function emitImportOrExportSpecifier(node: ImportOrExportSpecifier) { if (node.propertyName) { writeTextOfNode(currentSourceFile, node.propertyName); @@ -771,13 +784,7 @@ namespace ts { } if (node.moduleSpecifier) { write(" from "); - let match: RegExpMatchArray; - if ((!root) && node.moduleSpecifier.kind === SyntaxKind.StringLiteral && (match = getTextOfNode(node.moduleSpecifier).match(/('|")(\.\/|\.\.\/)/))) { - write(makeModulePathSemiAbsolute(host, currentSourceFile, getTextOfNode(node.moduleSpecifier))); - } - else { - writeTextOfNode(currentSourceFile, node.moduleSpecifier); - } + emitExternalModuleSpecifier(node.moduleSpecifier); } write(";"); writer.writeLine(); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d62cec73bd9..278bf026603 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -497,7 +497,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitConcatenatedModule(sourceFile: SourceFile): void { currentSourceFile = sourceFile; exportFunctionForFile = undefined; - let canonicalName = resolveToSemiabsolutePath(host, sourceFile.fileName); + let canonicalName = getExternalModuleNameFromPath(host, sourceFile.fileName); sourceFile.moduleName = sourceFile.moduleName || canonicalName; emit(sourceFile); } @@ -6766,7 +6766,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (resolvePath) { - text = makeModulePathSemiAbsolute(host, currentSourceFile, text); + text = `"${lookupSpecifierName(externalImports[i])}"`; } write(text); } @@ -6782,6 +6782,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("});"); } + function lookupSpecifierName(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string { + let specifier: Node; + if (declaration.kind === SyntaxKind.ImportEqualsDeclaration) { + specifier = (declaration as ImportEqualsDeclaration).moduleReference; + } + else { + specifier = (declaration as ImportDeclaration|ExportDeclaration).moduleSpecifier; + } + let moduleSymbol = resolver.getSymbolAtLocation(specifier); + return getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName); + } + interface AMDDependencyNames { aliasedModuleNames: string[]; unaliasedModuleNames: string[]; @@ -6813,7 +6825,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalModuleName = getExternalModuleNameText(importNode); if (resolvePath) { - externalModuleName = makeModulePathSemiAbsolute(host, currentSourceFile, externalModuleName); + externalModuleName = `"${lookupSpecifierName(importNode)}"`; } // Find the name of the module alias, if there is one diff --git a/src/compiler/program.ts b/src/compiler/program.ts index bf4acc92675..7d4a116eebc 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -372,29 +372,6 @@ namespace ts { } } - // there has to be common source directory if user specified --outdir || --sourceRoot - // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted - if (options.outDir || // there is --outDir specified - options.sourceRoot || // there is --sourceRoot specified - options.mapRoot) { // there is --mapRoot specified - - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - // If a rootDir is specified and is valid use it as the commonSourceDirectory - commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); - } - else { - // Compute the commonSourceDirectory from the input files - commonSourceDirectory = computeCommonSourceDirectory(files); - } - - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += directorySeparator; - } - } - verifyCompilerOptions(); // unconditionally set oldProgram to undefined to prevent it from being captured in closure @@ -540,12 +517,6 @@ namespace ts { getSourceFiles: program.getSourceFiles, writeFile: writeFileCallback || ( (fileName, data, writeByteOrderMark, onError) => host.writeFile(fileName, data, writeByteOrderMark, onError)), - resolveModuleName: (name: string, containingFile?: string) => { - let resolvedModule = resolveModuleNamesWorker([name], containingFile || "dummy.ts")[0]; - if (!resolvedModule) - return; - return resolvedModule.resolvedFileName; - }, }; } @@ -1063,6 +1034,29 @@ namespace ts { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } + // there has to be common source directory if user specified --outdir || --sourceRoot + // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted + if (options.outDir || // there is --outDir specified + options.sourceRoot || // there is --sourceRoot specified + options.mapRoot) { // there is --mapRoot specified + + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); + } + else { + // Compute the commonSourceDirectory from the input files + commonSourceDirectory = computeCommonSourceDirectory(files); + } + + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += directorySeparator; + } + } + if (options.noEmit) { if (options.out) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2818ef04a48..fb6e237dd39 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1611,6 +1611,7 @@ namespace ts { getReferencedValueDeclaration(reference: Identifier): Declaration; getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; isOptionalParameter(node: ParameterDeclaration): boolean; + getSymbolAtLocation(node: Node): Symbol; } export const enum SymbolFlags { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d95d53f97ef..24916c2e106 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -40,7 +40,6 @@ namespace ts { getNewLine(): string; writeFile: WriteFileCallback; - resolveModuleName(path: string, containingFile?: string): string; } // Pool writers to avoid needing to allocate them for every symbol we write. @@ -1608,7 +1607,13 @@ namespace ts { } } - let baseCharsMap: Map = { + // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator, + // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in + // the language service. These characters should be escaped when printing, and if any characters are added, + // the map below must be updated. Note that this regexp *does not* include the 'delete' character. + // There is no reason for this other than that JSON.stringify does not handle it either. + let escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + let escapedCharsMap: Map = { "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -1617,25 +1622,12 @@ namespace ts { "\r": "\\r", "\n": "\\n", "\\": "\\\\", + "\"": "\\\"", "\u2028": "\\u2028", // lineSeparator "\u2029": "\\u2029", // paragraphSeparator "\u0085": "\\u0085" // nextLine }; - // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator, - // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in - // the language service. These characters should be escaped when printing, and if any characters are added, - // the map below must be updated. Note that this regexp *does not* include the 'delete' character. - // There is no reason for this other than that JSON.stringify does not handle it either. - let escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - let escapedCharsMap: Map = extend(baseCharsMap, { - "\"": "\\\"" - }); - - let singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - let singleQuoteEscapedCharsMap: Map = extend(baseCharsMap, { - "\'": "\\\'" - }); /** * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), @@ -1643,46 +1635,15 @@ namespace ts { * Note that this doesn't actually wrap the input in double quotes. */ export function escapeString(s: string): string { - return escapeStringByQuote(s, QuotationMark.Double); - } - - export const enum QuotationMark { - Double, - Single - } - - export var QuotationMarkLookup: Map = { - [QuotationMark.Double]: "\"", - [QuotationMark.Single]: "'", - "\"": QuotationMark.Double.toString(), - "'": QuotationMark.Single.toString(), - }; - - /** - * A generalization of the escape function described by escapeString configuable to handle - * either single quotes or double quotes - */ - export function escapeStringByQuote(s: string, quotationMark: QuotationMark): string { - let regex = quotationMark === QuotationMark.Single ? singleQuoteEscapedCharsRegExp : escapedCharsRegExp; - let replacementMap = quotationMark === QuotationMark.Single ? singleQuoteEscapedCharsMap : escapedCharsMap; - - s = regex.test(s) ? s.replace(regex, getReplacement) : s; + s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; return s; function getReplacement(c: string) { - return replacementMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } } - /** - * Quotes a given string akin to the abstract Quote operation from ECMA-262 (24.3.2.2) - * with the specified quotation mark - */ - export function quoteString(s: string, quotemark: QuotationMark): string { - return QuotationMarkLookup[quotemark] + escapeStringByQuote(s, quotemark) + QuotationMarkLookup[quotemark]; - } - export function isIntrinsicJsxName(name: string) { let ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -1796,23 +1757,12 @@ namespace ts { }; } - export function makeModulePathSemiAbsolute(host: EmitHost, currentSourceFile: SourceFile, externalModuleName: string): string { - let quotationMark = externalModuleName.charAt(0); - let unquotedModuleName = externalModuleName.substring(1, externalModuleName.length - 1); - let resolvedFileName = host.resolveModuleName(unquotedModuleName, currentSourceFile.fileName); - if (resolvedFileName) { - let semiAbsoluteName = resolveToSemiabsolutePath(host, resolvedFileName); - externalModuleName = quoteString(semiAbsoluteName, parseInt(QuotationMarkLookup[quotationMark])); - } - return externalModuleName; - } - /** * Resolves a local path to a path which is absolute to the base of the emit */ - export function resolveToSemiabsolutePath(host: EmitHost, path: string): string { + export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string { let dir = host.getCurrentDirectory(); - let relativePath = getRelativePathToDirectoryOrUrl(dir, path, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); + let relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); return removeFileExtension(relativePath); } diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 862e446352d..18a8bc94c7b 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -366,7 +366,7 @@ class ProjectRunner extends RunnerBase { return resolutionInfo; } - it(name + ": " + moduleNameToString(moduleKind) , () => { + it(name + ": " + moduleNameToString(moduleKind), () => { // Compile using node compilerResult = batchCompilerProjectTestCase(moduleKind); }); From 3f52686974afd9e04a44a6e12702f4587b61c3c5 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 15:37:58 -0700 Subject: [PATCH 053/140] cleanup a bit, think toward the future --- src/compiler/declarationEmitter.ts | 17 +++++++++-------- src/compiler/emitter.ts | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 82983dab394..57e9b47b379 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -739,14 +739,15 @@ namespace ts { if ((!root) && (compilerOptions.out || compilerOptions.outFile)) { let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier); - if (moduleSymbol && moduleSymbol.valueDeclaration && - moduleSymbol.valueDeclaration.kind === SyntaxKind.SourceFile && - !isDeclarationFile(moduleSymbol.valueDeclaration)) { - let nonRelativeModuleName = getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName); - write("\""); - write(nonRelativeModuleName); - write("\""); - return; + if (moduleSymbol) { + let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; + if (moduleDeclaration && !isDeclarationFile(moduleDeclaration)) { + let nonRelativeModuleName = getExternalModuleNameFromPath(host, moduleDeclaration.fileName); + write("\""); + write(nonRelativeModuleName); + write("\""); + return; + } } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 278bf026603..1e95c827221 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6766,7 +6766,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (resolvePath) { - text = `"${lookupSpecifierName(externalImports[i])}"`; + let name = lookupSpecifierName(externalImports[i]); + if (name) { + text = `"${name}"`; + } } write(text); } @@ -6791,7 +6794,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi specifier = (declaration as ImportDeclaration|ExportDeclaration).moduleSpecifier; } let moduleSymbol = resolver.getSymbolAtLocation(specifier); - return getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName); + let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; + if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) { + return; + } + return getExternalModuleNameFromPath(host, moduleDeclaration.fileName); } interface AMDDependencyNames { @@ -6825,7 +6832,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalModuleName = getExternalModuleNameText(importNode); if (resolvePath) { - externalModuleName = `"${lookupSpecifierName(importNode)}"`; + let name = lookupSpecifierName(importNode); + if (name) { + externalModuleName = `"${name}"`; + } } // Find the name of the module alias, if there is one From 2fcdb0f70079c3338ebc5df8ef3aae53a54b6f43 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 15:53:59 -0700 Subject: [PATCH 054/140] bit more cleanup --- src/compiler/emitter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1e95c827221..0f0cdc0e110 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6794,6 +6794,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi specifier = (declaration as ImportDeclaration|ExportDeclaration).moduleSpecifier; } let moduleSymbol = resolver.getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return; + } let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) { return; From d18facbdc1c88394400358b1a1e1793e99b1f70a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 15:54:35 -0700 Subject: [PATCH 055/140] fix lint --- src/compiler/emitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0f0cdc0e110..fca740c0333 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6795,7 +6795,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } let moduleSymbol = resolver.getSymbolAtLocation(specifier); if (!moduleSymbol) { - return; + return; } let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) { From 255cde582d4897bc03d83284192dcfd4f24a4163 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 16:15:53 -0700 Subject: [PATCH 056/140] remove assertion --- src/compiler/declarationEmitter.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 57e9b47b379..1a1f0c5f16e 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -735,9 +735,7 @@ namespace ts { } function emitExternalModuleSpecifier(moduleSpecifier: Expression) { - Debug.assert(moduleSpecifier.kind === SyntaxKind.StringLiteral); - - if ((!root) && (compilerOptions.out || compilerOptions.outFile)) { + if (moduleSpecifier.kind === SyntaxKind.StringLiteral && (!root) && (compilerOptions.out || compilerOptions.outFile)) { let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; From c165be8b3a28bee144a35eb880fe0ba5dd49178d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 21 Oct 2015 17:36:49 -0700 Subject: [PATCH 057/140] change triple-slash ref emit critaera, add a new tests and accept new baselines --- src/compiler/declarationEmitter.ts | 10 +- .../reference/outModuleTripleSlashRefs.js | 116 +++++ .../reference/outModuleTripleSlashRefs.js.map | 4 + .../outModuleTripleSlashRefs.sourcemap.txt | 424 ++++++++++++++++++ .../outModuleTripleSlashRefs.symbols | 50 +++ .../reference/outModuleTripleSlashRefs.types | 50 +++ .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../amd/bin/test.d.ts | 1 - .../node/bin/test.d.ts | 1 - .../amd/bin/outAndOutDirFile.d.ts | 1 - .../node/bin/outAndOutDirFile.d.ts | 1 - .../compiler/outModuleTripleSlashRefs.ts | 33 ++ 43 files changed, 683 insertions(+), 40 deletions(-) create mode 100644 tests/baselines/reference/outModuleTripleSlashRefs.js create mode 100644 tests/baselines/reference/outModuleTripleSlashRefs.js.map create mode 100644 tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt create mode 100644 tests/baselines/reference/outModuleTripleSlashRefs.symbols create mode 100644 tests/baselines/reference/outModuleTripleSlashRefs.types create mode 100644 tests/cases/compiler/outModuleTripleSlashRefs.ts diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 1a1f0c5f16e..426000f6282 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -107,15 +107,14 @@ namespace ts { let emittedReferencedFiles: SourceFile[] = []; let prevModuleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[] = []; forEach(host.getSourceFiles(), sourceFile => { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - noDeclare = false; + if (!isDeclarationFile(sourceFile)) { // Check what references need to be added if (!compilerOptions.noResolve) { forEach(sourceFile.referencedFiles, fileReference => { let referencedFile = tryResolveScriptReference(host, sourceFile, fileReference); - // If the reference file is a declaration file or an external module, emit that reference - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + // If the reference file is a declaration file, emit that reference + if (referencedFile && (isDeclarationFile(referencedFile) && !contains(emittedReferencedFiles, referencedFile))) { // If the file reference was not already emitted writeReferencePath(referencedFile); @@ -123,7 +122,10 @@ namespace ts { } }); } + } + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; emitSourceFile(sourceFile); } else if (isExternalModule(sourceFile)) { diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js new file mode 100644 index 00000000000..dc0cdb22ddd --- /dev/null +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -0,0 +1,116 @@ +//// [tests/cases/compiler/outModuleTripleSlashRefs.ts] //// + +//// [a.ts] + +/// +export class A { + member: typeof GlobalFoo; +} + +//// [b.ts] +/// +class Foo { + member: Bar; +} +declare var GlobalFoo: Foo; + +//// [c.d.ts] +/// +declare class Bar { + member: Baz; +} + +//// [d.d.ts] +declare class Baz { + member: number; +} + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + + +//// [a.js] +define(["require", "exports"], function (require, exports) { + /// + var A = (function () { + function A() { + } + return A; + })(); + exports.A = A; +}); +//# sourceMappingURL=a.js.map//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +define(["require", "exports", "./ref/a"], function (require, exports, a_1) { + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports.B = B; +}); +//# sourceMappingURL=b.js.map//// [all.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/// +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { + /// + var A = (function () { + function A() { + } + return A; + })(); + exports.A = A; +}); +define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(a_1.A); + exports.B = B; +}); +//# sourceMappingURL=all.js.map + +//// [a.d.ts] +/// +export declare class A { + member: typeof GlobalFoo; +} +//// [b.d.ts] +import { A } from "./ref/a"; +export declare class B extends A { +} +//// [all.d.ts] +/// +declare class Foo { + member: Bar; +} +declare var GlobalFoo: Foo; +declare module "tests/cases/compiler/ref/a" { + export class A { + member: typeof GlobalFoo; + } +} +declare module "tests/cases/compiler/b" { + import { A } from "tests/cases/compiler/ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js.map b/tests/baselines/reference/outModuleTripleSlashRefs.js.map new file mode 100644 index 00000000000..0eeee4a82d5 --- /dev/null +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js.map @@ -0,0 +1,4 @@ +//// [a.js.map] +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";IACA,+BAA+B;IAC/B;QAAAA;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IAFY,SAAC,IAEb,CAAA"}//// [b.js.map] +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;IACA;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["Foo","Foo.constructor","A","A.constructor","B","B.constructor"],"mappings":";;;;;AAAA,iCAAiC;AACjC;IAAAA;IAEAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAFD,IAEC;;ICFD,+BAA+B;IAC/B;QAAAE;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IAFY,SAAC,IAEb,CAAA;;;ICHD;QAAuBE,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt new file mode 100644 index 00000000000..6e9070cbe04 --- /dev/null +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -0,0 +1,424 @@ +=================================================================== +JsFile: a.js +mapUrl: a.js.map +sourceRoot: +sources: a.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/ref/a.js +sourceFile:a.ts +------------------------------------------------------------------- +>>>define(["require", "exports"], function (require, exports) { +>>> /// +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 > /// +1 >Emitted(2, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 36) Source(2, 32) + SourceIndex(0) +--- +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(3, 5) Source(3, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { + > member: typeof GlobalFoo; + > +2 > } +1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (A.constructor) +2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (A) +2 >Emitted(6, 17) Source(5, 2) + SourceIndex(0) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { + > member: typeof GlobalFoo; + > } +1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (A) +2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (A) +3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) +4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > { + > member: typeof GlobalFoo; + > } +4 > +1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) +2 >Emitted(8, 14) Source(3, 15) + SourceIndex(0) +3 >Emitted(8, 18) Source(5, 2) + SourceIndex(0) +4 >Emitted(8, 19) Source(5, 2) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=a.js.map=================================================================== +JsFile: b.js +mapUrl: b.js.map +sourceRoot: +sources: b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/b.js +sourceFile:b.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>define(["require", "exports", "./ref/a"], function (require, exports, a_1) { +>>> var B = (function (_super) { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(7, 5) Source(2, 1) + SourceIndex(0) +--- +>>> __extends(B, _super); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(8, 9) Source(2, 24) + SourceIndex(0) name (B) +2 >Emitted(8, 30) Source(2, 25) + SourceIndex(0) name (B) +--- +>>> function B() { +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(9, 9) Source(2, 1) + SourceIndex(0) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(10, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) +2 >Emitted(10, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(11, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) +2 >Emitted(11, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(12, 9) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(12, 17) Source(2, 29) + SourceIndex(0) name (B) +--- +>>> })(a_1.A); +1 >^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(13, 5) Source(2, 28) + SourceIndex(0) name (B) +2 >Emitted(13, 6) Source(2, 29) + SourceIndex(0) name (B) +3 >Emitted(13, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(13, 8) Source(2, 24) + SourceIndex(0) +5 >Emitted(13, 13) Source(2, 25) + SourceIndex(0) +6 >Emitted(13, 15) Source(2, 29) + SourceIndex(0) +--- +>>> exports.B = B; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > B +3 > extends A { } +4 > +1->Emitted(14, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(14, 14) Source(2, 15) + SourceIndex(0) +3 >Emitted(14, 18) Source(2, 29) + SourceIndex(0) +4 >Emitted(14, 19) Source(2, 29) + SourceIndex(0) +--- +>>>}); +>>>//# sourceMappingURL=b.js.map=================================================================== +JsFile: all.js +mapUrl: all.js.map +sourceRoot: +sources: tests/cases/compiler/ref/b.ts,tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/b.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>/// +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(6, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(6, 34) Source(1, 34) + SourceIndex(0) +--- +>>>var Foo = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function Foo() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(8, 5) Source(2, 1) + SourceIndex(0) name (Foo) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^-> +1->class Foo { + > member: Bar; + > +2 > } +1->Emitted(9, 5) Source(4, 1) + SourceIndex(0) name (Foo.constructor) +2 >Emitted(9, 6) Source(4, 2) + SourceIndex(0) name (Foo.constructor) +--- +>>> return Foo; +1->^^^^ +2 > ^^^^^^^^^^ +1-> +2 > } +1->Emitted(10, 5) Source(4, 1) + SourceIndex(0) name (Foo) +2 >Emitted(10, 15) Source(4, 2) + SourceIndex(0) name (Foo) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class Foo { + > member: Bar; + > } +1 >Emitted(11, 1) Source(4, 1) + SourceIndex(0) name (Foo) +2 >Emitted(11, 2) Source(4, 2) + SourceIndex(0) name (Foo) +3 >Emitted(11, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(11, 6) Source(4, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/ref/a.ts +------------------------------------------------------------------- +>>>define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +>>> /// +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > +2 > /// +1->Emitted(13, 5) Source(2, 1) + SourceIndex(1) +2 >Emitted(13, 36) Source(2, 32) + SourceIndex(1) +--- +>>> var A = (function () { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(14, 5) Source(3, 1) + SourceIndex(1) +--- +>>> function A() { +1->^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(15, 9) Source(3, 1) + SourceIndex(1) name (A) +--- +>>> } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->export class A { + > member: typeof GlobalFoo; + > +2 > } +1->Emitted(16, 9) Source(5, 1) + SourceIndex(1) name (A.constructor) +2 >Emitted(16, 10) Source(5, 2) + SourceIndex(1) name (A.constructor) +--- +>>> return A; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(17, 9) Source(5, 1) + SourceIndex(1) name (A) +2 >Emitted(17, 17) Source(5, 2) + SourceIndex(1) name (A) +--- +>>> })(); +1 >^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class A { + > member: typeof GlobalFoo; + > } +1 >Emitted(18, 5) Source(5, 1) + SourceIndex(1) name (A) +2 >Emitted(18, 6) Source(5, 2) + SourceIndex(1) name (A) +3 >Emitted(18, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(18, 10) Source(5, 2) + SourceIndex(1) +--- +>>> exports.A = A; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > A +3 > { + > member: typeof GlobalFoo; + > } +4 > +1->Emitted(19, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(19, 14) Source(3, 15) + SourceIndex(1) +3 >Emitted(19, 18) Source(5, 2) + SourceIndex(1) +4 >Emitted(19, 19) Source(5, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:all.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>}); +>>>define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +>>> var B = (function (_super) { +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >import {A} from "./ref/a"; + > +1 >Emitted(22, 5) Source(2, 1) + SourceIndex(2) +--- +>>> __extends(B, _super); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(23, 9) Source(2, 24) + SourceIndex(2) name (B) +2 >Emitted(23, 30) Source(2, 25) + SourceIndex(2) name (B) +--- +>>> function B() { +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(24, 9) Source(2, 1) + SourceIndex(2) name (B) +--- +>>> _super.apply(this, arguments); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1->export class B extends +2 > A +1->Emitted(25, 13) Source(2, 24) + SourceIndex(2) name (B.constructor) +2 >Emitted(25, 43) Source(2, 25) + SourceIndex(2) name (B.constructor) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > { +2 > } +1 >Emitted(26, 9) Source(2, 28) + SourceIndex(2) name (B.constructor) +2 >Emitted(26, 10) Source(2, 29) + SourceIndex(2) name (B.constructor) +--- +>>> return B; +1->^^^^^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(27, 9) Source(2, 28) + SourceIndex(2) name (B) +2 >Emitted(27, 17) Source(2, 29) + SourceIndex(2) name (B) +--- +>>> })(a_1.A); +1 >^^^^ +2 > ^ +3 > +4 > ^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^-> +1 > +2 > } +3 > +4 > export class B extends +5 > A +6 > { } +1 >Emitted(28, 5) Source(2, 28) + SourceIndex(2) name (B) +2 >Emitted(28, 6) Source(2, 29) + SourceIndex(2) name (B) +3 >Emitted(28, 6) Source(2, 1) + SourceIndex(2) +4 >Emitted(28, 8) Source(2, 24) + SourceIndex(2) +5 >Emitted(28, 13) Source(2, 25) + SourceIndex(2) +6 >Emitted(28, 15) Source(2, 29) + SourceIndex(2) +--- +>>> exports.B = B; +1->^^^^ +2 > ^^^^^^^^^ +3 > ^^^^ +4 > ^ +1-> +2 > B +3 > extends A { } +4 > +1->Emitted(29, 5) Source(2, 14) + SourceIndex(2) +2 >Emitted(29, 14) Source(2, 15) + SourceIndex(2) +3 >Emitted(29, 18) Source(2, 29) + SourceIndex(2) +4 >Emitted(29, 19) Source(2, 29) + SourceIndex(2) +--- +>>>}); +>>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.symbols b/tests/baselines/reference/outModuleTripleSlashRefs.symbols new file mode 100644 index 00000000000..f8d550aedb6 --- /dev/null +++ b/tests/baselines/reference/outModuleTripleSlashRefs.symbols @@ -0,0 +1,50 @@ +=== tests/cases/compiler/ref/a.ts === + +/// +export class A { +>A : Symbol(A, Decl(a.ts, 0, 0)) + + member: typeof GlobalFoo; +>member : Symbol(member, Decl(a.ts, 2, 16)) +>GlobalFoo : Symbol(GlobalFoo, Decl(b.ts, 4, 11)) +} + +=== tests/cases/compiler/ref/b.ts === +/// +class Foo { +>Foo : Symbol(Foo, Decl(b.ts, 0, 0)) + + member: Bar; +>member : Symbol(member, Decl(b.ts, 1, 11)) +>Bar : Symbol(Bar, Decl(c.d.ts, 0, 0)) +} +declare var GlobalFoo: Foo; +>GlobalFoo : Symbol(GlobalFoo, Decl(b.ts, 4, 11)) +>Foo : Symbol(Foo, Decl(b.ts, 0, 0)) + +=== tests/cases/compiler/ref/c.d.ts === +/// +declare class Bar { +>Bar : Symbol(Bar, Decl(c.d.ts, 0, 0)) + + member: Baz; +>member : Symbol(member, Decl(c.d.ts, 1, 19)) +>Baz : Symbol(Baz, Decl(d.d.ts, 0, 0)) +} + +=== tests/cases/compiler/ref/d.d.ts === +declare class Baz { +>Baz : Symbol(Baz, Decl(d.d.ts, 0, 0)) + + member: number; +>member : Symbol(member, Decl(d.d.ts, 0, 19)) +} + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : Symbol(A, Decl(b.ts, 0, 8)) + +export class B extends A { } +>B : Symbol(B, Decl(b.ts, 0, 26)) +>A : Symbol(A, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.types b/tests/baselines/reference/outModuleTripleSlashRefs.types new file mode 100644 index 00000000000..917704cce5a --- /dev/null +++ b/tests/baselines/reference/outModuleTripleSlashRefs.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/ref/a.ts === + +/// +export class A { +>A : A + + member: typeof GlobalFoo; +>member : Foo +>GlobalFoo : Foo +} + +=== tests/cases/compiler/ref/b.ts === +/// +class Foo { +>Foo : Foo + + member: Bar; +>member : Bar +>Bar : Bar +} +declare var GlobalFoo: Foo; +>GlobalFoo : Foo +>Foo : Foo + +=== tests/cases/compiler/ref/c.d.ts === +/// +declare class Bar { +>Bar : Bar + + member: Baz; +>member : Baz +>Baz : Baz +} + +=== tests/cases/compiler/ref/d.d.ts === +declare class Baz { +>Baz : Baz + + member: number; +>member : number +} + +=== tests/cases/compiler/b.ts === +import {A} from "./ref/a"; +>A : typeof A + +export class B extends A { } +>B : B +>A : A + diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts index bc9ccf61daf..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts index 375869ffc94..c3a64f5b6eb 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.d.ts @@ -1,4 +1,3 @@ -/// declare var m1_a1: number; declare class m1_c1 { m1_c1_p1: number; diff --git a/tests/cases/compiler/outModuleTripleSlashRefs.ts b/tests/cases/compiler/outModuleTripleSlashRefs.ts new file mode 100644 index 00000000000..fdeb4f93453 --- /dev/null +++ b/tests/cases/compiler/outModuleTripleSlashRefs.ts @@ -0,0 +1,33 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: amd +// @outFile: all.js + +// @Filename: ref/a.ts +/// +export class A { + member: typeof GlobalFoo; +} + +// @Filename: ref/b.ts +/// +class Foo { + member: Bar; +} +declare var GlobalFoo: Foo; + +// @Filename: ref/c.d.ts +/// +declare class Bar { + member: Baz; +} + +// @Filename: ref/d.d.ts +declare class Baz { + member: number; +} + +// @Filename: b.ts +import {A} from "./ref/a"; +export class B extends A { } From abf270a9b4498e1f7d41fad503e3f606d043ff12 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 22 Oct 2015 14:12:57 -0700 Subject: [PATCH 058/140] do not look into nested es6 exports / imports when collecting external modules --- src/compiler/program.ts | 87 ++++++++++++++++++--------------------- src/compiler/utilities.ts | 2 +- 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 13d939c8ac7..583db7850b9 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -689,61 +689,56 @@ namespace ts { let imports: LiteralExpression[]; for (let node of file.statements) { - collect(node, /* allowRelativeModuleNames */ true); + collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); } file.imports = imports || emptyArray; - function collect(node: Node, allowRelativeModuleNames: boolean): void { - switch (node.kind) { - case SyntaxKind.ImportDeclaration: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ExportDeclaration: - let moduleNameExpr = getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) { - break; - } - if (!(moduleNameExpr).text) { - break; - } + return; - if (allowRelativeModuleNames || !isExternalModuleNameRelative((moduleNameExpr).text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case SyntaxKind.CallExpression: - if (isJavaScriptFile && isRequireCall(node)) { - - let jsImports = (node).arguments; - if (jsImports) { - imports = (imports || []); - for (var i = 0; i < jsImports.length; i++) { - if (jsImports[i].kind === SyntaxKind.StringLiteral) { - imports.push(jsImports[i]); - } - } + function collect(node: Node, allowRelativeModuleNames: boolean, collectOnlyRequireCalls: boolean): void { + if (!collectOnlyRequireCalls) { + switch (node.kind) { + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportDeclaration: + let moduleNameExpr = getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) { + break; } - } - break; - case SyntaxKind.ModuleDeclaration: - if ((node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - forEachChild((node).body, node => { + if (!(moduleNameExpr).text) { + break; + } + + if (allowRelativeModuleNames || !isExternalModuleNameRelative((moduleNameExpr).text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case SyntaxKind.ModuleDeclaration: + if ((node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - collect(node, /* allowRelativeModuleNames */ false); - }); - } - break; + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + forEachChild((node).body, node => { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); + }); + } + break; + } } - if (isSourceFileJavaScript(file)) { - forEachChild(node, node => collect(node, allowRelativeModuleNames)); + if (isJavaScriptFile) { + if (isRequireCall(node)) { + (imports || (imports = [])).push((node).arguments[0]); + } + else { + forEachChild(node, node => collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true)); + } } } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9eff4370ec2..5506a1d5e3d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1045,7 +1045,7 @@ namespace ts { /** * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one argument. + * exactly one string literal argument. * This function does not test if the node is in a JavaScript file or not. */ export function isRequireCall(expression: Node): expression is CallExpression { From 91eb758d5958eb0c3f19e3d2ce1a6a5923019699 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 22 Oct 2015 15:39:01 -0700 Subject: [PATCH 059/140] CR feedback --- src/compiler/checker.ts | 12 ++---------- src/harness/harness.ts | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ac5056bf769..c407ca0c183 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -160,8 +160,6 @@ namespace ts { let getGlobalPromiseConstructorLikeType: () => ObjectType; let getGlobalThenableType: () => ObjectType; - let cjsRequireType: Type; - let tupleTypes: Map = {}; let unionTypes: Map = {}; let intersectionTypes: Map = {}; @@ -4203,13 +4201,9 @@ namespace ts { * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace: string, name: string): Type { - let typeSymbol = getExportedSymbolFromNamespace(namespace, name); - return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); - } - - function getExportedSymbolFromNamespace(namespace: string, name: string): Symbol { let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined); - return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type | SymbolFlags.Value); + let typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type); + return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } function getGlobalESSymbolConstructorSymbol() { @@ -14938,8 +14932,6 @@ namespace ts { getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); - cjsRequireType = getExportedTypeFromNamespace("CommonJS", "Require"); - // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. if (languageVersion >= ScriptTarget.ES6) { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 91897493fd9..a37b647a124 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -211,7 +211,7 @@ namespace Utils { return isNodeOrArray(v) ? serializeNode(v) : v; }, " "); - function getKindName(k: number|string): string { + function getKindName(k: number | string): string { if (typeof k === "string") { return k; } From f038a0f18c6a14b94272181ed2519dd1958a505c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 23 Oct 2015 15:33:18 -0700 Subject: [PATCH 060/140] ignore names when checking type parameter equality --- src/compiler/checker.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b3fa607b0ea..6091b028443 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5055,9 +5055,6 @@ namespace ts { } function typeParameterIdenticalTo(source: TypeParameter, target: TypeParameter): Ternary { - if (source.symbol.name !== target.symbol.name) { - return Ternary.False; - } // covers case when both type parameters does not have constraint (both equal to noConstraintType) if (source.constraint === target.constraint) { return Ternary.True; From 5e82f234ec28ebb87d467f2df1e6f8d93c5c0ef3 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 23 Oct 2015 15:45:45 -0700 Subject: [PATCH 061/140] Add test of issue --- .../reference/typeParameterEquality.js | 11 ++++++++++ .../reference/typeParameterEquality.symbols | 19 ++++++++++++++++++ .../reference/typeParameterEquality.types | 20 +++++++++++++++++++ tests/cases/compiler/typeParameterEquality.ts | 5 +++++ 4 files changed, 55 insertions(+) create mode 100644 tests/baselines/reference/typeParameterEquality.js create mode 100644 tests/baselines/reference/typeParameterEquality.symbols create mode 100644 tests/baselines/reference/typeParameterEquality.types create mode 100644 tests/cases/compiler/typeParameterEquality.ts diff --git a/tests/baselines/reference/typeParameterEquality.js b/tests/baselines/reference/typeParameterEquality.js new file mode 100644 index 00000000000..b77e534b354 --- /dev/null +++ b/tests/baselines/reference/typeParameterEquality.js @@ -0,0 +1,11 @@ +//// [typeParameterEquality.ts] +class C { + get x(): (a: T) => T { return null; } + set x(p: (a: U) => U) {} +} + +//// [typeParameterEquality.js] +class C { + get x() { return null; } + set x(p) { } +} diff --git a/tests/baselines/reference/typeParameterEquality.symbols b/tests/baselines/reference/typeParameterEquality.symbols new file mode 100644 index 00000000000..562d6277d93 --- /dev/null +++ b/tests/baselines/reference/typeParameterEquality.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/typeParameterEquality.ts === +class C { +>C : Symbol(C, Decl(typeParameterEquality.ts, 0, 0)) + + get x(): (a: T) => T { return null; } +>x : Symbol(x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) +>T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) +>a : Symbol(a, Decl(typeParameterEquality.ts, 1, 17)) +>T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) +>T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) + + set x(p: (a: U) => U) {} +>x : Symbol(x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) +>p : Symbol(p, Decl(typeParameterEquality.ts, 2, 10)) +>U : Symbol(U, Decl(typeParameterEquality.ts, 2, 14)) +>a : Symbol(a, Decl(typeParameterEquality.ts, 2, 17)) +>U : Symbol(U, Decl(typeParameterEquality.ts, 2, 14)) +>U : Symbol(U, Decl(typeParameterEquality.ts, 2, 14)) +} diff --git a/tests/baselines/reference/typeParameterEquality.types b/tests/baselines/reference/typeParameterEquality.types new file mode 100644 index 00000000000..2e51c3a51e6 --- /dev/null +++ b/tests/baselines/reference/typeParameterEquality.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/typeParameterEquality.ts === +class C { +>C : C + + get x(): (a: T) => T { return null; } +>x : (a: T) => T +>T : T +>a : T +>T : T +>T : T +>null : null + + set x(p: (a: U) => U) {} +>x : (a: T) => T +>p : (a: U) => U +>U : U +>a : U +>U : U +>U : U +} diff --git a/tests/cases/compiler/typeParameterEquality.ts b/tests/cases/compiler/typeParameterEquality.ts new file mode 100644 index 00000000000..aa136aa3655 --- /dev/null +++ b/tests/cases/compiler/typeParameterEquality.ts @@ -0,0 +1,5 @@ +// @target: es6 +class C { + get x(): (a: T) => T { return null; } + set x(p: (a: U) => U) {} +} \ No newline at end of file From 6618fd21bfe5e34a9d0014d5a60f8ef97e0b91c8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 26 Oct 2015 15:42:02 -0700 Subject: [PATCH 062/140] Added tests for operations that use assignable to/from. --- .../stringLiteralCheckedInIf01.ts | 17 ++++++++++ .../stringLiteralCheckedInIf02.ts | 18 +++++++++++ .../stringLiteralMatchedInSwitch01.ts | 13 ++++++++ .../stringLiteralTypeAssertion01.ts | 31 +++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts new file mode 100644 index 00000000000..093824acf0d --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts @@ -0,0 +1,17 @@ + +type S = "a" | "b"; +type T = S[] | S; + +function f(foo: T) { + if (foo === "a") { + return foo; + } + else if (foo === "b") { + return foo; + } + else { + return (foo as S[])[0]; + } + + throw new Error("Unreachable code hit."); +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts new file mode 100644 index 00000000000..53d625f7200 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts @@ -0,0 +1,18 @@ + +type S = "a" | "b"; +type T = S[] | S; + +function isS(t: T): t is S { + return t === "a" || t === "b"; +} + +function f(foo: T) { + if (isS(foo)) { + return foo; + } + else { + return foo[0]; + } + + throw new Error("Unreachable code hit."); +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts new file mode 100644 index 00000000000..141f5d12795 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts @@ -0,0 +1,13 @@ + +type S = "a" | "b"; +type T = S[] | S; + +var foo: T; +switch (foo) { + case "a": + case "b": + break; + default: + foo = (foo as S[])[0]; + break; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts new file mode 100644 index 00000000000..ec1f1e5eb56 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts @@ -0,0 +1,31 @@ + +type S = "a" | "b"; +type T = S[] | S; + +var s: S; +var t: T; +var str: string; + +//////////////// + +s = t; +s = t as S; + +s = str; +s = str as S; + +//////////////// + +t = s; +t = s as T; + +t = str; +t = str as T; + +//////////////// + +str = s; +str = s as string; + +str = t; +str = t as string; From 5e2314303f89ac4dae495700471c9f6d8f5f3303 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 26 Oct 2015 18:49:41 -0700 Subject: [PATCH 063/140] Accepted baselines. --- .../stringLiteralCheckedInIf01.errors.txt | 26 +++++++++ .../reference/stringLiteralCheckedInIf01.js | 32 +++++++++++ .../stringLiteralCheckedInIf02.errors.txt | 27 +++++++++ .../reference/stringLiteralCheckedInIf02.js | 33 +++++++++++ .../stringLiteralMatchedInSwitch01.errors.txt | 26 +++++++++ .../stringLiteralMatchedInSwitch01.js | 25 +++++++++ .../stringLiteralTypeAssertion01.errors.txt | 55 +++++++++++++++++++ .../reference/stringLiteralTypeAssertion01.js | 53 ++++++++++++++++++ 8 files changed, 277 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf01.js create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf02.js create mode 100644 tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralMatchedInSwitch01.js create mode 100644 tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypeAssertion01.js diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt b/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt new file mode 100644 index 00000000000..fb94cf6bc96 --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts(6,9): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. +tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts(9,14): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts (2 errors) ==== + + type S = "a" | "b"; + type T = S[] | S; + + function f(foo: T) { + if (foo === "a") { + ~~~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + return foo; + } + else if (foo === "b") { + ~~~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + return foo; + } + else { + return (foo as S[])[0]; + } + + throw new Error("Unreachable code hit."); + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.js b/tests/baselines/reference/stringLiteralCheckedInIf01.js new file mode 100644 index 00000000000..227a243133c --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.js @@ -0,0 +1,32 @@ +//// [stringLiteralCheckedInIf01.ts] + +type S = "a" | "b"; +type T = S[] | S; + +function f(foo: T) { + if (foo === "a") { + return foo; + } + else if (foo === "b") { + return foo; + } + else { + return (foo as S[])[0]; + } + + throw new Error("Unreachable code hit."); +} + +//// [stringLiteralCheckedInIf01.js] +function f(foo) { + if (foo === "a") { + return foo; + } + else if (foo === "b") { + return foo; + } + else { + return foo[0]; + } + throw new Error("Unreachable code hit."); +} diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt b/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt new file mode 100644 index 00000000000..ced5adf6263 --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts(6,12): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. +tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts(6,25): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts (2 errors) ==== + + type S = "a" | "b"; + type T = S[] | S; + + function isS(t: T): t is S { + return t === "a" || t === "b"; + ~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + ~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. + } + + function f(foo: T) { + if (isS(foo)) { + return foo; + } + else { + return foo[0]; + } + + throw new Error("Unreachable code hit."); + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.js b/tests/baselines/reference/stringLiteralCheckedInIf02.js new file mode 100644 index 00000000000..b0b3a64116b --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.js @@ -0,0 +1,33 @@ +//// [stringLiteralCheckedInIf02.ts] + +type S = "a" | "b"; +type T = S[] | S; + +function isS(t: T): t is S { + return t === "a" || t === "b"; +} + +function f(foo: T) { + if (isS(foo)) { + return foo; + } + else { + return foo[0]; + } + + throw new Error("Unreachable code hit."); +} + +//// [stringLiteralCheckedInIf02.js] +function isS(t) { + return t === "a" || t === "b"; +} +function f(foo) { + if (isS(foo)) { + return foo; + } + else { + return foo[0]; + } + throw new Error("Unreachable code hit."); +} diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt b/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt new file mode 100644 index 00000000000..17e690715a1 --- /dev/null +++ b/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts(7,10): error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. + Type 'string' is not assignable to type '"b"'. +tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts(8,10): error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. + Type 'string' is not assignable to type '"b"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts (2 errors) ==== + + type S = "a" | "b"; + type T = S[] | S; + + var foo: T; + switch (foo) { + case "a": + ~~~ +!!! error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. +!!! error TS2322: Type 'string' is not assignable to type '"b"'. + case "b": + ~~~ +!!! error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. +!!! error TS2322: Type 'string' is not assignable to type '"b"'. + break; + default: + foo = (foo as S[])[0]; + break; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.js b/tests/baselines/reference/stringLiteralMatchedInSwitch01.js new file mode 100644 index 00000000000..b9b24cf0c66 --- /dev/null +++ b/tests/baselines/reference/stringLiteralMatchedInSwitch01.js @@ -0,0 +1,25 @@ +//// [stringLiteralMatchedInSwitch01.ts] + +type S = "a" | "b"; +type T = S[] | S; + +var foo: T; +switch (foo) { + case "a": + case "b": + break; + default: + foo = (foo as S[])[0]; + break; +} + +//// [stringLiteralMatchedInSwitch01.js] +var foo; +switch (foo) { + case "a": + case "b": + break; + default: + foo = foo[0]; + break; +} diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt b/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt new file mode 100644 index 00000000000..867ad80ee7f --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt @@ -0,0 +1,55 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(22,5): error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. + Type 'string' is not assignable to type '"b"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(23,5): error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. + Type 'string' is not assignable to type '"b"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(30,7): error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. + Type '("a" | "b")[]' is not assignable to type 'string'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(31,7): error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. + Type '("a" | "b")[]' is not assignable to type 'string'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts (4 errors) ==== + + type S = "a" | "b"; + type T = S[] | S; + + var s: S; + var t: T; + var str: string; + + //////////////// + + s = t; + s = t as S; + + s = str; + s = str as S; + + //////////////// + + t = s; + t = s as T; + + t = str; + ~~~~~~ +!!! error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. +!!! error TS2352: Type 'string' is not assignable to type '"b"'. + t = str as T; + ~~~~~~~~ +!!! error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. +!!! error TS2352: Type 'string' is not assignable to type '"b"'. + + //////////////// + + str = s; + str = s as string; + + str = t; + ~~~~~~~~~ +!!! error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. +!!! error TS2352: Type '("a" | "b")[]' is not assignable to type 'string'. + str = t as string; + ~~~~~~~~~~~ +!!! error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. +!!! error TS2352: Type '("a" | "b")[]' is not assignable to type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.js b/tests/baselines/reference/stringLiteralTypeAssertion01.js new file mode 100644 index 00000000000..7877004cf01 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeAssertion01.js @@ -0,0 +1,53 @@ +//// [stringLiteralTypeAssertion01.ts] + +type S = "a" | "b"; +type T = S[] | S; + +var s: S; +var t: T; +var str: string; + +//////////////// + +s = t; +s = t as S; + +s = str; +s = str as S; + +//////////////// + +t = s; +t = s as T; + +t = str; +t = str as T; + +//////////////// + +str = s; +str = s as string; + +str = t; +str = t as string; + + +//// [stringLiteralTypeAssertion01.js] +var s; +var t; +var str; +//////////////// +s = t; +s = t; +s = str; +s = str; +//////////////// +t = s; +t = s; +t = str; +t = str; +//////////////// +str = s; +str = s; +str = t; +str = t; From 062495c426e549ed68b5c75161e94e10be4ed06e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 28 Oct 2015 13:48:32 -0700 Subject: [PATCH 064/140] naive change and new tests --- src/compiler/checker.ts | 6 +++--- .../expressions/typeGuards/typeGuardNesting.ts | 4 ++++ .../expressions/typeGuards/typeGuardRedundancy.ts | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts create mode 100644 tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5370e7c4f02..033614d2b41 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6369,7 +6369,7 @@ namespace ts { // Assumed result is true. If check was not for a primitive type, remove all primitive types if (!typeInfo) { return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, - /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); + /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -6377,12 +6377,12 @@ namespace ts { } // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is // union of enum types and other types. - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ true); } else { // Assumed result is false. If check was for a primitive type, remove that primitive type if (typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true); } // Otherwise we don't have enough information to do anything. return type; diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts new file mode 100644 index 00000000000..b06b5880800 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts @@ -0,0 +1,4 @@ +let strOrBool: string|boolean; +if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { + var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts new file mode 100644 index 00000000000..4e9e3137d78 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts @@ -0,0 +1,9 @@ +var x: string|number; + +var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; + +var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; + +var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; + +var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; \ No newline at end of file From febda00f1b430761df7e0e90bbb99cf8c99e4653 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 28 Oct 2015 16:06:40 -0700 Subject: [PATCH 065/140] Improve type narrowing algorithm with typeof --- src/compiler/checker.ts | 35 +++---- tests/baselines/reference/symbolType18.types | 2 +- tests/baselines/reference/typeGuardNesting.js | 11 +++ .../reference/typeGuardNesting.symbols | 14 +++ .../reference/typeGuardNesting.types | 30 ++++++ .../typeGuardOfFormTypeOfOther.types | 12 +-- .../reference/typeGuardRedundancy.js | 17 ++++ .../reference/typeGuardRedundancy.symbols | 48 ++++++++++ .../reference/typeGuardRedundancy.types | 84 ++++++++++++++++ .../reference/typeGuardsWithAny.errors.txt | 49 ---------- .../reference/typeGuardsWithAny.symbols | 61 ++++++++++++ .../reference/typeGuardsWithAny.types | 96 +++++++++++++++++++ 12 files changed, 382 insertions(+), 77 deletions(-) create mode 100644 tests/baselines/reference/typeGuardNesting.js create mode 100644 tests/baselines/reference/typeGuardNesting.symbols create mode 100644 tests/baselines/reference/typeGuardNesting.types create mode 100644 tests/baselines/reference/typeGuardRedundancy.js create mode 100644 tests/baselines/reference/typeGuardRedundancy.symbols create mode 100644 tests/baselines/reference/typeGuardRedundancy.types delete mode 100644 tests/baselines/reference/typeGuardsWithAny.errors.txt create mode 100644 tests/baselines/reference/typeGuardsWithAny.symbols create mode 100644 tests/baselines/reference/typeGuardsWithAny.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 033614d2b41..ad6e72d68bd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6338,6 +6338,10 @@ namespace ts { // Stop at the first containing function or module declaration break loop; } + // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type + if (narrowedType === getUnionType(emptyArray)) { + narrowedType = type; + } // Use narrowed type if construct contains no assignments to variable if (narrowedType !== type) { if (isVariableAssignedWithin(symbol, node)) { @@ -6352,6 +6356,9 @@ namespace ts { return type; function narrowTypeByEquality(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + if (!(type.flags & TypeFlags.Union)) { + return type; + } // Check that we have 'typeof ' on the left and string literal on the right if (expr.left.kind !== SyntaxKind.TypeOfExpression || expr.right.kind !== SyntaxKind.StringLiteral) { return type; @@ -6361,31 +6368,17 @@ namespace ts { if (left.expression.kind !== SyntaxKind.Identifier || getResolvedSymbol(left.expression) !== symbol) { return type; } - let typeInfo = primitiveTypeInfo[right.text]; if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } + let typeInfo = primitiveTypeInfo[right.text]; + let flags = typeInfo ? typeInfo.flags : (assumeTrue = !assumeTrue, TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol | TypeFlags.Boolean); + let union = type as UnionType; if (assumeTrue) { - // Assumed result is true. If check was not for a primitive type, remove all primitive types - if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, - /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true); - } - // Check was for a primitive type, return that primitive type if it is a subtype - if (isTypeSubtypeOf(typeInfo.type, type)) { - return typeInfo.type; - } - // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is - // union of enum types and other types. - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ true); + return getUnionType(filter(union.types, t => !!(t.flags & flags))); } else { - // Assumed result is false. If check was for a primitive type, remove that primitive type - if (typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true); - } - // Otherwise we don't have enough information to do anything. - return type; + return getUnionType(filter(union.types, t => !(t.flags & flags))); } } @@ -6399,7 +6392,7 @@ namespace ts { // and the second operand was false. We narrow with those assumptions and union the two resulting types. return getUnionType([ narrowType(type, expr.left, /*assumeTrue*/ false), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) + narrowType(type, expr.right, /*assumeTrue*/ false) ]); } } @@ -6410,7 +6403,7 @@ namespace ts { // and the second operand was true. We narrow with those assumptions and union the two resulting types. return getUnionType([ narrowType(type, expr.left, /*assumeTrue*/ true), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) + narrowType(type, expr.right, /*assumeTrue*/ true) ]); } else { diff --git a/tests/baselines/reference/symbolType18.types b/tests/baselines/reference/symbolType18.types index db4fb30378f..68c43215136 100644 --- a/tests/baselines/reference/symbolType18.types +++ b/tests/baselines/reference/symbolType18.types @@ -21,5 +21,5 @@ if (typeof x === "object") { } else { x; ->x : symbol | Foo +>x : symbol } diff --git a/tests/baselines/reference/typeGuardNesting.js b/tests/baselines/reference/typeGuardNesting.js new file mode 100644 index 00000000000..4c9a64c2851 --- /dev/null +++ b/tests/baselines/reference/typeGuardNesting.js @@ -0,0 +1,11 @@ +//// [typeGuardNesting.ts] +let strOrBool: string|boolean; +if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { + var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; +} + +//// [typeGuardNesting.js] +var strOrBool; +if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { + var label = (typeof strOrBool === 'string') ? strOrBool : "other string"; +} diff --git a/tests/baselines/reference/typeGuardNesting.symbols b/tests/baselines/reference/typeGuardNesting.symbols new file mode 100644 index 00000000000..f0cfb1f1eed --- /dev/null +++ b/tests/baselines/reference/typeGuardNesting.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts === +let strOrBool: string|boolean; +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + +if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; +>label : Symbol(label, Decl(typeGuardNesting.ts, 2, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +} diff --git a/tests/baselines/reference/typeGuardNesting.types b/tests/baselines/reference/typeGuardNesting.types new file mode 100644 index 00000000000..9f79974635d --- /dev/null +++ b/tests/baselines/reference/typeGuardNesting.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts === +let strOrBool: string|boolean; +>strOrBool : string | boolean + +if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { +>(typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string' : boolean +>(typeof strOrBool === 'boolean' && !strOrBool) : boolean +>typeof strOrBool === 'boolean' && !strOrBool : boolean +>typeof strOrBool === 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : string | boolean +>'boolean' : string +>!strOrBool : boolean +>strOrBool : boolean +>typeof strOrBool === 'string' : boolean +>typeof strOrBool : string +>strOrBool : string | boolean +>'string' : string + + var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; +>label : string +>(typeof strOrBool === 'string') ? strOrBool : "other string" : string +>(typeof strOrBool === 'string') : boolean +>typeof strOrBool === 'string' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'string' : string +>strOrBool : string +>"other string" : string +} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types index e0fd443ef63..8150c3ec25d 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types @@ -63,7 +63,7 @@ else { var r2: string | C = strOrC; // string | C >r2 : string | C >C : C ->strOrC : string | C +>strOrC : string } if (typeof numOrC === "Object") { >typeof numOrC === "Object" : boolean @@ -80,7 +80,7 @@ else { var r3: number | C = numOrC; // number | C >r3 : number | C >C : C ->numOrC : number | C +>numOrC : number } if (typeof boolOrC === "Object") { >typeof boolOrC === "Object" : boolean @@ -97,7 +97,7 @@ else { var r4: boolean | C = boolOrC; // boolean | C >r4 : boolean | C >C : C ->boolOrC : boolean | C +>boolOrC : boolean } // Narrowing occurs only if target type is a subtype of variable type @@ -129,7 +129,7 @@ if (typeof strOrC !== "Object") { var r2: string | C = strOrC; // string | C >r2 : string | C >C : C ->strOrC : string | C +>strOrC : string } else { c = strOrC; // C @@ -146,7 +146,7 @@ if (typeof numOrC !== "Object") { var r3: number | C = numOrC; // number | C >r3 : number | C >C : C ->numOrC : number | C +>numOrC : number } else { c = numOrC; // C @@ -163,7 +163,7 @@ if (typeof boolOrC !== "Object") { var r4: boolean | C = boolOrC; // boolean | C >r4 : boolean | C >C : C ->boolOrC : boolean | C +>boolOrC : boolean } else { c = boolOrC; // C diff --git a/tests/baselines/reference/typeGuardRedundancy.js b/tests/baselines/reference/typeGuardRedundancy.js new file mode 100644 index 00000000000..1dfa964cbc9 --- /dev/null +++ b/tests/baselines/reference/typeGuardRedundancy.js @@ -0,0 +1,17 @@ +//// [typeGuardRedundancy.ts] +var x: string|number; + +var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; + +var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; + +var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; + +var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; + +//// [typeGuardRedundancy.js] +var x; +var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; +var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; +var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; +var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; diff --git a/tests/baselines/reference/typeGuardRedundancy.symbols b/tests/baselines/reference/typeGuardRedundancy.symbols new file mode 100644 index 00000000000..356061407ad --- /dev/null +++ b/tests/baselines/reference/typeGuardRedundancy.symbols @@ -0,0 +1,48 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts === +var x: string|number; +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) + +var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; +>r1 : Symbol(r1, Decl(typeGuardRedundancy.ts, 2, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x.substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; +>r2 : Symbol(r2, Decl(typeGuardRedundancy.ts, 4, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x.substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) + +var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; +>r3 : Symbol(r3, Decl(typeGuardRedundancy.ts, 6, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x.substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; +>r4 : Symbol(r4, Decl(typeGuardRedundancy.ts, 8, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x.substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardRedundancy.ts, 0, 3)) +>substr : Symbol(String.substr, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/typeGuardRedundancy.types b/tests/baselines/reference/typeGuardRedundancy.types new file mode 100644 index 00000000000..1507ceb850e --- /dev/null +++ b/tests/baselines/reference/typeGuardRedundancy.types @@ -0,0 +1,84 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts === +var x: string|number; +>x : string | number + +var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; +>r1 : (from: number, length?: number) => string +>typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string +>typeof x === "string" && typeof x === "string" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>typeof x === "string" : boolean +>typeof x : string +>x : string +>"string" : string +>x.substr : (from: number, length?: number) => string +>x : string +>substr : (from: number, length?: number) => string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; +>r2 : (fractionDigits?: number) => string +>!(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr : (fractionDigits?: number) => string +>!(typeof x === "string" && typeof x === "string") : boolean +>(typeof x === "string" && typeof x === "string") : boolean +>typeof x === "string" && typeof x === "string" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>typeof x === "string" : boolean +>typeof x : string +>x : string +>"string" : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string +>x.substr : (from: number, length?: number) => string +>x : string +>substr : (from: number, length?: number) => string + +var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; +>r3 : (from: number, length?: number) => string +>typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string +>typeof x === "string" || typeof x === "string" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>typeof x === "string" : boolean +>typeof x : string +>x : number +>"string" : string +>x.substr : (from: number, length?: number) => string +>x : string +>substr : (from: number, length?: number) => string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; +>r4 : (fractionDigits?: number) => string +>!(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr : (fractionDigits?: number) => string +>!(typeof x === "string" || typeof x === "string") : boolean +>(typeof x === "string" || typeof x === "string") : boolean +>typeof x === "string" || typeof x === "string" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>typeof x === "string" : boolean +>typeof x : string +>x : number +>"string" : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string +>x.substr : (from: number, length?: number) => string +>x : string +>substr : (from: number, length?: number) => string + diff --git a/tests/baselines/reference/typeGuardsWithAny.errors.txt b/tests/baselines/reference/typeGuardsWithAny.errors.txt deleted file mode 100644 index 653c89c7554..00000000000 --- a/tests/baselines/reference/typeGuardsWithAny.errors.txt +++ /dev/null @@ -1,49 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(11,7): error TS2339: Property 'p' does not exist on type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(18,7): error TS2339: Property 'p' does not exist on type 'number'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(25,7): error TS2339: Property 'p' does not exist on type 'boolean'. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts (3 errors) ==== - var x: any = { p: 0 }; - - if (x instanceof Object) { - x.p; // No error, type any unaffected by instanceof type guard - } - else { - x.p; // No error, type any unaffected by instanceof type guard - } - - if (typeof x === "string") { - x.p; // Error, type any narrowed by primitive type check - ~ -!!! error TS2339: Property 'p' does not exist on type 'string'. - } - else { - x.p; // No error, type unaffected in this branch - } - - if (typeof x === "number") { - x.p; // Error, type any narrowed by primitive type check - ~ -!!! error TS2339: Property 'p' does not exist on type 'number'. - } - else { - x.p; // No error, type unaffected in this branch - } - - if (typeof x === "boolean") { - x.p; // Error, type any narrowed by primitive type check - ~ -!!! error TS2339: Property 'p' does not exist on type 'boolean'. - } - else { - x.p; // No error, type unaffected in this branch - } - - if (typeof x === "object") { - x.p; // No error, type any only affected by primitive type check - } - else { - x.p; // No error, type unaffected in this branch - } - \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithAny.symbols b/tests/baselines/reference/typeGuardsWithAny.symbols new file mode 100644 index 00000000000..90405d762a1 --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithAny.symbols @@ -0,0 +1,61 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts === +var x: any = { p: 0 }; +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +>p : Symbol(p, Decl(typeGuardsWithAny.ts, 0, 14)) + +if (x instanceof Object) { +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + x.p; // No error, type any unaffected by instanceof type guard +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} +else { + x.p; // No error, type any unaffected by instanceof type guard +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} + +if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) + + x.p; // Error, type any narrowed by primitive type check +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} +else { + x.p; // No error, type unaffected in this branch +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} + +if (typeof x === "number") { +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) + + x.p; // Error, type any narrowed by primitive type check +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} +else { + x.p; // No error, type unaffected in this branch +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} + +if (typeof x === "boolean") { +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) + + x.p; // Error, type any narrowed by primitive type check +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} +else { + x.p; // No error, type unaffected in this branch +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} + +if (typeof x === "object") { +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) + + x.p; // No error, type any only affected by primitive type check +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} +else { + x.p; // No error, type unaffected in this branch +>x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) +} + diff --git a/tests/baselines/reference/typeGuardsWithAny.types b/tests/baselines/reference/typeGuardsWithAny.types new file mode 100644 index 00000000000..12a4326e99d --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithAny.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts === +var x: any = { p: 0 }; +>x : any +>{ p: 0 } : { p: number; } +>p : number +>0 : number + +if (x instanceof Object) { +>x instanceof Object : boolean +>x : any +>Object : ObjectConstructor + + x.p; // No error, type any unaffected by instanceof type guard +>x.p : any +>x : any +>p : any +} +else { + x.p; // No error, type any unaffected by instanceof type guard +>x.p : any +>x : any +>p : any +} + +if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : any +>"string" : string + + x.p; // Error, type any narrowed by primitive type check +>x.p : any +>x : any +>p : any +} +else { + x.p; // No error, type unaffected in this branch +>x.p : any +>x : any +>p : any +} + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : any +>"number" : string + + x.p; // Error, type any narrowed by primitive type check +>x.p : any +>x : any +>p : any +} +else { + x.p; // No error, type unaffected in this branch +>x.p : any +>x : any +>p : any +} + +if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : any +>"boolean" : string + + x.p; // Error, type any narrowed by primitive type check +>x.p : any +>x : any +>p : any +} +else { + x.p; // No error, type unaffected in this branch +>x.p : any +>x : any +>p : any +} + +if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : any +>"object" : string + + x.p; // No error, type any only affected by primitive type check +>x.p : any +>x : any +>p : any +} +else { + x.p; // No error, type unaffected in this branch +>x.p : any +>x : any +>p : any +} + From 168c664639a6c7d01439f39b1d3bd3edd58bada3 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 28 Oct 2015 16:29:36 -0700 Subject: [PATCH 066/140] restore any narrowing --- src/compiler/checker.ts | 11 ++- .../reference/typeGuardsWithAny.errors.txt | 49 ++++++++++ .../reference/typeGuardsWithAny.symbols | 61 ------------ .../reference/typeGuardsWithAny.types | 96 ------------------- 4 files changed, 57 insertions(+), 160 deletions(-) create mode 100644 tests/baselines/reference/typeGuardsWithAny.errors.txt delete mode 100644 tests/baselines/reference/typeGuardsWithAny.symbols delete mode 100644 tests/baselines/reference/typeGuardsWithAny.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ad6e72d68bd..93b644b07a4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6356,9 +6356,6 @@ namespace ts { return type; function narrowTypeByEquality(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { - if (!(type.flags & TypeFlags.Union)) { - return type; - } // Check that we have 'typeof ' on the left and string literal on the right if (expr.left.kind !== SyntaxKind.TypeOfExpression || expr.right.kind !== SyntaxKind.StringLiteral) { return type; @@ -6372,6 +6369,14 @@ namespace ts { assumeTrue = !assumeTrue; } let typeInfo = primitiveTypeInfo[right.text]; + // If the type to be narrowed is any and we're affirmatively checking against a primitive, return the primitive + if (!!(type.flags & TypeFlags.Any) && typeInfo && assumeTrue) { + return typeInfo.type; + } + // At this point we can bail if it's not a union + if (!(type.flags & TypeFlags.Union)) { + return type; + } let flags = typeInfo ? typeInfo.flags : (assumeTrue = !assumeTrue, TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol | TypeFlags.Boolean); let union = type as UnionType; if (assumeTrue) { diff --git a/tests/baselines/reference/typeGuardsWithAny.errors.txt b/tests/baselines/reference/typeGuardsWithAny.errors.txt new file mode 100644 index 00000000000..653c89c7554 --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithAny.errors.txt @@ -0,0 +1,49 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(11,7): error TS2339: Property 'p' does not exist on type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(18,7): error TS2339: Property 'p' does not exist on type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts(25,7): error TS2339: Property 'p' does not exist on type 'boolean'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts (3 errors) ==== + var x: any = { p: 0 }; + + if (x instanceof Object) { + x.p; // No error, type any unaffected by instanceof type guard + } + else { + x.p; // No error, type any unaffected by instanceof type guard + } + + if (typeof x === "string") { + x.p; // Error, type any narrowed by primitive type check + ~ +!!! error TS2339: Property 'p' does not exist on type 'string'. + } + else { + x.p; // No error, type unaffected in this branch + } + + if (typeof x === "number") { + x.p; // Error, type any narrowed by primitive type check + ~ +!!! error TS2339: Property 'p' does not exist on type 'number'. + } + else { + x.p; // No error, type unaffected in this branch + } + + if (typeof x === "boolean") { + x.p; // Error, type any narrowed by primitive type check + ~ +!!! error TS2339: Property 'p' does not exist on type 'boolean'. + } + else { + x.p; // No error, type unaffected in this branch + } + + if (typeof x === "object") { + x.p; // No error, type any only affected by primitive type check + } + else { + x.p; // No error, type unaffected in this branch + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithAny.symbols b/tests/baselines/reference/typeGuardsWithAny.symbols deleted file mode 100644 index 90405d762a1..00000000000 --- a/tests/baselines/reference/typeGuardsWithAny.symbols +++ /dev/null @@ -1,61 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts === -var x: any = { p: 0 }; ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) ->p : Symbol(p, Decl(typeGuardsWithAny.ts, 0, 14)) - -if (x instanceof Object) { ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) ->Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - - x.p; // No error, type any unaffected by instanceof type guard ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} -else { - x.p; // No error, type any unaffected by instanceof type guard ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} - -if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) - - x.p; // Error, type any narrowed by primitive type check ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} -else { - x.p; // No error, type unaffected in this branch ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} - -if (typeof x === "number") { ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) - - x.p; // Error, type any narrowed by primitive type check ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} -else { - x.p; // No error, type unaffected in this branch ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} - -if (typeof x === "boolean") { ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) - - x.p; // Error, type any narrowed by primitive type check ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} -else { - x.p; // No error, type unaffected in this branch ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} - -if (typeof x === "object") { ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) - - x.p; // No error, type any only affected by primitive type check ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} -else { - x.p; // No error, type unaffected in this branch ->x : Symbol(x, Decl(typeGuardsWithAny.ts, 0, 3)) -} - diff --git a/tests/baselines/reference/typeGuardsWithAny.types b/tests/baselines/reference/typeGuardsWithAny.types deleted file mode 100644 index 12a4326e99d..00000000000 --- a/tests/baselines/reference/typeGuardsWithAny.types +++ /dev/null @@ -1,96 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithAny.ts === -var x: any = { p: 0 }; ->x : any ->{ p: 0 } : { p: number; } ->p : number ->0 : number - -if (x instanceof Object) { ->x instanceof Object : boolean ->x : any ->Object : ObjectConstructor - - x.p; // No error, type any unaffected by instanceof type guard ->x.p : any ->x : any ->p : any -} -else { - x.p; // No error, type any unaffected by instanceof type guard ->x.p : any ->x : any ->p : any -} - -if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : any ->"string" : string - - x.p; // Error, type any narrowed by primitive type check ->x.p : any ->x : any ->p : any -} -else { - x.p; // No error, type unaffected in this branch ->x.p : any ->x : any ->p : any -} - -if (typeof x === "number") { ->typeof x === "number" : boolean ->typeof x : string ->x : any ->"number" : string - - x.p; // Error, type any narrowed by primitive type check ->x.p : any ->x : any ->p : any -} -else { - x.p; // No error, type unaffected in this branch ->x.p : any ->x : any ->p : any -} - -if (typeof x === "boolean") { ->typeof x === "boolean" : boolean ->typeof x : string ->x : any ->"boolean" : string - - x.p; // Error, type any narrowed by primitive type check ->x.p : any ->x : any ->p : any -} -else { - x.p; // No error, type unaffected in this branch ->x.p : any ->x : any ->p : any -} - -if (typeof x === "object") { ->typeof x === "object" : boolean ->typeof x : string ->x : any ->"object" : string - - x.p; // No error, type any only affected by primitive type check ->x.p : any ->x : any ->p : any -} -else { - x.p; // No error, type unaffected in this branch ->x.p : any ->x : any ->p : any -} - From c5b47fb5c8ce348a4cec1cd52654995052c20cc2 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 29 Oct 2015 14:53:14 -0700 Subject: [PATCH 067/140] Correct partial signature matching --- src/compiler/checker.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 99b3d97b7be..1fde2711e12 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5603,18 +5603,29 @@ namespace ts { return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } + // A source signature matches a target signature if the two signatures have the same number of required, + // optional, and rest parameters. + function isMatchingSignature(source: Signature, target: Signature) { + return source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter; + } + + // A source signature partially matches a target signature if the target signature has no fewer required + // parameters and no more overall parameters than the source signature (where a signature with a rest + // parameter is always considered to have more overall parameters than one without). + function isPartiallyMatchingSignature(source: Signature, target: Signature) { + return source.minArgumentCount <= target.minArgumentCount && ( + source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length); + } + function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { if (source === target) { return Ternary.True; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { - if (!partialMatch || - source.parameters.length < target.parameters.length && !source.hasRestParameter || - source.minArgumentCount > target.minArgumentCount) { - return Ternary.False; - } + if (!(isMatchingSignature(source, target) || partialMatch && isPartiallyMatchingSignature(source, target))) { + return Ternary.False; } let result = Ternary.True; if (source.typeParameters && target.typeParameters) { From a27ed01516873d2ac0c70b32135eddf30461eba7 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 29 Oct 2015 14:53:28 -0700 Subject: [PATCH 068/140] Adding test --- .../unionTypeCallSignatures4.errors.txt | 41 +++++++++++++++++ .../reference/unionTypeCallSignatures4.js | 45 +++++++++++++++++++ .../types/union/unionTypeCallSignatures4.ts | 25 +++++++++++ 3 files changed, 111 insertions(+) create mode 100644 tests/baselines/reference/unionTypeCallSignatures4.errors.txt create mode 100644 tests/baselines/reference/unionTypeCallSignatures4.js create mode 100644 tests/cases/conformance/types/union/unionTypeCallSignatures4.ts diff --git a/tests/baselines/reference/unionTypeCallSignatures4.errors.txt b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt new file mode 100644 index 00000000000..585906a6b5a --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt @@ -0,0 +1,41 @@ +tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(10,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(20,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(23,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/union/unionTypeCallSignatures4.ts (4 errors) ==== + type F1 = (a: string, b?: string) => void; + type F2 = (a: string, b?: string, c?: string) => void; + type F3 = (a: string, ...rest: string[]) => void; + type F4 = (a: string, b?: string, ...rest: string[]) => void; + type F5 = (a: string, b: string) => void; + + var f12: F1 | F2; + f12("a"); + f12("a", "b"); + f12("a", "b", "c"); // error + ~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + var f34: F3 | F4; + f34("a"); + f34("a", "b"); + f34("a", "b", "c"); + + var f1234: F1 | F2 | F3 | F4; + f1234("a"); + f1234("a", "b"); + f1234("a", "b", "c"); // error + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + var f12345: F1 | F2 | F3 | F4 | F5; + f12345("a"); // error + ~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + f12345("a", "b"); + f12345("a", "b", "c"); // error + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeCallSignatures4.js b/tests/baselines/reference/unionTypeCallSignatures4.js new file mode 100644 index 00000000000..be9a45b33c9 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures4.js @@ -0,0 +1,45 @@ +//// [unionTypeCallSignatures4.ts] +type F1 = (a: string, b?: string) => void; +type F2 = (a: string, b?: string, c?: string) => void; +type F3 = (a: string, ...rest: string[]) => void; +type F4 = (a: string, b?: string, ...rest: string[]) => void; +type F5 = (a: string, b: string) => void; + +var f12: F1 | F2; +f12("a"); +f12("a", "b"); +f12("a", "b", "c"); // error + +var f34: F3 | F4; +f34("a"); +f34("a", "b"); +f34("a", "b", "c"); + +var f1234: F1 | F2 | F3 | F4; +f1234("a"); +f1234("a", "b"); +f1234("a", "b", "c"); // error + +var f12345: F1 | F2 | F3 | F4 | F5; +f12345("a"); // error +f12345("a", "b"); +f12345("a", "b", "c"); // error + + +//// [unionTypeCallSignatures4.js] +var f12; +f12("a"); +f12("a", "b"); +f12("a", "b", "c"); // error +var f34; +f34("a"); +f34("a", "b"); +f34("a", "b", "c"); +var f1234; +f1234("a"); +f1234("a", "b"); +f1234("a", "b", "c"); // error +var f12345; +f12345("a"); // error +f12345("a", "b"); +f12345("a", "b", "c"); // error diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures4.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures4.ts new file mode 100644 index 00000000000..1e27acd2083 --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures4.ts @@ -0,0 +1,25 @@ +type F1 = (a: string, b?: string) => void; +type F2 = (a: string, b?: string, c?: string) => void; +type F3 = (a: string, ...rest: string[]) => void; +type F4 = (a: string, b?: string, ...rest: string[]) => void; +type F5 = (a: string, b: string) => void; + +var f12: F1 | F2; +f12("a"); +f12("a", "b"); +f12("a", "b", "c"); // error + +var f34: F3 | F4; +f34("a"); +f34("a", "b"); +f34("a", "b", "c"); + +var f1234: F1 | F2 | F3 | F4; +f1234("a"); +f1234("a", "b"); +f1234("a", "b", "c"); // error + +var f12345: F1 | F2 | F3 | F4 | F5; +f12345("a"); // error +f12345("a", "b"); +f12345("a", "b", "c"); // error From 9f12bc8a1b0d100e87d336d8303fe5cf9fe09045 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 29 Oct 2015 17:51:36 -0700 Subject: [PATCH 069/140] feedback from pr, new tests --- src/compiler/checker.ts | 61 +++++------ tests/baselines/reference/typeGuardEnums.js | 41 +++++++ .../reference/typeGuardEnums.symbols | 34 ++++++ .../baselines/reference/typeGuardEnums.types | 40 +++++++ tests/baselines/reference/typeGuardNesting.js | 26 ++++- .../reference/typeGuardNesting.symbols | 44 +++++++- .../reference/typeGuardNesting.types | 100 +++++++++++++++++- .../reference/typeGuardOfFormTypeOfOther.js | 24 ++--- .../typeGuardOfFormTypeOfOther.symbols | 18 ++-- .../typeGuardOfFormTypeOfOther.types | 30 +++--- .../typeGuardTautologicalConsistiency.js | 24 +++++ .../typeGuardTautologicalConsistiency.symbols | 23 ++++ .../typeGuardTautologicalConsistiency.types | 36 +++++++ .../expressions/typeGuards/typeGuardEnums.ts | 18 ++++ .../typeGuards/typeGuardNesting.ts | 14 ++- .../typeGuards/typeGuardOfFormTypeOfOther.ts | 12 +-- .../typeGuardTautologicalConsistiency.ts | 11 ++ 17 files changed, 463 insertions(+), 93 deletions(-) create mode 100644 tests/baselines/reference/typeGuardEnums.js create mode 100644 tests/baselines/reference/typeGuardEnums.symbols create mode 100644 tests/baselines/reference/typeGuardEnums.types create mode 100644 tests/baselines/reference/typeGuardTautologicalConsistiency.js create mode 100644 tests/baselines/reference/typeGuardTautologicalConsistiency.symbols create mode 100644 tests/baselines/reference/typeGuardTautologicalConsistiency.types create mode 100644 tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts create mode 100644 tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 93b644b07a4..4e8cb7cc340 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6177,27 +6177,6 @@ namespace ts { Debug.fail("should not get here"); } - // For a union type, remove all constituent types that are of the given type kind (when isOfTypeKind is true) - // or not of the given type kind (when isOfTypeKind is false) - function removeTypesFromUnionType(type: Type, typeKind: TypeFlags, isOfTypeKind: boolean, allowEmptyUnionResult: boolean): Type { - if (type.flags & TypeFlags.Union) { - let types = (type).types; - if (forEach(types, t => !!(t.flags & typeKind) === isOfTypeKind)) { - // Above we checked if we have anything to remove, now use the opposite test to do the removal - let narrowedType = getUnionType(filter(types, t => !(t.flags & typeKind) === isOfTypeKind)); - if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { - return narrowedType; - } - } - } - else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { - // Use getUnionType(emptyArray) instead of emptyObjectType in case the way empty union types - // are represented ever changes. - return getUnionType(emptyArray); - } - return type; - } - function hasInitializer(node: VariableLikeDeclaration): boolean { return !!(node.initializer || isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); } @@ -6296,6 +6275,7 @@ namespace ts { // Get the narrowed type of a given symbol at a given location function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) { let type = getTypeOfSymbol(symbol); + let originalType = type; // Only narrow when symbol is variable of type any or an object, union, or type parameter type if (node && symbol.flags & SymbolFlags.Variable) { if (isTypeAny(type) || type.flags & (TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) { @@ -6338,10 +6318,6 @@ namespace ts { // Stop at the first containing function or module declaration break loop; } - // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type - if (narrowedType === getUnionType(emptyArray)) { - narrowedType = type; - } // Use narrowed type if construct contains no assignments to variable if (narrowedType !== type) { if (isVariableAssignedWithin(symbol, node)) { @@ -6350,6 +6326,11 @@ namespace ts { type = narrowedType; } } + + // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type + if (type === getUnionType(emptyArray)) { + type = originalType; + } } } @@ -6369,22 +6350,24 @@ namespace ts { assumeTrue = !assumeTrue; } let typeInfo = primitiveTypeInfo[right.text]; - // If the type to be narrowed is any and we're affirmatively checking against a primitive, return the primitive + // If the type to be narrowed is any and we're checking a primitive with assumeTrue=true, return the primitive if (!!(type.flags & TypeFlags.Any) && typeInfo && assumeTrue) { return typeInfo.type; } - // At this point we can bail if it's not a union - if (!(type.flags & TypeFlags.Union)) { - return type; - } - let flags = typeInfo ? typeInfo.flags : (assumeTrue = !assumeTrue, TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol | TypeFlags.Boolean); - let union = type as UnionType; - if (assumeTrue) { - return getUnionType(filter(union.types, t => !!(t.flags & flags))); + let flags: TypeFlags; + if (typeInfo) { + flags = typeInfo.flags; } else { - return getUnionType(filter(union.types, t => !(t.flags & flags))); + assumeTrue = !assumeTrue; + flags = TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol | TypeFlags.Boolean; } + // At this point we can bail if it's not a union + if (!(type.flags & TypeFlags.Union)) { + // If the active non-union type would be removed from a union by this type guard, return an empty union + return (assumeTrue === !!(type.flags & flags)) ? type : getUnionType(emptyArray); + } + return getUnionType(filter((type as UnionType).types, t => assumeTrue === !!(t.flags & flags)), /*noSubtypeReduction*/ true); } function narrowTypeByAnd(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { @@ -12554,7 +12537,13 @@ namespace ts { // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - let arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); + let arrayType = arrayOrStringType; + if (arrayOrStringType.flags & TypeFlags.Union) { + arrayType = getUnionType(filter((arrayOrStringType as UnionType).types, t => !(t.flags & TypeFlags.StringLike))); + } + else if (arrayOrStringType.flags & TypeFlags.StringLike) { + arrayType = getUnionType(emptyArray); + } let hasStringConstituent = arrayOrStringType !== arrayType; let reportedError = false; diff --git a/tests/baselines/reference/typeGuardEnums.js b/tests/baselines/reference/typeGuardEnums.js new file mode 100644 index 00000000000..1eb4b7552c4 --- /dev/null +++ b/tests/baselines/reference/typeGuardEnums.js @@ -0,0 +1,41 @@ +//// [typeGuardEnums.ts] +enum E {} +enum V {} + +let x: number|string|E|V; + +if (typeof x === "number") { + x; // number|E|V +} +else { + x; // string +} + +if (typeof x !== "number") { + x; // string +} +else { + x; // number|E|V +} + + +//// [typeGuardEnums.js] +var E; +(function (E) { +})(E || (E = {})); +var V; +(function (V) { +})(V || (V = {})); +var x; +if (typeof x === "number") { + x; // number|E|V +} +else { + x; // string +} +if (typeof x !== "number") { + x; // string +} +else { + x; // number|E|V +} diff --git a/tests/baselines/reference/typeGuardEnums.symbols b/tests/baselines/reference/typeGuardEnums.symbols new file mode 100644 index 00000000000..8f1a396c481 --- /dev/null +++ b/tests/baselines/reference/typeGuardEnums.symbols @@ -0,0 +1,34 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts === +enum E {} +>E : Symbol(E, Decl(typeGuardEnums.ts, 0, 0)) + +enum V {} +>V : Symbol(V, Decl(typeGuardEnums.ts, 0, 9)) + +let x: number|string|E|V; +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) +>E : Symbol(E, Decl(typeGuardEnums.ts, 0, 0)) +>V : Symbol(V, Decl(typeGuardEnums.ts, 0, 9)) + +if (typeof x === "number") { +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) + + x; // number|E|V +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) +} +else { + x; // string +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) +} + +if (typeof x !== "number") { +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) + + x; // string +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) +} +else { + x; // number|E|V +>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3)) +} + diff --git a/tests/baselines/reference/typeGuardEnums.types b/tests/baselines/reference/typeGuardEnums.types new file mode 100644 index 00000000000..1d39a81d78a --- /dev/null +++ b/tests/baselines/reference/typeGuardEnums.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts === +enum E {} +>E : E + +enum V {} +>V : V + +let x: number|string|E|V; +>x : number | string | E | V +>E : E +>V : V + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | E | V +>"number" : string + + x; // number|E|V +>x : number | E | V +} +else { + x; // string +>x : string +} + +if (typeof x !== "number") { +>typeof x !== "number" : boolean +>typeof x : string +>x : number | string | E | V +>"number" : string + + x; // string +>x : string +} +else { + x; // number|E|V +>x : number | E | V +} + diff --git a/tests/baselines/reference/typeGuardNesting.js b/tests/baselines/reference/typeGuardNesting.js index 4c9a64c2851..364653d0273 100644 --- a/tests/baselines/reference/typeGuardNesting.js +++ b/tests/baselines/reference/typeGuardNesting.js @@ -1,11 +1,31 @@ //// [typeGuardNesting.ts] let strOrBool: string|boolean; if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { - var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; -} + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +} + +if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +} + //// [typeGuardNesting.js] var strOrBool; if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { - var label = (typeof strOrBool === 'string') ? strOrBool : "other string"; + var label = (typeof strOrBool === 'string') ? strOrBool : "string"; + var bool = (typeof strOrBool === 'boolean') ? strOrBool : false; + var label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + var bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; +} +if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { + var label = (typeof strOrBool === 'string') ? strOrBool : "string"; + var bool = (typeof strOrBool === 'boolean') ? strOrBool : false; + var label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + var bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; } diff --git a/tests/baselines/reference/typeGuardNesting.symbols b/tests/baselines/reference/typeGuardNesting.symbols index f0cfb1f1eed..427db81f3ed 100644 --- a/tests/baselines/reference/typeGuardNesting.symbols +++ b/tests/baselines/reference/typeGuardNesting.symbols @@ -7,8 +7,50 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) >strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) - var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; >label : Symbol(label, Decl(typeGuardNesting.ts, 2, 4)) >strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; +>bool : Symbol(bool, Decl(typeGuardNesting.ts, 3, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; +>label2 : Symbol(label2, Decl(typeGuardNesting.ts, 4, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +>bool2 : Symbol(bool2, Decl(typeGuardNesting.ts, 5, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) >strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) } + +if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; +>label : Symbol(label, Decl(typeGuardNesting.ts, 9, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; +>bool : Symbol(bool, Decl(typeGuardNesting.ts, 10, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; +>label2 : Symbol(label2, Decl(typeGuardNesting.ts, 11, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) + + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +>bool2 : Symbol(bool2, Decl(typeGuardNesting.ts, 12, 4)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3)) +} + diff --git a/tests/baselines/reference/typeGuardNesting.types b/tests/baselines/reference/typeGuardNesting.types index 9f79974635d..255e96da89e 100644 --- a/tests/baselines/reference/typeGuardNesting.types +++ b/tests/baselines/reference/typeGuardNesting.types @@ -17,14 +17,108 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >strOrBool : string | boolean >'string' : string - var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; >label : string ->(typeof strOrBool === 'string') ? strOrBool : "other string" : string +>(typeof strOrBool === 'string') ? strOrBool : "string" : string >(typeof strOrBool === 'string') : boolean >typeof strOrBool === 'string' : boolean >typeof strOrBool : string >strOrBool : boolean | string >'string' : string >strOrBool : string ->"other string" : string +>"string" : string + + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; +>bool : boolean +>(typeof strOrBool === 'boolean') ? strOrBool : false : boolean +>(typeof strOrBool === 'boolean') : boolean +>typeof strOrBool === 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'boolean' : string +>strOrBool : boolean +>false : boolean + + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; +>label2 : string +>(typeof strOrBool !== 'boolean') ? strOrBool : "string" : string +>(typeof strOrBool !== 'boolean') : boolean +>typeof strOrBool !== 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'boolean' : string +>strOrBool : string +>"string" : string + + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +>bool2 : boolean +>(typeof strOrBool !== 'string') ? strOrBool : false : boolean +>(typeof strOrBool !== 'string') : boolean +>typeof strOrBool !== 'string' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'string' : string +>strOrBool : boolean +>false : boolean } + +if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { +>(typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean' : boolean +>(typeof strOrBool !== 'string' && !strOrBool) : boolean +>typeof strOrBool !== 'string' && !strOrBool : boolean +>typeof strOrBool !== 'string' : boolean +>typeof strOrBool : string +>strOrBool : string | boolean +>'string' : string +>!strOrBool : boolean +>strOrBool : boolean +>typeof strOrBool !== 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : string | boolean +>'boolean' : string + + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; +>label : string +>(typeof strOrBool === 'string') ? strOrBool : "string" : string +>(typeof strOrBool === 'string') : boolean +>typeof strOrBool === 'string' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'string' : string +>strOrBool : string +>"string" : string + + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; +>bool : boolean +>(typeof strOrBool === 'boolean') ? strOrBool : false : boolean +>(typeof strOrBool === 'boolean') : boolean +>typeof strOrBool === 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'boolean' : string +>strOrBool : boolean +>false : boolean + + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; +>label2 : string +>(typeof strOrBool !== 'boolean') ? strOrBool : "string" : string +>(typeof strOrBool !== 'boolean') : boolean +>typeof strOrBool !== 'boolean' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'boolean' : string +>strOrBool : string +>"string" : string + + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +>bool2 : boolean +>(typeof strOrBool !== 'string') ? strOrBool : false : boolean +>(typeof strOrBool !== 'string') : boolean +>typeof strOrBool !== 'string' : boolean +>typeof strOrBool : string +>strOrBool : boolean | string +>'string' : string +>strOrBool : boolean +>false : boolean +} + diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js index 3bb1a2091f6..d1cb4994196 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js @@ -23,19 +23,19 @@ if (typeof strOrC === "Object") { c = strOrC; // C } else { - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string } if (typeof numOrC === "Object") { c = numOrC; // C } else { - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number } if (typeof boolOrC === "Object") { c = boolOrC; // C } else { - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean } // Narrowing occurs only if target type is a subtype of variable type @@ -50,19 +50,19 @@ else { // - when true, narrows the type of x by typeof x === s when false, or // - when false, narrows the type of x by typeof x === s when true. if (typeof strOrC !== "Object") { - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string } else { c = strOrC; // C } if (typeof numOrC !== "Object") { - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number } else { c = numOrC; // C } if (typeof boolOrC !== "Object") { - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean } else { c = boolOrC; // C @@ -104,19 +104,19 @@ if (typeof strOrC === "Object") { c = strOrC; // C } else { - var r2 = strOrC; // string | C + var r2 = strOrC; // string } if (typeof numOrC === "Object") { c = numOrC; // C } else { - var r3 = numOrC; // number | C + var r3 = numOrC; // number } if (typeof boolOrC === "Object") { c = boolOrC; // C } else { - var r4 = boolOrC; // boolean | C + var r4 = boolOrC; // boolean } // Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { @@ -129,19 +129,19 @@ else { // - when true, narrows the type of x by typeof x === s when false, or // - when false, narrows the type of x by typeof x === s when true. if (typeof strOrC !== "Object") { - var r2 = strOrC; // string | C + var r2 = strOrC; // string } else { c = strOrC; // C } if (typeof numOrC !== "Object") { - var r3 = numOrC; // number | C + var r3 = numOrC; // number } else { c = numOrC; // C } if (typeof boolOrC !== "Object") { - var r4 = boolOrC; // boolean | C + var r4 = boolOrC; // boolean } else { c = boolOrC; // C diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols index e3ecffdc2e9..eb120d468dc 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols @@ -56,9 +56,8 @@ if (typeof strOrC === "Object") { >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) } else { - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string >r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 51, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) } if (typeof numOrC === "Object") { @@ -69,9 +68,8 @@ if (typeof numOrC === "Object") { >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) } else { - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number >r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 57, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) } if (typeof boolOrC === "Object") { @@ -82,9 +80,8 @@ if (typeof boolOrC === "Object") { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } else { - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean >r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 63, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } @@ -108,9 +105,8 @@ else { if (typeof strOrC !== "Object") { >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string >r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 51, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) } else { @@ -121,9 +117,8 @@ else { if (typeof numOrC !== "Object") { >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number >r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 57, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) } else { @@ -134,9 +129,8 @@ else { if (typeof boolOrC !== "Object") { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean >r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 63, 7)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } else { diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types index 8150c3ec25d..5cec3567194 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types @@ -60,9 +60,8 @@ if (typeof strOrC === "Object") { >strOrC : C } else { - var r2: string | C = strOrC; // string | C ->r2 : string | C ->C : C + var r2: string = strOrC; // string +>r2 : string >strOrC : string } if (typeof numOrC === "Object") { @@ -77,9 +76,8 @@ if (typeof numOrC === "Object") { >numOrC : C } else { - var r3: number | C = numOrC; // number | C ->r3 : number | C ->C : C + var r3: number = numOrC; // number +>r3 : number >numOrC : number } if (typeof boolOrC === "Object") { @@ -94,9 +92,8 @@ if (typeof boolOrC === "Object") { >boolOrC : C } else { - var r4: boolean | C = boolOrC; // boolean | C ->r4 : boolean | C ->C : C + var r4: boolean = boolOrC; // boolean +>r4 : boolean >boolOrC : boolean } @@ -126,9 +123,8 @@ if (typeof strOrC !== "Object") { >strOrC : string | C >"Object" : string - var r2: string | C = strOrC; // string | C ->r2 : string | C ->C : C + var r2: string = strOrC; // string +>r2 : string >strOrC : string } else { @@ -143,9 +139,8 @@ if (typeof numOrC !== "Object") { >numOrC : number | C >"Object" : string - var r3: number | C = numOrC; // number | C ->r3 : number | C ->C : C + var r3: number = numOrC; // number +>r3 : number >numOrC : number } else { @@ -160,9 +155,8 @@ if (typeof boolOrC !== "Object") { >boolOrC : boolean | C >"Object" : string - var r4: boolean | C = boolOrC; // boolean | C ->r4 : boolean | C ->C : C + var r4: boolean = boolOrC; // boolean +>r4 : boolean >boolOrC : boolean } else { diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.js b/tests/baselines/reference/typeGuardTautologicalConsistiency.js new file mode 100644 index 00000000000..1b7fa2021c5 --- /dev/null +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.js @@ -0,0 +1,24 @@ +//// [typeGuardTautologicalConsistiency.ts] +let stringOrNumber: string | number; + +if (typeof stringOrNumber === "number") { + if (typeof stringOrNumber !== "number") { + stringOrNumber; + } +} + +if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { + stringOrNumber; +} + + +//// [typeGuardTautologicalConsistiency.js] +var stringOrNumber; +if (typeof stringOrNumber === "number") { + if (typeof stringOrNumber !== "number") { + stringOrNumber; + } +} +if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { + stringOrNumber; +} diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.symbols b/tests/baselines/reference/typeGuardTautologicalConsistiency.symbols new file mode 100644 index 00000000000..9ee82a5413f --- /dev/null +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts === +let stringOrNumber: string | number; +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) + +if (typeof stringOrNumber === "number") { +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) + + if (typeof stringOrNumber !== "number") { +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) + + stringOrNumber; +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) + } +} + +if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) + + stringOrNumber; +>stringOrNumber : Symbol(stringOrNumber, Decl(typeGuardTautologicalConsistiency.ts, 0, 3)) +} + diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.types b/tests/baselines/reference/typeGuardTautologicalConsistiency.types new file mode 100644 index 00000000000..9acb1464761 --- /dev/null +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts === +let stringOrNumber: string | number; +>stringOrNumber : string | number + +if (typeof stringOrNumber === "number") { +>typeof stringOrNumber === "number" : boolean +>typeof stringOrNumber : string +>stringOrNumber : string | number +>"number" : string + + if (typeof stringOrNumber !== "number") { +>typeof stringOrNumber !== "number" : boolean +>typeof stringOrNumber : string +>stringOrNumber : number +>"number" : string + + stringOrNumber; +>stringOrNumber : string + } +} + +if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { +>typeof stringOrNumber === "number" && typeof stringOrNumber !== "number" : boolean +>typeof stringOrNumber === "number" : boolean +>typeof stringOrNumber : string +>stringOrNumber : string | number +>"number" : string +>typeof stringOrNumber !== "number" : boolean +>typeof stringOrNumber : string +>stringOrNumber : number +>"number" : string + + stringOrNumber; +>stringOrNumber : number +} + diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts new file mode 100644 index 00000000000..54e9a1bd8fe --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts @@ -0,0 +1,18 @@ +enum E {} +enum V {} + +let x: number|string|E|V; + +if (typeof x === "number") { + x; // number|E|V +} +else { + x; // string +} + +if (typeof x !== "number") { + x; // string +} +else { + x; // number|E|V +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts index b06b5880800..6423af18a5a 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts @@ -1,4 +1,14 @@ let strOrBool: string|boolean; if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { - var label: string = (typeof strOrBool === 'string') ? strOrBool : "other string"; -} \ No newline at end of file + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +} + +if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { + let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false; +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts index 9d7d555fc18..ac3403d8151 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts @@ -22,19 +22,19 @@ if (typeof strOrC === "Object") { c = strOrC; // C } else { - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string } if (typeof numOrC === "Object") { c = numOrC; // C } else { - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number } if (typeof boolOrC === "Object") { c = boolOrC; // C } else { - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean } // Narrowing occurs only if target type is a subtype of variable type @@ -49,19 +49,19 @@ else { // - when true, narrows the type of x by typeof x === s when false, or // - when false, narrows the type of x by typeof x === s when true. if (typeof strOrC !== "Object") { - var r2: string | C = strOrC; // string | C + var r2: string = strOrC; // string } else { c = strOrC; // C } if (typeof numOrC !== "Object") { - var r3: number | C = numOrC; // number | C + var r3: number = numOrC; // number } else { c = numOrC; // C } if (typeof boolOrC !== "Object") { - var r4: boolean | C = boolOrC; // boolean | C + var r4: boolean = boolOrC; // boolean } else { c = boolOrC; // C diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts new file mode 100644 index 00000000000..9a44603d2d4 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardTautologicalConsistiency.ts @@ -0,0 +1,11 @@ +let stringOrNumber: string | number; + +if (typeof stringOrNumber === "number") { + if (typeof stringOrNumber !== "number") { + stringOrNumber; + } +} + +if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { + stringOrNumber; +} From 19e796dcbd61d77601f27c9cb4bd4fea396d633d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 29 Oct 2015 18:46:06 -0700 Subject: [PATCH 070/140] More correctness --- src/compiler/checker.ts | 72 +++++++++++-------- .../typeGuardTautologicalConsistiency.types | 4 +- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4e8cb7cc340..30edecf3b40 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6275,37 +6275,19 @@ namespace ts { // Get the narrowed type of a given symbol at a given location function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) { let type = getTypeOfSymbol(symbol); - let originalType = type; // Only narrow when symbol is variable of type any or an object, union, or type parameter type if (node && symbol.flags & SymbolFlags.Variable) { if (isTypeAny(type) || type.flags & (TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) { + let originalType = type; + let nodeStack: {node: Node, child: Node}[] = []; loop: while (node.parent) { let child = node; node = node.parent; - let narrowedType = type; switch (node.kind) { case SyntaxKind.IfStatement: - // In a branch of an if statement, narrow based on controlling expression - if (child !== (node).expression) { - narrowedType = narrowType(type, (node).expression, /*assumeTrue*/ child === (node).thenStatement); - } - break; case SyntaxKind.ConditionalExpression: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== (node).condition) { - narrowedType = narrowType(type, (node).condition, /*assumeTrue*/ child === (node).whenTrue); - } - break; case SyntaxKind.BinaryExpression: - // In the right operand of an && or ||, narrow based on left operand - if (child === (node).right) { - if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { - narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); - } - else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { - narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); - } - } + nodeStack.push({node, child}); break; case SyntaxKind.SourceFile: case SyntaxKind.ModuleDeclaration: @@ -6318,12 +6300,42 @@ namespace ts { // Stop at the first containing function or module declaration break loop; } - // Use narrowed type if construct contains no assignments to variable - if (narrowedType !== type) { - if (isVariableAssignedWithin(symbol, node)) { + } + + let nodes: {node: Node, child: Node}; + while (nodes = nodeStack.pop()) { + let {node, child} = nodes; + switch (node.kind) { + case SyntaxKind.IfStatement: + // In a branch of an if statement, narrow based on controlling expression + if (child !== (node).expression) { + type = narrowType(type, (node).expression, /*assumeTrue*/ child === (node).thenStatement); + } break; - } - type = narrowedType; + case SyntaxKind.ConditionalExpression: + // In a branch of a conditional expression, narrow based on controlling condition + if (child !== (node).condition) { + type = narrowType(type, (node).condition, /*assumeTrue*/ child === (node).whenTrue); + } + break; + case SyntaxKind.BinaryExpression: + // In the right operand of an && or ||, narrow based on left operand + if (child === (node).right) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { + type = narrowType(type, (node).left, /*assumeTrue*/ true); + } + else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { + type = narrowType(type, (node).left, /*assumeTrue*/ false); + } + } + break; + default: + Debug.fail("Unreachable!"); + } + + // Use original type if construct contains assignments to variable + if (!nodeStack.length && isVariableAssignedWithin(symbol, node)) { + type = originalType; } } @@ -6365,9 +6377,13 @@ namespace ts { // At this point we can bail if it's not a union if (!(type.flags & TypeFlags.Union)) { // If the active non-union type would be removed from a union by this type guard, return an empty union - return (assumeTrue === !!(type.flags & flags)) ? type : getUnionType(emptyArray); + return filterUnion(type) ? type : getUnionType(emptyArray); + } + return getUnionType(filter((type as UnionType).types, filterUnion), /*noSubtypeReduction*/ true); + + function filterUnion(t: Type) { + return assumeTrue === !!(t.flags & flags); } - return getUnionType(filter((type as UnionType).types, t => assumeTrue === !!(t.flags & flags)), /*noSubtypeReduction*/ true); } function narrowTypeByAnd(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.types b/tests/baselines/reference/typeGuardTautologicalConsistiency.types index 9acb1464761..d758dcde22b 100644 --- a/tests/baselines/reference/typeGuardTautologicalConsistiency.types +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.types @@ -15,7 +15,7 @@ if (typeof stringOrNumber === "number") { >"number" : string stringOrNumber; ->stringOrNumber : string +>stringOrNumber : string | number } } @@ -31,6 +31,6 @@ if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { >"number" : string stringOrNumber; ->stringOrNumber : number +>stringOrNumber : string | number } From 0d0c05d1d3c4ef94fc15d17b5f2602729539ec8e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 29 Oct 2015 18:50:11 -0700 Subject: [PATCH 071/140] that feling when you ctrl-z 1 too many times --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 30edecf3b40..8ae8ab3d54c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6334,7 +6334,7 @@ namespace ts { } // Use original type if construct contains assignments to variable - if (!nodeStack.length && isVariableAssignedWithin(symbol, node)) { + if (type != originalType && isVariableAssignedWithin(symbol, node)) { type = originalType; } } From 95a3fc71435518645163344955fdef69bbf70f07 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 30 Oct 2015 14:52:45 -0700 Subject: [PATCH 072/140] feedback form pr, new baselines --- src/compiler/emitter.ts | 52 +- src/compiler/program.ts | 2 +- src/harness/harness.ts | 2 +- src/harness/projectsRunner.ts | 5 +- .../baselines/reference/isolatedModulesOut.js | 2 - .../baselines/reference/outModuleConcatAmd.js | 34 +- .../reference/outModuleConcatAmd.js.map | 4 +- .../outModuleConcatAmd.sourcemap.txt | 169 ----- .../reference/outModuleConcatCommonjs.js | 32 +- .../reference/outModuleConcatCommonjs.js.map | 4 +- .../outModuleConcatCommonjs.sourcemap.txt | 194 ------ .../baselines/reference/outModuleConcatES6.js | 17 +- .../reference/outModuleConcatES6.js.map | 4 +- .../outModuleConcatES6.sourcemap.txt | 97 --- .../reference/outModuleConcatSystem.js | 50 +- .../reference/outModuleConcatSystem.js.map | 4 +- .../outModuleConcatSystem.sourcemap.txt | 179 ----- .../baselines/reference/outModuleConcatUmd.js | 50 +- .../reference/outModuleConcatUmd.js.map | 4 +- .../outModuleConcatUmd.sourcemap.txt | 211 ------ .../reference/outModuleTripleSlashRefs.js | 37 +- .../reference/outModuleTripleSlashRefs.js.map | 4 +- .../outModuleTripleSlashRefs.sourcemap.txt | 184 ------ ...tePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...tePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...lutePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...lutePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...vePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...vePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...tivePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...tivePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...prootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...prootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...erootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...erootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../outMixedSubfolderSpecifyOutputFile.json | 2 - .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 14 - .../outMixedSubfolderSpecifyOutputFile.json | 2 - .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 12 - ...erSpecifyOutputFileAndOutputDirectory.json | 2 - .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 14 - ...erSpecifyOutputFileAndOutputDirectory.json | 2 - .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 12 - .../amd/diskFile0.js | 14 - .../amd/diskFile1.d.ts | 6 - ...outModuleMultifolderSpecifyOutputFile.json | 6 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 14 - .../amd/test.d.ts | 10 - .../amd/test.js | 16 - .../node/diskFile0.js | 12 - .../node/diskFile1.d.ts | 6 - ...outModuleMultifolderSpecifyOutputFile.json | 6 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 12 - .../node/test.d.ts | 10 - .../node/test.js | 16 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 14 - .../amd/outModuleSimpleSpecifyOutputFile.json | 4 - .../amd/test.d.ts | 8 - .../amd/test.js | 15 - .../node/m1.d.ts | 6 - .../node/m1.js | 12 - .../outModuleSimpleSpecifyOutputFile.json | 4 - .../node/test.d.ts | 8 - .../node/test.js | 14 - .../outModuleSubfolderSpecifyOutputFile.json | 4 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 14 - .../amd/test.d.ts | 8 - .../amd/test.js | 15 - .../outModuleSubfolderSpecifyOutputFile.json | 4 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 12 - .../node/test.d.ts | 8 - .../node/test.js | 14 - .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...tePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...tePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...lutePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...lutePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...vePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...vePathMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...athModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...tivePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...tivePathModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...ePathModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...rcemapMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...rcemapMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...mapModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...mapModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...ourcemapModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...ourcemapModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...cemapModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...cemapModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m2.d.ts | 6 - .../amd/ref/m2.js | 15 - .../amd/ref/m2.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 172 ----- .../node/ref/m2.d.ts | 6 - .../node/ref/m2.js | 13 - .../node/ref/m2.js.map | 1 - ...ootUrlMixedSubfolderSpecifyOutputFile.json | 3 - ...edSubfolderSpecifyOutputFile.sourcemap.txt | 171 ----- .../amd/outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../amd/outdir/outAndOutDirFolder/ref/m2.js | 15 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 172 ----- .../outdir/outAndOutDirFolder/ref/m2.d.ts | 6 - .../node/outdir/outAndOutDirFolder/ref/m2.js | 13 - .../outdir/outAndOutDirFolder/ref/m2.js.map | 1 - ...erSpecifyOutputFileAndOutputDirectory.json | 3 - ...OutputFileAndOutputDirectory.sourcemap.txt | 171 ----- .../amd/diskFile0.js.map | 1 - .../amd/diskFile1.js | 15 - .../amd/diskFile2.d.ts | 6 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 569 ---------------- .../amd/test.d.ts | 10 - .../amd/test.js | 17 - .../amd/test.js.map | 1 - .../node/diskFile0.js.map | 1 - .../node/diskFile1.js | 13 - .../node/diskFile2.d.ts | 6 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...UrlModuleMultifolderSpecifyOutputFile.json | 9 - ...MultifolderSpecifyOutputFile.sourcemap.txt | 613 ------------------ .../node/test.d.ts | 10 - .../node/test.js | 17 - .../node/test.js.map | 1 - .../amd/m1.d.ts | 6 - .../amd/m1.js | 15 - .../amd/m1.js.map | 1 - ...erootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/m1.d.ts | 6 - .../node/m1.js | 13 - .../node/m1.js.map | 1 - ...erootUrlModuleSimpleSpecifyOutputFile.json | 6 - ...oduleSimpleSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - .../amd/ref/m1.d.ts | 6 - .../amd/ref/m1.js | 15 - .../amd/ref/m1.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 371 ----------- .../amd/test.d.ts | 8 - .../amd/test.js | 16 - .../amd/test.js.map | 1 - .../node/ref/m1.d.ts | 6 - .../node/ref/m1.js | 13 - .../node/ref/m1.js.map | 1 - ...otUrlModuleSubfolderSpecifyOutputFile.json | 6 - ...leSubfolderSpecifyOutputFile.sourcemap.txt | 392 ----------- .../node/test.d.ts | 8 - .../node/test.js | 15 - .../node/test.js.map | 1 - 661 files changed, 45 insertions(+), 32534 deletions(-) delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile0.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile0.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js delete mode 100644 tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e9ea99dc2d5..1343a5c85d9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -326,17 +326,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let newLine = host.getNewLine(); let jsxDesugaring = host.getCompilerOptions().jsx !== JsxEmit.Preserve; let shouldEmitJsx = (s: SourceFile) => (s.languageVariant === LanguageVariant.JSX && !jsxDesugaring); + let outFile = compilerOptions.outFile || compilerOptions.out; if (targetSourceFile === undefined) { - forEach(host.getSourceFiles(), sourceFile => { - if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { - let jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); + if (outFile) { + emitFile(outFile); + } + else { + forEach(host.getSourceFiles(), sourceFile => { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + let jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); } } else { @@ -345,8 +347,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); + else if (!isDeclarationFile(targetSourceFile) && outFile) { + emitFile(outFile); } } @@ -547,7 +549,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi /** If removeComments is true, no leading-comments needed to be emitted **/ let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker; - let moduleEmitDelegates: Map<(node: SourceFile, resolvePath?: boolean) => void> = { + let moduleEmitDelegates: Map<(node: SourceFile, resolveModuleNames?: boolean) => void> = { [ModuleKind.ES6]: emitES6Module, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, @@ -555,7 +557,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi [ModuleKind.CommonJS]: emitCommonJSModule, }; - let bundleEmitDelegates: Map<(node: SourceFile, resolvePath?: boolean) => void> = { + let bundleEmitDelegates: Map<(node: SourceFile, resolveModuleNames?: boolean) => void> = { [ModuleKind.ES6]() {}, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, @@ -7280,7 +7282,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("}"); // execute } - function emitSystemModule(node: SourceFile, resolvePath?: boolean): void { + function emitSystemModule(node: SourceFile, resolveModuleNames?: boolean): void { collectExternalModuleInfo(node); // System modules has the following shape // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) @@ -7320,7 +7322,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(", "); } - if (resolvePath) { + if (resolveModuleNames) { let name = lookupSpecifierName(externalImports[i]); if (name) { text = `"${name}"`; @@ -7346,15 +7348,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi specifier = (declaration as ImportEqualsDeclaration).moduleReference; } else { - specifier = (declaration as ImportDeclaration|ExportDeclaration).moduleSpecifier; + specifier = (declaration as ImportDeclaration | ExportDeclaration).moduleSpecifier; } let moduleSymbol = resolver.getSymbolAtLocation(specifier); if (!moduleSymbol) { - return; + return undefined; } let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) { - return; + return undefined; } return getExternalModuleNameFromPath(host, moduleDeclaration.fileName); } @@ -7365,7 +7367,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi importAliasNames: string[]; } - function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, resolvePath?: boolean): AMDDependencyNames { + function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, resolveModuleNames?: boolean): AMDDependencyNames { // names of modules with corresponding parameter in the factory function let aliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in factory function @@ -7389,7 +7391,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Find the name of the external module let externalModuleName = getExternalModuleNameText(importNode); - if (resolvePath) { + if (resolveModuleNames) { let name = lookupSpecifierName(importNode); if (name) { externalModuleName = `"${name}"`; @@ -7410,7 +7412,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return { aliasedModuleNames, unaliasedModuleNames, importAliasNames }; } - function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean, resolvePath?: boolean) { + function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean, resolveModuleNames?: boolean) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // @@ -7423,7 +7425,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, resolvePath); + let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, resolveModuleNames); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -7451,7 +7453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(") {"); } - function emitAMDModule(node: SourceFile, resolvePath?: boolean) { + function emitAMDModule(node: SourceFile, resolveModuleNames?: boolean) { emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -7460,7 +7462,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (node.moduleName) { write("\"" + node.moduleName + "\", "); } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, resolvePath); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, resolveModuleNames); increaseIndent(); let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); @@ -7714,7 +7716,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitModule(node); } else { - bundleEmitDelegates[modulekind](node, /*resolvePath*/true); + bundleEmitDelegates[modulekind](node, /*resolveModuleNames*/true); } } else { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5b28dac9c09..6a6e8d5bca6 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1036,7 +1036,7 @@ namespace ts { } // Cannot specify module gen that isn't amd or system with --out - if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.System) { + if (outFile && options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 41356e47e1c..91f7e46f845 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1169,7 +1169,7 @@ namespace Harness { } else if (isTS(file.unitName)) { let declFile = findResultCodeFile(file.unitName); - if (!findUnit(declFile.fileName, declInputFiles) && !findUnit(declFile.fileName, declOtherFiles)) { + if (declFile && !findUnit(declFile.fileName, declInputFiles) && !findUnit(declFile.fileName, declOtherFiles)) { dtsFiles.push({ unitName: declFile.fileName, content: declFile.code }); } } diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index ace19acc1e0..036e3e0b054 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -303,7 +303,10 @@ class ProjectRunner extends RunnerBase { } let outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts"; - allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName)); + let file = findOutpuDtsFile(outputDtsFileName); + if (file) { + allInputFiles.unshift(file); + } } else { let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; diff --git a/tests/baselines/reference/isolatedModulesOut.js b/tests/baselines/reference/isolatedModulesOut.js index ca5eb2b7579..44f319e1031 100644 --- a/tests/baselines/reference/isolatedModulesOut.js +++ b/tests/baselines/reference/isolatedModulesOut.js @@ -6,7 +6,5 @@ export var x; //// [file2.ts] var y; -//// [file1.js] -export var x; //// [all.js] var y; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 5d825757b71..a1c874abb7c 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -8,32 +8,7 @@ export class A { } import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -define(["require", "exports"], function (require, exports) { - var A = (function () { - function A() { - } - return A; - })(); - exports.A = A; -}); -//# sourceMappingURL=a.js.map//// [b.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -define(["require", "exports", "./ref/a"], function (require, exports, a_1) { - var B = (function (_super) { - __extends(B, _super); - function B() { - _super.apply(this, arguments); - } - return B; - })(a_1.A); - exports.B = B; -}); -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -59,13 +34,6 @@ define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/re }); //# sourceMappingURL=all.js.map -//// [a.d.ts] -export declare class A { -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] declare module "tests/cases/compiler/ref/a" { export class A { diff --git a/tests/baselines/reference/outModuleConcatAmd.js.map b/tests/baselines/reference/outModuleConcatAmd.js.map index 88e6fa81885..44cd5ce9955 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js.map +++ b/tests/baselines/reference/outModuleConcatAmd.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";IACA;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;IACA;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":";;;;;;IACA;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA;;;ICAlB;QAAuBE,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index 4ec8e34e8e1..eec3a6014aa 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -1,173 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> var A = (function () { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(2, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(3, 9) Source(2, 1) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class A { -2 > } -1->Emitted(4, 9) Source(2, 18) + SourceIndex(0) name (A.constructor) -2 >Emitted(4, 10) Source(2, 19) + SourceIndex(0) name (A.constructor) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(5, 9) Source(2, 18) + SourceIndex(0) name (A) -2 >Emitted(5, 17) Source(2, 19) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class A { } -1 >Emitted(6, 5) Source(2, 18) + SourceIndex(0) name (A) -2 >Emitted(6, 6) Source(2, 19) + SourceIndex(0) name (A) -3 >Emitted(6, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 10) Source(2, 19) + SourceIndex(0) ---- ->>> exports.A = A; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > A -3 > { } -4 > -1->Emitted(7, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 15) + SourceIndex(0) -3 >Emitted(7, 18) Source(2, 19) + SourceIndex(0) -4 >Emitted(7, 19) Source(2, 19) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; ->>>define(["require", "exports", "./ref/a"], function (require, exports, a_1) { ->>> var B = (function (_super) { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >import {A} from "./ref/a"; - > -1 >Emitted(7, 5) Source(2, 1) + SourceIndex(0) ---- ->>> __extends(B, _super); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(8, 9) Source(2, 24) + SourceIndex(0) name (B) -2 >Emitted(8, 30) Source(2, 25) + SourceIndex(0) name (B) ---- ->>> function B() { -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(9, 9) Source(2, 1) + SourceIndex(0) name (B) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(10, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) -2 >Emitted(10, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) ---- ->>> } -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > { -2 > } -1 >Emitted(11, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) -2 >Emitted(11, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) ---- ->>> return B; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(12, 9) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(12, 17) Source(2, 29) + SourceIndex(0) name (B) ---- ->>> })(a_1.A); -1 >^^^^ -2 > ^ -3 > -4 > ^^ -5 > ^^^^^ -6 > ^^ -7 > ^^^^^-> -1 > -2 > } -3 > -4 > export class B extends -5 > A -6 > { } -1 >Emitted(13, 5) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(13, 6) Source(2, 29) + SourceIndex(0) name (B) -3 >Emitted(13, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(13, 8) Source(2, 24) + SourceIndex(0) -5 >Emitted(13, 13) Source(2, 25) + SourceIndex(0) -6 >Emitted(13, 15) Source(2, 29) + SourceIndex(0) ---- ->>> exports.B = B; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > B -3 > extends A { } -4 > -1->Emitted(14, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(14, 14) Source(2, 15) + SourceIndex(0) -3 >Emitted(14, 18) Source(2, 29) + SourceIndex(0) -4 >Emitted(14, 19) Source(2, 29) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=b.js.map=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js b/tests/baselines/reference/outModuleConcatCommonjs.js index 0f83b4fbe99..c859d6c63ef 100644 --- a/tests/baselines/reference/outModuleConcatCommonjs.js +++ b/tests/baselines/reference/outModuleConcatCommonjs.js @@ -10,30 +10,7 @@ export class A { } import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -// This should be an error -var A = (function () { - function A() { - } - return A; -})(); -exports.A = A; -//# sourceMappingURL=a.js.map//// [b.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var a_1 = require("./ref/a"); -var B = (function (_super) { - __extends(B, _super); - function B() { - _super.apply(this, arguments); - } - return B; -})(a_1.A); -exports.B = B; -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -42,13 +19,6 @@ var __extends = (this && this.__extends) || function (d, b) { // This should be an error //# sourceMappingURL=all.js.map -//// [a.d.ts] -export declare class A { -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] declare module "tests/cases/compiler/ref/a" { export class A { diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js.map b/tests/baselines/reference/outModuleConcatCommonjs.js.map index babde662bc1..09646467406 100644 --- a/tests/baselines/reference/outModuleConcatCommonjs.js.map +++ b/tests/baselines/reference/outModuleConcatCommonjs.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":"AACA,0BAA0B;AAE1B;IAAAA;IAAiBC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAlB,IAAkB;AAAL,SAAC,IAAI,CAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;AAAA,kBAAgB,SAAS,CAAC,CAAA;AAC1B;IAAuBA,qBAACA;IAAxBA;QAAuBC,8BAACA;IAAGA,CAACA;IAADD,QAACA;AAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;AAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AACA,0BAA0B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt b/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt index 22dda7ae4bf..698328649e2 100644 --- a/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatCommonjs.sourcemap.txt @@ -1,198 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>// This should be an error -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > - > -2 >// This should be an error -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 27) Source(2, 27) + SourceIndex(0) ---- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > - > -1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class A { -2 > } -1->Emitted(4, 5) Source(4, 18) + SourceIndex(0) name (A.constructor) -2 >Emitted(4, 6) Source(4, 19) + SourceIndex(0) name (A.constructor) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 18) + SourceIndex(0) name (A) -2 >Emitted(5, 13) Source(4, 19) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class A { } -1 >Emitted(6, 1) Source(4, 18) + SourceIndex(0) name (A) -2 >Emitted(6, 2) Source(4, 19) + SourceIndex(0) name (A) -3 >Emitted(6, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 19) + SourceIndex(0) ---- ->>>exports.A = A; -1-> -2 >^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >A -3 > { } -4 > -1->Emitted(7, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(7, 10) Source(4, 15) + SourceIndex(0) -3 >Emitted(7, 14) Source(4, 19) + SourceIndex(0) -4 >Emitted(7, 15) Source(4, 19) + SourceIndex(0) ---- ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; ->>>var a_1 = require("./ref/a"); -1 > -2 >^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^ -1 > -2 >import {A} from -3 > "./ref/a" -4 > ; -5 > -1 >Emitted(6, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(6, 19) Source(1, 17) + SourceIndex(0) -3 >Emitted(6, 28) Source(1, 26) + SourceIndex(0) -4 >Emitted(6, 29) Source(1, 27) + SourceIndex(0) -5 >Emitted(6, 30) Source(1, 27) + SourceIndex(0) ---- ->>>var B = (function (_super) { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(7, 1) Source(2, 1) + SourceIndex(0) ---- ->>> __extends(B, _super); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(8, 5) Source(2, 24) + SourceIndex(0) name (B) -2 >Emitted(8, 26) Source(2, 25) + SourceIndex(0) name (B) ---- ->>> function B() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) name (B) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(10, 9) Source(2, 24) + SourceIndex(0) name (B.constructor) -2 >Emitted(10, 39) Source(2, 25) + SourceIndex(0) name (B.constructor) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > { -2 > } -1 >Emitted(11, 5) Source(2, 28) + SourceIndex(0) name (B.constructor) -2 >Emitted(11, 6) Source(2, 29) + SourceIndex(0) name (B.constructor) ---- ->>> return B; -1->^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(12, 5) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(12, 13) Source(2, 29) + SourceIndex(0) name (B) ---- ->>>})(a_1.A); -1 > -2 >^ -3 > -4 > ^^ -5 > ^^^^^ -6 > ^^ -7 > ^^^^^-> -1 > -2 >} -3 > -4 > export class B extends -5 > A -6 > { } -1 >Emitted(13, 1) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(13, 2) Source(2, 29) + SourceIndex(0) name (B) -3 >Emitted(13, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(13, 4) Source(2, 24) + SourceIndex(0) -5 >Emitted(13, 9) Source(2, 25) + SourceIndex(0) -6 >Emitted(13, 11) Source(2, 29) + SourceIndex(0) ---- ->>>exports.B = B; -1-> -2 >^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >B -3 > extends A { } -4 > -1->Emitted(14, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(14, 10) Source(2, 15) + SourceIndex(0) -3 >Emitted(14, 14) Source(2, 29) + SourceIndex(0) -4 >Emitted(14, 15) Source(2, 29) + SourceIndex(0) ---- ->>>//# sourceMappingURL=b.js.map=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/outModuleConcatES6.js b/tests/baselines/reference/outModuleConcatES6.js index c8db9e083b6..037d52eb410 100644 --- a/tests/baselines/reference/outModuleConcatES6.js +++ b/tests/baselines/reference/outModuleConcatES6.js @@ -10,25 +10,10 @@ export class A { } import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -// This should be an error -export class A { -} -//# sourceMappingURL=a.js.map//// [b.js] -import { A } from "./ref/a"; -export class B extends A { -} -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] // This should be an error //# sourceMappingURL=all.js.map -//// [a.d.ts] -export declare class A { -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] declare module "tests/cases/compiler/ref/a" { export class A { diff --git a/tests/baselines/reference/outModuleConcatES6.js.map b/tests/baselines/reference/outModuleConcatES6.js.map index 347b15b38f3..bd3e6f58731 100644 --- a/tests/baselines/reference/outModuleConcatES6.js.map +++ b/tests/baselines/reference/outModuleConcatES6.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A"],"mappings":"AACA,0BAA0B;AAE1B;AAAiBA,CAACA;AAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B"],"mappings":"OAAO,EAAC,CAAC,EAAC,MAAM,SAAS;AACzB,uBAAuB,CAAC;AAAGA,CAACA;AAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AACA,0BAA0B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatES6.sourcemap.txt b/tests/baselines/reference/outModuleConcatES6.sourcemap.txt index 239dff14456..78b6e98ac15 100644 --- a/tests/baselines/reference/outModuleConcatES6.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatES6.sourcemap.txt @@ -1,101 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>// This should be an error -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > - > -2 >// This should be an error -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 27) Source(2, 27) + SourceIndex(0) ---- ->>>export class A { -1 > -2 >^^-> -1 > - > - > -1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) ---- ->>>} -1-> -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->export class A { -2 >} -1->Emitted(3, 1) Source(4, 18) + SourceIndex(0) name (A) -2 >Emitted(3, 2) Source(4, 19) + SourceIndex(0) name (A) ---- ->>>//# sourceMappingURL=a.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(4, 1) Source(4, 19) + SourceIndex(0) ---- -=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>import { A } from "./ref/a"; -1 >^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^ -5 > ^^^^^^ -6 > ^^^^^^^^^ -1 >import -2 > { -3 > A -4 > } -5 > from -6 > "./ref/a" -1 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) -2 >Emitted(1, 10) Source(1, 9) + SourceIndex(0) -3 >Emitted(1, 11) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 13) Source(1, 11) + SourceIndex(0) -5 >Emitted(1, 19) Source(1, 17) + SourceIndex(0) -6 >Emitted(1, 28) Source(1, 26) + SourceIndex(0) ---- ->>>export class B extends A { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1 >; - > -2 >export class B extends -3 > A -1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 24) Source(2, 24) + SourceIndex(0) -3 >Emitted(2, 25) Source(2, 25) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > { -2 >} -1 >Emitted(3, 1) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(3, 2) Source(2, 29) + SourceIndex(0) name (B) ---- ->>>//# sourceMappingURL=b.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(4, 1) Source(2, 29) + SourceIndex(0) ---- -=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index 970ea4b3d6d..1f8bdbd8070 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -8,48 +8,7 @@ export class A { } import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -System.register([], function(exports_1) { - var A; - return { - setters:[], - execute: function() { - A = (function () { - function A() { - } - return A; - })(); - exports_1("A", A); - } - } -}); -//# sourceMappingURL=a.js.map//// [b.js] -System.register(["./ref/a"], function(exports_1) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var a_1; - var B; - return { - setters:[ - function (a_1_1) { - a_1 = a_1_1; - }], - execute: function() { - B = (function (_super) { - __extends(B, _super); - function B() { - _super.apply(this, arguments); - } - return B; - })(a_1.A); - exports_1("B", B); - } - } -}); -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -91,13 +50,6 @@ System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], functi }); //# sourceMappingURL=all.js.map -//// [a.d.ts] -export declare class A { -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] declare module "tests/cases/compiler/ref/a" { export class A { diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map index a74b131da99..77ff05f84fb 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js.map +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";;;;;YACA;gBAAAA;gBAAiBC,CAACA;gBAADD,QAACA;YAADA,CAACA,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;;;;;;;;;YACA;gBAAuBA,qBAACA;gBAAxBA;oBAAuBC,8BAACA;gBAAGA,CAACA;gBAADD,QAACA;YAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;YAA5B,iBAA4B,CAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":";;;;;;;;;;YACA;gBAAAA;gBAAiBC,CAACA;gBAADD,QAACA;YAADA,CAACA,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA;;;;;;;;;;;;;YCAlB;gBAAuBE,qBAACA;gBAAxBA;oBAAuBC,8BAACA;gBAAGA,CAACA;gBAADD,QAACA;YAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;YAA5B,iBAA4B,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index e717c3f677b..489487772db 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -1,183 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>System.register([], function(exports_1) { ->>> var A; ->>> return { ->>> setters:[], ->>> execute: function() { ->>> A = (function () { -1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(6, 13) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(7, 17) Source(2, 1) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class A { -2 > } -1->Emitted(8, 17) Source(2, 18) + SourceIndex(0) name (A.constructor) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) name (A.constructor) ---- ->>> return A; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(9, 17) Source(2, 18) + SourceIndex(0) name (A) -2 >Emitted(9, 25) Source(2, 19) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class A { } -1 >Emitted(10, 13) Source(2, 18) + SourceIndex(0) name (A) -2 >Emitted(10, 14) Source(2, 19) + SourceIndex(0) name (A) -3 >Emitted(10, 14) Source(2, 1) + SourceIndex(0) -4 >Emitted(10, 18) Source(2, 19) + SourceIndex(0) ---- ->>> exports_1("A", A); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^ -1-> -2 > export class A { } -3 > -1->Emitted(11, 13) Source(2, 1) + SourceIndex(0) -2 >Emitted(11, 30) Source(2, 19) + SourceIndex(0) -3 >Emitted(11, 31) Source(2, 19) + SourceIndex(0) ---- ->>> } ->>> } ->>>}); ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>System.register(["./ref/a"], function(exports_1) { ->>> var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>> }; ->>> var a_1; ->>> var B; ->>> return { ->>> setters:[ ->>> function (a_1_1) { ->>> a_1 = a_1_1; ->>> }], ->>> execute: function() { ->>> B = (function (_super) { -1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >import {A} from "./ref/a"; - > -1 >Emitted(15, 13) Source(2, 1) + SourceIndex(0) ---- ->>> __extends(B, _super); -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(16, 17) Source(2, 24) + SourceIndex(0) name (B) -2 >Emitted(16, 38) Source(2, 25) + SourceIndex(0) name (B) ---- ->>> function B() { -1 >^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(17, 17) Source(2, 1) + SourceIndex(0) name (B) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(18, 21) Source(2, 24) + SourceIndex(0) name (B.constructor) -2 >Emitted(18, 51) Source(2, 25) + SourceIndex(0) name (B.constructor) ---- ->>> } -1 >^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > { -2 > } -1 >Emitted(19, 17) Source(2, 28) + SourceIndex(0) name (B.constructor) -2 >Emitted(19, 18) Source(2, 29) + SourceIndex(0) name (B.constructor) ---- ->>> return B; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(20, 17) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(20, 25) Source(2, 29) + SourceIndex(0) name (B) ---- ->>> })(a_1.A); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^ -5 > ^^^^^ -6 > ^^ -7 > ^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class B extends -5 > A -6 > { } -1 >Emitted(21, 13) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(21, 14) Source(2, 29) + SourceIndex(0) name (B) -3 >Emitted(21, 14) Source(2, 1) + SourceIndex(0) -4 >Emitted(21, 16) Source(2, 24) + SourceIndex(0) -5 >Emitted(21, 21) Source(2, 25) + SourceIndex(0) -6 >Emitted(21, 23) Source(2, 29) + SourceIndex(0) ---- ->>> exports_1("B", B); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^ -1-> -2 > export class B extends A { } -3 > -1->Emitted(22, 13) Source(2, 1) + SourceIndex(0) -2 >Emitted(22, 30) Source(2, 29) + SourceIndex(0) -3 >Emitted(22, 31) Source(2, 29) + SourceIndex(0) ---- ->>> } ->>> } ->>>}); ->>>//# sourceMappingURL=b.js.map=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/outModuleConcatUmd.js b/tests/baselines/reference/outModuleConcatUmd.js index b94617a19d8..c4aad41c6ed 100644 --- a/tests/baselines/reference/outModuleConcatUmd.js +++ b/tests/baselines/reference/outModuleConcatUmd.js @@ -10,48 +10,7 @@ export class A { } import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -// This should error -(function (factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(["require", "exports"], factory); - } -})(function (require, exports) { - var A = (function () { - function A() { - } - return A; - })(); - exports.A = A; -}); -//# sourceMappingURL=a.js.map//// [b.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -(function (factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(["require", "exports", "./ref/a"], factory); - } -})(function (require, exports) { - var a_1 = require("./ref/a"); - var B = (function (_super) { - __extends(B, _super); - function B() { - _super.apply(this, arguments); - } - return B; - })(a_1.A); - exports.B = B; -}); -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -60,13 +19,6 @@ var __extends = (this && this.__extends) || function (d, b) { // This should error //# sourceMappingURL=all.js.map -//// [a.d.ts] -export declare class A { -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] declare module "tests/cases/compiler/ref/a" { export class A { diff --git a/tests/baselines/reference/outModuleConcatUmd.js.map b/tests/baselines/reference/outModuleConcatUmd.js.map index b00a2c1c187..7a9fcd77bdf 100644 --- a/tests/baselines/reference/outModuleConcatUmd.js.map +++ b/tests/baselines/reference/outModuleConcatUmd.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":"AACA,oBAAoB;;;;;;;;;IAEpB;QAAAA;QAAiBC,CAACA;QAADD,QAACA;IAADA,CAACA,AAAlB,IAAkB;IAAL,SAAC,IAAI,CAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;;;;;;;;IAAA,kBAAgB,SAAS,CAAC,CAAA;IAC1B;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AACA,oBAAoB"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt index 9749e38cc40..d2fbe17fe65 100644 --- a/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatUmd.sourcemap.txt @@ -1,215 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>// This should error -1 > -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^-> -1 > - > -2 >// This should error -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) ---- ->>>(function (factory) { ->>> if (typeof module === 'object' && typeof module.exports === 'object') { ->>> var v = factory(require, exports); if (v !== undefined) module.exports = v; ->>> } ->>> else if (typeof define === 'function' && define.amd) { ->>> define(["require", "exports"], factory); ->>> } ->>>})(function (require, exports) { ->>> var A = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(10, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(11, 9) Source(4, 1) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class A { -2 > } -1->Emitted(12, 9) Source(4, 18) + SourceIndex(0) name (A.constructor) -2 >Emitted(12, 10) Source(4, 19) + SourceIndex(0) name (A.constructor) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(13, 9) Source(4, 18) + SourceIndex(0) name (A) -2 >Emitted(13, 17) Source(4, 19) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class A { } -1 >Emitted(14, 5) Source(4, 18) + SourceIndex(0) name (A) -2 >Emitted(14, 6) Source(4, 19) + SourceIndex(0) name (A) -3 >Emitted(14, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(14, 10) Source(4, 19) + SourceIndex(0) ---- ->>> exports.A = A; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > A -3 > { } -4 > -1->Emitted(15, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(15, 14) Source(4, 15) + SourceIndex(0) -3 >Emitted(15, 18) Source(4, 19) + SourceIndex(0) -4 >Emitted(15, 19) Source(4, 19) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; ->>>(function (factory) { ->>> if (typeof module === 'object' && typeof module.exports === 'object') { ->>> var v = factory(require, exports); if (v !== undefined) module.exports = v; ->>> } ->>> else if (typeof define === 'function' && define.amd) { ->>> define(["require", "exports", "./ref/a"], factory); ->>> } ->>>})(function (require, exports) { ->>> var a_1 = require("./ref/a"); -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^ -1 > -2 > import {A} from -3 > "./ref/a" -4 > ; -5 > -1 >Emitted(14, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(14, 23) Source(1, 17) + SourceIndex(0) -3 >Emitted(14, 32) Source(1, 26) + SourceIndex(0) -4 >Emitted(14, 33) Source(1, 27) + SourceIndex(0) -5 >Emitted(14, 34) Source(1, 27) + SourceIndex(0) ---- ->>> var B = (function (_super) { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(15, 5) Source(2, 1) + SourceIndex(0) ---- ->>> __extends(B, _super); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(16, 9) Source(2, 24) + SourceIndex(0) name (B) -2 >Emitted(16, 30) Source(2, 25) + SourceIndex(0) name (B) ---- ->>> function B() { -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(17, 9) Source(2, 1) + SourceIndex(0) name (B) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(18, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) -2 >Emitted(18, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) ---- ->>> } -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > { -2 > } -1 >Emitted(19, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) -2 >Emitted(19, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) ---- ->>> return B; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(20, 9) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(20, 17) Source(2, 29) + SourceIndex(0) name (B) ---- ->>> })(a_1.A); -1 >^^^^ -2 > ^ -3 > -4 > ^^ -5 > ^^^^^ -6 > ^^ -7 > ^^^^^-> -1 > -2 > } -3 > -4 > export class B extends -5 > A -6 > { } -1 >Emitted(21, 5) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(21, 6) Source(2, 29) + SourceIndex(0) name (B) -3 >Emitted(21, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(21, 8) Source(2, 24) + SourceIndex(0) -5 >Emitted(21, 13) Source(2, 25) + SourceIndex(0) -6 >Emitted(21, 15) Source(2, 29) + SourceIndex(0) ---- ->>> exports.B = B; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > B -3 > extends A { } -4 > -1->Emitted(22, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(22, 14) Source(2, 15) + SourceIndex(0) -3 >Emitted(22, 18) Source(2, 29) + SourceIndex(0) -4 >Emitted(22, 19) Source(2, 29) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=b.js.map=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index dc0cdb22ddd..ae4ac43b5c9 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -30,33 +30,7 @@ import {A} from "./ref/a"; export class B extends A { } -//// [a.js] -define(["require", "exports"], function (require, exports) { - /// - var A = (function () { - function A() { - } - return A; - })(); - exports.A = A; -}); -//# sourceMappingURL=a.js.map//// [b.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -define(["require", "exports", "./ref/a"], function (require, exports, a_1) { - var B = (function (_super) { - __extends(B, _super); - function B() { - _super.apply(this, arguments); - } - return B; - })(a_1.A); - exports.B = B; -}); -//# sourceMappingURL=b.js.map//// [all.js] +//// [all.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -89,15 +63,6 @@ define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/re }); //# sourceMappingURL=all.js.map -//// [a.d.ts] -/// -export declare class A { - member: typeof GlobalFoo; -} -//// [b.d.ts] -import { A } from "./ref/a"; -export declare class B extends A { -} //// [all.d.ts] /// declare class Foo { diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js.map b/tests/baselines/reference/outModuleTripleSlashRefs.js.map index 0eeee4a82d5..711163a76e8 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js.map +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js.map @@ -1,4 +1,2 @@ -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":["A","A.constructor"],"mappings":";IACA,+BAA+B;IAC/B;QAAAA;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IAFY,SAAC,IAEb,CAAA"}//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":["B","B.constructor"],"mappings":";;;;;;IACA;QAAuBA,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"}//// [all.js.map] +//// [all.js.map] {"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":["Foo","Foo.constructor","A","A.constructor","B","B.constructor"],"mappings":";;;;;AAAA,iCAAiC;AACjC;IAAAA;IAEAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAFD,IAEC;;ICFD,+BAA+B;IAC/B;QAAAE;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IAFY,SAAC,IAEb,CAAA;;;ICHD;QAAuBE,qBAACA;QAAxBA;YAAuBC,8BAACA;QAAGA,CAACA;QAADD,QAACA;IAADA,CAACA,AAA5B,EAAuB,KAAC,EAAI;IAAf,SAAC,IAAc,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 6e9070cbe04..c95eb22cb10 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -1,188 +1,4 @@ =================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> /// -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > - > -2 > /// -1 >Emitted(2, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 36) Source(2, 32) + SourceIndex(0) ---- ->>> var A = (function () { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class A { - > member: typeof GlobalFoo; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (A.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (A.constructor) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (A) -2 >Emitted(6, 17) Source(5, 2) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class A { - > member: typeof GlobalFoo; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (A) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.A = A; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > A -3 > { - > member: typeof GlobalFoo; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 14) Source(3, 15) + SourceIndex(0) -3 >Emitted(8, 18) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 19) Source(5, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; ->>>define(["require", "exports", "./ref/a"], function (require, exports, a_1) { ->>> var B = (function (_super) { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >import {A} from "./ref/a"; - > -1 >Emitted(7, 5) Source(2, 1) + SourceIndex(0) ---- ->>> __extends(B, _super); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(8, 9) Source(2, 24) + SourceIndex(0) name (B) -2 >Emitted(8, 30) Source(2, 25) + SourceIndex(0) name (B) ---- ->>> function B() { -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(9, 9) Source(2, 1) + SourceIndex(0) name (B) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(10, 13) Source(2, 24) + SourceIndex(0) name (B.constructor) -2 >Emitted(10, 43) Source(2, 25) + SourceIndex(0) name (B.constructor) ---- ->>> } -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > { -2 > } -1 >Emitted(11, 9) Source(2, 28) + SourceIndex(0) name (B.constructor) -2 >Emitted(11, 10) Source(2, 29) + SourceIndex(0) name (B.constructor) ---- ->>> return B; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(12, 9) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(12, 17) Source(2, 29) + SourceIndex(0) name (B) ---- ->>> })(a_1.A); -1 >^^^^ -2 > ^ -3 > -4 > ^^ -5 > ^^^^^ -6 > ^^ -7 > ^^^^^-> -1 > -2 > } -3 > -4 > export class B extends -5 > A -6 > { } -1 >Emitted(13, 5) Source(2, 28) + SourceIndex(0) name (B) -2 >Emitted(13, 6) Source(2, 29) + SourceIndex(0) name (B) -3 >Emitted(13, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(13, 8) Source(2, 24) + SourceIndex(0) -5 >Emitted(13, 13) Source(2, 25) + SourceIndex(0) -6 >Emitted(13, 15) Source(2, 29) + SourceIndex(0) ---- ->>> exports.B = B; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > B -3 > extends A { } -4 > -1->Emitted(14, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(14, 14) Source(2, 15) + SourceIndex(0) -3 >Emitted(14, 18) Source(2, 29) + SourceIndex(0) -4 >Emitted(14, 19) Source(2, 29) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=b.js.map=================================================================== JsFile: all.js mapUrl: all.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index ee020b0ff80..2f0cd8e1230 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index ef882554ddb..94348f987ce 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:../../ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 9dad0db002a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 0e907c1a2ca..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index ee020b0ff80..2f0cd8e1230 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index c6aeabde516..3f16355ad76 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:../../ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index 3eaebd5c136..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index cbb2dc36492..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index ed7bcd289e7..24fb56c1fd2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 68630d9e431..c0dbdb42cdf 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 9dad0db002a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 0e907c1a2ca..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index ed7bcd289e7..24fb56c1fd2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 8f645dc8a2d..963b3f3bb22 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: /tests/cases/projects/outputdir_mixed_subfolder/mapFiles/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 3eaebd5c136..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_mixed_subfolder/mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index cbb2dc36492..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index b02c7fdd8c2..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../../outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index 8fe95a1506f..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index 6432d5ae91e..4869993ca92 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 9384228ece5..4462b142d98 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: ../../../ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../../ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: ../../../outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:../../../outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: ../../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../../test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index 52b5e682660..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 652d934d602..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../../ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index a2a29b4dcfc..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index be0b3a580f5..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index f9d0dd89e9c..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../../outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index 589c5838a2c..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index 6432d5ae91e..4869993ca92 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 47e6fcc66ef..5b0497285e2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: ../../../ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../../ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: ../../../outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:../../../outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: ../../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../../test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_multifolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index b0e6a265bc9..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 15bddd32fe5..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../../ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 16422a234c5..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_multifolder/mapFiles/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index eae921435ac..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index 86c0ba41238..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index 7f5576a8a9c..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json index f703a63b71f..742acdc7a25 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index ef240e21383..d8ab3db1266 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map -sourceRoot: -sources: ../m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:../m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map -sourceRoot: -sources: ../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 6e24571a3f2..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 80d6bbf450b..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index c8a4f5c91a4..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index ce271e4a3cd..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json index f703a63b71f..742acdc7a25 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index aa64e62c809..1eef0eba6f2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map -sourceRoot: -sources: ../m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:../m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/m1.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map -sourceRoot: -sources: ../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index 080dcf6e818..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_simple/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index de9ec1f9859..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index d8f4cc74008..21d6e50f28a 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index d6a44398f8e..d63cf86d236 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map -sourceRoot: -sources: ../../ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map -sourceRoot: -sources: ../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index e819d557c40..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 88e67e19b36..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 3b2cd1a24c4..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 80d6bbf450b..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index d8f4cc74008..21d6e50f28a 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 55f448a9c2f..20f2ab47188 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map -sourceRoot: -sources: ../../ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map -sourceRoot: -sources: ../test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: /tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index a420241c901..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 420650feeac..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index f6319258d8f..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=/tests/cases/projects/outputdir_module_subfolder/mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 15d4e3e1c9b..00000000000 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json index 8e87f61b8df..f3b0bdd119e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 33ebe5aaafb..cfd0952c941 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: ../../mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../mapFiles/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 4f0b35f21c7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=../../mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 81bb9202e5a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json index 8e87f61b8df..f3b0bdd119e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index d55115b85f2..931a09b3ae6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: ../../mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../mapFiles/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index f13773b3384..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=../../mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 98da596cfa4..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 4ed441e2552..0d6c009961b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 9932fdda3e9..cb14a553f05 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: ../../../../mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../../../mapFiles/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: ../../mapFiles/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index e4c8f7b3610..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=../../../../mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 81bb9202e5a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 4ed441e2552..0d6c009961b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 89fba663c60..eddbc79711c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: ../../../../mapFiles/ref/m2.js.map -sourceRoot: -sources: ../../outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../../../mapFiles/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: ../../mapFiles/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index d78261fe225..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=../../../../mapFiles/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 98da596cfa4..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index 9745ad1a4ab..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../projects/outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index ad9b3f68611..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json index f3c86f22eb7..283c0703f90 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 2cbcfa7b2ce..47e1835365a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: ../../../projects/outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../../projects/outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: ../../mapFiles/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: ../../projects/outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:../../projects/outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: ../../mapFiles/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: ../../projects/outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../../projects/outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: ../../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index 09fbf68994d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index e7200adafdb..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../../projects/outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 90dee0800c7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index f2b1ea70110..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index c2ac2bc2710..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../projects/outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index 573ce2ac6c5..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json index f3c86f22eb7..283c0703f90 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index e020f2716f7..ce08ef2c878 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: ../../../projects/outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../../projects/outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: ../../mapFiles/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: ../../projects/outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:../../projects/outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: ../../mapFiles/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: ../../projects/outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../../projects/outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: ../../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 87f1f3a51b7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=../../../mapFiles/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 074ab743af3..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../../projects/outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 6e2fb8d7851..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=../../mapFiles/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 85da8e39421..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index 1fe3446e4bc..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=../mapFiles/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index e2625035edb..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../outputdir_module_simple/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json index fe0b8045a5c..b4efe9ebb39 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 8a95e1100a5..8099c2f176a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../mapFiles/m1.js.map -sourceRoot: -sources: ../outputdir_module_simple/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:../outputdir_module_simple/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../mapFiles/m1.js.map=================================================================== -JsFile: test.js -mapUrl: ../mapFiles/test.js.map -sourceRoot: -sources: ../outputdir_module_simple/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../outputdir_module_simple/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 14471b6e983..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 5ce16293424..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 73a399fe253..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=../mapFiles/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index 0950101384d..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../outputdir_module_simple/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json index fe0b8045a5c..b4efe9ebb39 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index ffc11c547d2..4c009331988 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../mapFiles/m1.js.map -sourceRoot: -sources: ../outputdir_module_simple/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:../outputdir_module_simple/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../mapFiles/m1.js.map=================================================================== -JsFile: test.js -mapUrl: ../mapFiles/test.js.map -sourceRoot: -sources: ../outputdir_module_simple/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../outputdir_module_simple/test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index 1a2a4fc5e6a..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index c0654a8e141..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json index a87c7d36d8e..51ad7ddf1b2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 25e76457d53..e666ef224a3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../../mapFiles/ref/m1.js.map -sourceRoot: -sources: ../../outputdir_module_subfolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../outputdir_module_subfolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../../mapFiles/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: ../mapFiles/test.js.map -sourceRoot: -sources: ../outputdir_module_subfolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../outputdir_module_subfolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=../mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index 3e8406858e2..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=../../mapFiles/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 66acf4aace7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../outputdir_module_subfolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 84b62ed0fc7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 6139e8293b0..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json index a87c7d36d8e..51ad7ddf1b2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 4a7d5c7d49f..a57632c4e07 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: ../../mapFiles/ref/m1.js.map -sourceRoot: -sources: ../../outputdir_module_subfolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:../../outputdir_module_subfolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../../mapFiles/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: ../mapFiles/test.js.map -sourceRoot: -sources: ../outputdir_module_subfolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:../outputdir_module_subfolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=../mapFiles/test.js.map=================================================================== JsFile: test.js mapUrl: ../../mapFiles/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 2dbac1edb8e..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=../../mapFiles/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 7e9c3643b99..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["../../outputdir_module_subfolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index c6dd0639fb7..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=../mapFiles/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 64b21aa3115..00000000000 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_module_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json index f987aa49ffe..b65b2477c8e 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index bd84417baa2..0fa723ff01b 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index aa404804b45..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index c2157bc3b1b..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json index f987aa49ffe..b65b2477c8e 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 7a04c10d333..bfe9f5dff6a 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index a39f0f50e5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 0230aad40a5..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 2bb23cdc610..9b7785a024b 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index bdeabb5ae19..6746d0609b6 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index aa404804b45..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index c2157bc3b1b..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 2bb23cdc610..9b7785a024b 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 33ade6d5e9d..14ca884e9f7 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index a39f0f50e5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 0230aad40a5..00000000000 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index 66c8fa96a0b..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index e926e95f3c3..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json index e061982b32f..2ff88c9696f 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index b45d5fdd6ef..5805c876be8 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index e8004c87aad..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 37bc8039271..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 01ad8f96e78..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 4e7e9721b83..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index ec29dfcad18..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index 721fdf3827f..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json index e061982b32f..2ff88c9696f 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 4dfb2e5d394..e66e92ff5cf 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 7b14808a067..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index c88465aaec4..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index b9191db7d5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 6a18d277c10..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index 1a4d200cdcb..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index d2270dfd2ce..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json index e636ce61f7e..1dbc9780b95 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 2268138862a..36bfe394d39 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_simple/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_simple/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_simple/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_simple/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index d752d7f8395..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index de9d99184d2..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 02ca4ab81c7..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index bc2e2667bcd..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json index e636ce61f7e..1dbc9780b95 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 889ac03323b..ef808a08b3f 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_simple/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_simple/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_simple/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_simple/test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index 1d5a32f0ad5..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index b9c164bb732..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json index 05da8c15292..b33bd42f045 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index b547512c50d..617b90f7c81 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/ref/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_subfolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index 73309eabe30..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index ec8a7690d47..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 270604ea7cb..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 35691a873b8..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json index 05da8c15292..b33bd42f045 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 3bb1f02d820..16bcb98e00c 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/ref/m1.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: -sources: file:///tests/cases/projects/outputdir_module_subfolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:file:///tests/cases/projects/outputdir_module_subfolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 8f31dc2aaa2..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 95de442e92d..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 9bb4ed0180a..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index fee2f4cb129..00000000000 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_module_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json index c36f3ade5e0..2de7a33388a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 65ffacd46fc..1a75ab0b601 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index aa404804b45..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 04f168a6289..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json index c36f3ade5e0..2de7a33388a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 714864e506f..d1ab16ddf2b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index a39f0f50e5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 0ce68e169af..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 4741b9cf9e1..8d29a569320 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 72dd27c642f..2a4bc95cbc2 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index aa404804b45..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 04f168a6289..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 4741b9cf9e1..8d29a569320 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 8284d795792..da3d501acb7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: http://www.typescriptlang.org/outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index a39f0f50e5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 0ce68e169af..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index 3b00d82ab66..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index e926e95f3c3..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json index 3ecf4bc4cc4..ae51d051ff0 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 4eb71f2bf29..20a97890399 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index e8004c87aad..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 8c257bd1111..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 01ad8f96e78..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 8612cd0d108..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index 058e405b606..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index 721fdf3827f..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json index 3ecf4bc4cc4..ae51d051ff0 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 77c5e460779..909ae1c3750 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map=================================================================== -JsFile: m2.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder_ref/m2.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 7b14808a067..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index e7f54a4a2e1..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index b9191db7d5f..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=http://www.typescriptlang.org/outputdir_module_multifolder/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 4ac74c2fcdb..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index 1a4d200cdcb..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index 6751f2f82cd..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json index 2cfc9aebda2..d8ff0027520 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 6e3a046bb27..bd33dbb5ec7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index d752d7f8395..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index a57b57d2b17..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 02ca4ab81c7..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index ca45773f423..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json index 2cfc9aebda2..d8ff0027520 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index d52a70d4dac..d9df59725a9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index 1d5a32f0ad5..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 41d3e11e995..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json index cfa0ec5cb81..cd7c4867bc3 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 93d4a677676..557f15f4e2a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/ref/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index 73309eabe30..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 6c5413f630e..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 270604ea7cb..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index a57b57d2b17..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json index cfa0ec5cb81..cd7c4867bc3 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index abdc3af24ca..3a403373a8f 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: http://www.typescriptlang.org/ref/m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map=================================================================== -JsFile: test.js -mapUrl: http://www.typescriptlang.org/test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=http://www.typescriptlang.org/test.js.map=================================================================== JsFile: test.js mapUrl: http://www.typescriptlang.org/test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 8f31dc2aaa2..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=http://www.typescriptlang.org/ref/m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 35e7e9a48dd..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 9bb4ed0180a..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=http://www.typescriptlang.org/test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index d0638b6c34c..00000000000 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json index 975fcf59ca9..1b96d09cd3a 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json @@ -14,8 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 2c61fd1d935..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json index 975fcf59ca9..1b96d09cd3a 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json @@ -14,8 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index b7c7f5d8139..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 2b0a20e739a..f2ea5b95015 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -15,8 +15,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" ] diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 2c61fd1d935..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 2b0a20e739a..f2ea5b95015 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -15,8 +15,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" ] diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index b7c7f5d8139..00000000000 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile0.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile0.js deleted file mode 100644 index 2c61fd1d935..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile0.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile1.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile1.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/diskFile1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json index 66eced5cc01..ef27e5d6f40 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index c2a6326846e..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index f83ccabfd35..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile0.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile0.js deleted file mode 100644 index b7c7f5d8139..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile0.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile1.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile1.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/diskFile1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json index 66eced5cc01..ef27e5d6f40 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 37f4ec486b2..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index d1c1b22a85b..00000000000 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,16 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index c2a6326846e..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json index 166aaa982e7..11bd042a34c 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json @@ -13,10 +13,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js", - "m1.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index b6c62f75f3c..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 37f4ec486b2..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json index 166aaa982e7..11bd042a34c 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json @@ -13,10 +13,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js", - "m1.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index d016c5ff00a..00000000000 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,14 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json index f11b95edde9..d37850e3f0b 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json @@ -13,10 +13,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js", - "ref/m1.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index c2a6326846e..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,14 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index ef183a5773c..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json index f11b95edde9..d37850e3f0b 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json @@ -13,10 +13,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js", - "ref/m1.d.ts", - "test.js", - "test.d.ts", "bin/test.js", "bin/test.d.ts" ] diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 37f4ec486b2..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 548a35e714c..00000000000 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,14 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 381b239c573..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index 09c6092f164..1772111176c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 06d778caf3a..7ede7f02c36 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 2963737a5a0..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index 09c6092f164..1772111176c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 631ec5abf3d..7330eac1399 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 381b239c573..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 6fb17fa06b8..8d7c349b481 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index bda16ffe4e1..b686585c977 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 2963737a5a0..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 6fb17fa06b8..8d7c349b481 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -18,9 +18,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index d46f8d557ed..71a33c01806 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: /tests/cases/projects/outputdir_mixed_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index c4c57a82e12..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 71e1da5d3cc..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index b3e80123c04..722a6fbd4da 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 3937e0acb04..8c710d9c4da 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 5cca04a0f25..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index aeb0a1c3c5d..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index 7e08245de72..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index de341c87ec1..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index b3e80123c04..722a6fbd4da 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -17,15 +17,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 1c069ce2390..e129af6a045 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_multifolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 14c09e444a5..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 0b67e7ee481..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_multifolder/src/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index 89373fc1cfa..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json index e2621b2fa52..f9e2736f65a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index fab0c65ae8e..827aa235ef2 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 372f1052b89..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 945ed0583ad..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index 9bf6e024b3f..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json index e2621b2fa52..f9e2736f65a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 2da5935b483..0a161bb4886 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_simple/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index c2e7dfa443b..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index a7792ef5242..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 6f750f89857..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index a43e0f69172..50dc5aaf60f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 15269d7fb80..af6c2b21fdc 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 6c8aeb3190b..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index f65cfa554d1..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 19b046a427c..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index a43e0f69172..50dc5aaf60f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -16,12 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 9bcf1436d51..5d837611e49 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: /tests/cases/projects/outputdir_module_subfolder/src/ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 46c9f29e55a..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index c63a0943976..00000000000 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_module_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 0927206ec1b..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json index 82ef1c7d882..2dcfc8a5a2c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index cbab02333cb..d722bc8936a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 84f18c56247..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json index 82ef1c7d882..2dcfc8a5a2c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index e064f005473..b71c21b5b99 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 0927206ec1b..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index d5f4fd9c654..4247e9dadc2 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index f2fc29c157e..d1799c07a98 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 84f18c56247..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index d5f4fd9c654..4247e9dadc2 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 5690deb27df..2a0cc630cc0 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index 414fa845b2e..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 0cdc44d330d..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json index 69a577baffd..77179246af5 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index b2923025e73..43c4340ba37 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 5cca04a0f25..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 20138821cfe..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index 92fd6e19cfb..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 292dcb61933..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json index 69a577baffd..77179246af5 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index c0077fe3214..7ef7adace73 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 14c09e444a5..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index a603394fc15..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index e0af3af9b22..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json index a4a6698d3ca..8213a1478ae 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index 97323d5d307..fc0f367f343 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 372f1052b89..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 22f07c17544..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index 05c53f0182e..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json index a4a6698d3ca..8213a1478ae 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt index b38468c878d..2910ad61478 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index c2e7dfa443b..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 1e72e2a2203..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index aaae11bb5b5..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json index 71896f202b2..a5966ef08b8 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index e754942b588..83f9ef1f262 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 6c8aeb3190b..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 22f07c17544..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 702b574b614..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"../src/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json index 71896f202b2..a5966ef08b8 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt index 7e4dd146e52..b05ffee34ca 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: ../src/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: ../src/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: ../src/ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 46c9f29e55a..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index b3972a3cfc1..00000000000 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index cbb7eed4953..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json index 3270fe610aa..39cb44f229f 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json @@ -15,9 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index 23f10a2cf62..821236c5c85 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 0826e9e95f3..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json index 3270fe610aa..39cb44f229f 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json @@ -15,9 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index 4bc6731c326..e37948398a3 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index aabf49f904d..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 3a260af84a0..117a18c7c7a 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 5a223fb7109..4394eb0748e 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: ../../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../../ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index e31d90a8f0c..00000000000 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["../../../ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 3a260af84a0..117a18c7c7a 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index b36bfbd8c56..9486ad5e3a7 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: ../../../ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:../../../ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index cbb7eed4953..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 51755e4c9a3..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json index 3d2df95ad66..7ba960c4bef 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json @@ -15,15 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt index 3fa1bc7e057..6c8bdf4da74 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 5cca04a0f25..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 462fa38ab42..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index 0826e9e95f3..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"","sources":["m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 095951a67d0..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json index 3d2df95ad66..7ba960c4bef 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json @@ -15,15 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt index d36064b989c..70054e8f1c6 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: -sources: m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 14c09e444a5..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 3b3ef6b145c..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index 51755e4c9a3..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json index 9ff29662d40..c9889aff69b 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt index 2d6e3052871..71c0a41b2d1 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 372f1052b89..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 9bcc170386c..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index 095951a67d0..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json index 9ff29662d40..c9889aff69b 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt index c1334bd15ae..056b7a1c7f2 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index c2e7dfa443b..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 7bae4ed7491..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 51755e4c9a3..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json index 9d200ef685d..da85c1bf06c 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt index c72d3084670..9c12e1749ca 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 6c8aeb3190b..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 9bcc170386c..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 095951a67d0..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json index 9d200ef685d..da85c1bf06c 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json @@ -14,12 +14,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt index 9011abbae05..282a64dbc6f 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 46c9f29e55a..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 56d42d8bdfd..00000000000 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map deleted file mode 100644 index 04f168a6289..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json index 50a4518a1b0..7316c8b01c9 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index d88a0d7585b..51a641cb750 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map deleted file mode 100644 index 0ce68e169af..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json index 50a4518a1b0..7316c8b01c9 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -16,9 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m2.js.map", - "ref/m2.js", - "ref/m2.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 244cd8fafdf..38aecc15857 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 04f168a6289..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index b6ef6b5bd51..e165908b72c 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 5744420ab71..df760dc79b0 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,176 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map deleted file mode 100644 index 0ce68e169af..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outdir/outAndOutDirFolder/ref/m2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index b6ef6b5bd51..e165908b72c 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -17,9 +17,6 @@ "test.ts" ], "emittedFiles": [ - "outdir/outAndOutDirFolder/ref/m2.js.map", - "outdir/outAndOutDirFolder/ref/m2.js", - "outdir/outAndOutDirFolder/ref/m2.d.ts", "bin/outAndOutDirFile.js.map", "bin/outAndOutDirFile.js", "bin/outAndOutDirFile.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 568c310918f..c8507ca7df8 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -1,175 +1,4 @@ =================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:outdir/outAndOutDirFolder/ref/m2.js -sourceFile:ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== JsFile: outAndOutDirFile.js mapUrl: outAndOutDirFile.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map deleted file mode 100644 index 3b00d82ab66..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js deleted file mode 100644 index 144ad24e2de..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m2_a1 = 10; - var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; - })(); - exports.m2_c1 = m2_c1; - exports.m2_instance1 = new m2_c1(); - function m2_f1() { - return exports.m2_instance1; - } - exports.m2_f1 = m2_f1; -}); -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 8c257bd1111..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json index cc2a6c9b1aa..27485e45ad9 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 088f581289a..d2331ef3579 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,573 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m2_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m2_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_c1 = m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m2_instance1 = new m2_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m2_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>> exports.m2_f1 = m2_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >import m2 = require("../outputdir_module_multifolder_ref/m2"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(3, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(3, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(3, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(3, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(3, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(4, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(6, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(4, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(4, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(6, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(6, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(8, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(8, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(8, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(8, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(8, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(8, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(8, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(9, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(11, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(11, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(13, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(13, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(13, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(13, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(13, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(13, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(13, 26) + SourceIndex(0) ---- ->>> exports.a3 = m2.m2_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - >export var -2 > a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(15, 5) Source(14, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(14, 14) + SourceIndex(0) -3 >Emitted(15, 18) Source(14, 17) + SourceIndex(0) -4 >Emitted(15, 20) Source(14, 19) + SourceIndex(0) -5 >Emitted(15, 21) Source(14, 20) + SourceIndex(0) -6 >Emitted(15, 26) Source(14, 25) + SourceIndex(0) -7 >Emitted(15, 27) Source(14, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 5cca04a0f25..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; - exports.a3 = m2.m2_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index 8612cd0d108..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IAEW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;IACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map deleted file mode 100644 index 058e405b606..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m2.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder_ref/m2.ts"],"names":["m2_c1","m2_c1.constructor","m2_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js deleted file mode 100644 index ec0a73b5af8..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m2_a1 = 10; -var m2_c1 = (function () { - function m2_c1() { - } - return m2_c1; -})(); -exports.m2_c1 = m2_c1; -exports.m2_instance1 = new m2_c1(); -function m2_f1() { - return exports.m2_instance1; -} -exports.m2_f1 = m2_f1; -//# sourceMappingURL=m2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts deleted file mode 100644 index c09a3c0c32a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/diskFile2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m2_a1: number; -export declare class m2_c1 { - m2_c1_p1: number; -} -export declare var m2_instance1: m2_c1; -export declare function m2_f1(): m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index e7f54a4a2e1..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json index cc2a6c9b1aa..27485e45ad9 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -16,15 +16,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "../outputdir_module_multifolder_ref/m2.js.map", - "../outputdir_module_multifolder_ref/m2.js", - "../outputdir_module_multifolder_ref/m2.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index a116b6b4d78..95f7d3cee8f 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -1,617 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:outputdir_module_multifolder/ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: m2.js -mapUrl: m2.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder_ref/m2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:diskFile1.js -sourceFile:outputdir_module_multifolder_ref/m2.ts -------------------------------------------------------------------- ->>>exports.m2_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m2_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m2_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m2_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m2_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m2_c1 { - > public m2_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m2_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m2_c1.constructor) ---- ->>> return m2_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m2_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m2_c1 { - > public m2_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m2_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m2_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_c1 = m2_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m2_c1 -3 > { - > public m2_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m2_instance1 = new m2_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m2_instance1 -3 > = -4 > new -5 > m2_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m2_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m2_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m2_f1() { - > -2 > return -3 > -4 > m2_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m2_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m2_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m2_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m2_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m2_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m2_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m2_f1) ---- ->>>exports.m2_f1 = m2_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m2_f1 -3 > () { - > return m2_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m2.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: outputdir_module_multifolder/test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:outputdir_module_multifolder/test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>var m2 = require("../outputdir_module_multifolder_ref/m2"); -1-> -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^ -1-> - > -2 >import -3 > m2 -4 > = require( -5 > "../outputdir_module_multifolder_ref/m2" -6 > ) -7 > ; -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 7) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 18) Source(2, 21) + SourceIndex(0) -5 >Emitted(2, 58) Source(2, 61) + SourceIndex(0) -6 >Emitted(2, 59) Source(2, 62) + SourceIndex(0) -7 >Emitted(2, 60) Source(2, 63) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 1) Source(3, 12) + SourceIndex(0) -2 >Emitted(3, 11) Source(3, 14) + SourceIndex(0) -3 >Emitted(3, 14) Source(3, 17) + SourceIndex(0) -4 >Emitted(3, 16) Source(3, 19) + SourceIndex(0) -5 >Emitted(3, 17) Source(3, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(6, 5) Source(6, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(6, 6) Source(6, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(7, 5) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 14) Source(6, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(8, 1) Source(6, 1) + SourceIndex(0) name (c1) -2 >Emitted(8, 2) Source(6, 2) + SourceIndex(0) name (c1) -3 >Emitted(8, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(6, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(9, 1) Source(4, 14) + SourceIndex(0) -2 >Emitted(9, 11) Source(4, 16) + SourceIndex(0) -3 >Emitted(9, 16) Source(6, 2) + SourceIndex(0) -4 >Emitted(9, 17) Source(6, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(10, 1) Source(8, 12) + SourceIndex(0) -2 >Emitted(10, 18) Source(8, 21) + SourceIndex(0) -3 >Emitted(10, 21) Source(8, 24) + SourceIndex(0) -4 >Emitted(10, 25) Source(8, 28) + SourceIndex(0) -5 >Emitted(10, 27) Source(8, 30) + SourceIndex(0) -6 >Emitted(10, 29) Source(8, 32) + SourceIndex(0) -7 >Emitted(10, 30) Source(8, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (f1) -2 >Emitted(12, 11) Source(10, 11) + SourceIndex(0) name (f1) -3 >Emitted(12, 12) Source(10, 12) + SourceIndex(0) name (f1) -4 >Emitted(12, 29) Source(10, 21) + SourceIndex(0) name (f1) -5 >Emitted(12, 30) Source(10, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(13, 1) Source(11, 1) + SourceIndex(0) name (f1) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(14, 1) Source(9, 17) + SourceIndex(0) -2 >Emitted(14, 11) Source(9, 19) + SourceIndex(0) -3 >Emitted(14, 16) Source(11, 2) + SourceIndex(0) -4 >Emitted(14, 17) Source(11, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(15, 1) Source(13, 12) + SourceIndex(0) -2 >Emitted(15, 11) Source(13, 14) + SourceIndex(0) -3 >Emitted(15, 14) Source(13, 17) + SourceIndex(0) -4 >Emitted(15, 16) Source(13, 19) + SourceIndex(0) -5 >Emitted(15, 17) Source(13, 20) + SourceIndex(0) -6 >Emitted(15, 22) Source(13, 25) + SourceIndex(0) -7 >Emitted(15, 23) Source(13, 26) + SourceIndex(0) ---- ->>>exports.a3 = m2.m2_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - >export var -2 >a3 -3 > = -4 > m2 -5 > . -6 > m2_c1 -7 > ; -1->Emitted(16, 1) Source(14, 12) + SourceIndex(0) -2 >Emitted(16, 11) Source(14, 14) + SourceIndex(0) -3 >Emitted(16, 14) Source(14, 17) + SourceIndex(0) -4 >Emitted(16, 16) Source(14, 19) + SourceIndex(0) -5 >Emitted(16, 17) Source(14, 20) + SourceIndex(0) -6 >Emitted(16, 22) Source(14, 25) + SourceIndex(0) -7 >Emitted(16, 23) Source(14, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 4afd4e69f2d..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import m1 = require("ref/m1"); -import m2 = require("../outputdir_module_multifolder_ref/m2"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; -export declare var a3: typeof m2.m2_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 14c09e444a5..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,17 +0,0 @@ -var m1 = require("ref/m1"); -var m2 = require("../outputdir_module_multifolder_ref/m2"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -exports.a3 = m2.m2_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 4ac74c2fcdb..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_module_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AAC9B,IAAO,EAAE,WAAW,wCAAwC,CAAC,CAAC;AACnD,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC;AACd,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map deleted file mode 100644 index 6751f2f82cd..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json index 5419c5a8225..4d92e8a8951 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 906ba3a07ac..e0c060eb889 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js deleted file mode 100644 index 372f1052b89..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index a57b57d2b17..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map deleted file mode 100644 index ca45773f423..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json index 5419c5a8225..4d92e8a8951 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "m1.js.map", - "m1.js", - "m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt index 432e0b90c49..dfbb5f48fff 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:m1.js -sourceFile:m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 22) Source(1, 25) + SourceIndex(0) -6 >Emitted(1, 23) Source(1, 26) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 27) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index 250d2615a79..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js deleted file mode 100644 index c2e7dfa443b..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map deleted file mode 100644 index 41d3e11e995..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAC;AACf,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js deleted file mode 100644 index bbaba444ba2..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js +++ /dev/null @@ -1,15 +0,0 @@ -define(["require", "exports"], function (require, exports) { - exports.m1_a1 = 10; - var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; - })(); - exports.m1_c1 = m1_c1; - exports.m1_instance1 = new m1_c1(); - function m1_f1() { - return exports.m1_instance1; - } - exports.m1_f1 = m1_f1; -}); -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map deleted file mode 100644 index 6c5413f630e..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":";IAAW,aAAK,GAAG,EAAE,CAAC;IACtB;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAACA,AAFD,IAEC;IAFY,aAAK,QAEjB,CAAA;IAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;IACtC;QACIE,MAAMA,CAACA,oBAAYA,CAACA;IACxBA,CAACA;IAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json index d80dacb3444..e1f6d3c6e36 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index a5d445804bf..54624487a57 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,375 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>define(["require", "exports"], function (require, exports) { ->>> exports.m1_a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 > m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(1, 12) + SourceIndex(0) -2 >Emitted(2, 18) Source(1, 17) + SourceIndex(0) -3 >Emitted(2, 21) Source(1, 20) + SourceIndex(0) -4 >Emitted(2, 23) Source(1, 22) + SourceIndex(0) -5 >Emitted(2, 24) Source(1, 23) + SourceIndex(0) ---- ->>> var m1_c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(5, 9) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(5, 10) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 21) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(7, 6) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(7, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_c1 = m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(8, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(8, 18) Source(2, 19) + SourceIndex(0) -3 >Emitted(8, 26) Source(4, 2) + SourceIndex(0) -4 >Emitted(8, 27) Source(4, 2) + SourceIndex(0) ---- ->>> exports.m1_instance1 = new m1_c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(6, 12) + SourceIndex(0) -2 >Emitted(9, 25) Source(6, 24) + SourceIndex(0) -3 >Emitted(9, 28) Source(6, 27) + SourceIndex(0) -4 >Emitted(9, 32) Source(6, 31) + SourceIndex(0) -5 >Emitted(9, 37) Source(6, 36) + SourceIndex(0) -6 >Emitted(9, 39) Source(6, 38) + SourceIndex(0) -7 >Emitted(9, 40) Source(6, 39) + SourceIndex(0) ---- ->>> function m1_f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(11, 9) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 15) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(11, 16) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(11, 36) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(11, 37) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(12, 6) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>> exports.m1_f1 = m1_f1; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -1-> -2 > m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(13, 5) Source(7, 17) + SourceIndex(0) -2 >Emitted(13, 18) Source(7, 22) + SourceIndex(0) -3 >Emitted(13, 26) Source(9, 2) + SourceIndex(0) -4 >Emitted(13, 27) Source(9, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>define(["require", "exports", "ref/m1"], function (require, exports, m1) { ->>> exports.a1 = 10; -1 >^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >import m1 = require("ref/m1"); - >export var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 15) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 18) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 20) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 21) Source(2, 20) + SourceIndex(0) ---- ->>> var c1 = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 5) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(4, 9) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 9) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 10) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 9) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 18) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 6) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 10) Source(5, 2) + SourceIndex(0) ---- ->>> exports.c1 = c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 > c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 5) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 15) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 20) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 21) Source(5, 2) + SourceIndex(0) ---- ->>> exports.instance1 = new c1(); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 > instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 5) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 22) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 25) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 29) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 31) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 33) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 34) Source(7, 33) + SourceIndex(0) ---- ->>> function f1() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 5) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 9) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 15) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 16) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 33) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 34) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(12, 5) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 6) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>> exports.f1 = f1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 5) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 20) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 21) Source(10, 2) + SourceIndex(0) ---- ->>> exports.a2 = m1.m1_c1; -1->^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -1-> - > - >export var -2 > a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 5) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 15) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 18) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 20) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 21) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 26) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 27) Source(12, 26) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js deleted file mode 100644 index 6c8aeb3190b..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js +++ /dev/null @@ -1,16 +0,0 @@ -define(["require", "exports", "ref/m1"], function (require, exports, m1) { - exports.a1 = 10; - var c1 = (function () { - function c1() { - } - return c1; - })(); - exports.c1 = c1; - exports.instance1 = new c1(); - function f1() { - return exports.instance1; - } - exports.f1 = f1; - exports.a2 = m1.m1_c1; -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map deleted file mode 100644 index a57b57d2b17..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":";IACW,UAAE,GAAG,EAAE,CAAC;IACnB;QAAAA;QAEAC,CAACA;QAADD,SAACA;IAADA,CAACA,AAFD,IAEC;IAFY,UAAE,KAEd,CAAA;IAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;IAChC;QACIE,MAAMA,CAACA,iBAASA,CAACA;IACrBA,CAACA;IAFe,UAAE,KAEjB,CAAA;IAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts deleted file mode 100644 index 4a53b24b156..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare var m1_a1: number; -export declare class m1_c1 { - m1_c1_p1: number; -} -export declare var m1_instance1: m1_c1; -export declare function m1_f1(): m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js deleted file mode 100644 index 1b4470e2b37..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.m1_a1 = 10; -var m1_c1 = (function () { - function m1_c1() { - } - return m1_c1; -})(); -exports.m1_c1 = m1_c1; -exports.m1_instance1 = new m1_c1(); -function m1_f1() { - return exports.m1_instance1; -} -exports.m1_f1 = m1_f1; -//# sourceMappingURL=m1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map deleted file mode 100644 index 35e7e9a48dd..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/ref/m1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"m1.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1"],"mappings":"AAAW,aAAK,GAAG,EAAE,CAAC;AACtB;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAFY,aAAK,QAEjB,CAAA;AAEU,oBAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AACtC;IACIE,MAAMA,CAACA,oBAAYA,CAACA;AACxBA,CAACA;AAFe,aAAK,QAEpB,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json index d80dacb3444..e1f6d3c6e36 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -15,12 +15,6 @@ "test.ts" ], "emittedFiles": [ - "ref/m1.js.map", - "ref/m1.js", - "ref/m1.d.ts", - "test.js.map", - "test.js", - "test.d.ts", "bin/test.js.map", "bin/test.js", "bin/test.d.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt index 3f2ad9829b3..2903ad0141c 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.sourcemap.txt @@ -1,396 +1,4 @@ =================================================================== -JsFile: m1.js -mapUrl: m1.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: ref/m1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/m1.js -sourceFile:ref/m1.ts -------------------------------------------------------------------- ->>>exports.m1_a1 = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 >export var -2 >m1_a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(1, 1) Source(1, 12) + SourceIndex(0) -2 >Emitted(1, 14) Source(1, 17) + SourceIndex(0) -3 >Emitted(1, 17) Source(1, 20) + SourceIndex(0) -4 >Emitted(1, 19) Source(1, 22) + SourceIndex(0) -5 >Emitted(1, 20) Source(1, 23) + SourceIndex(0) ---- ->>>var m1_c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function m1_c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (m1_c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1->export class m1_c1 { - > public m1_c1_p1: number; - > -2 > } -1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (m1_c1.constructor) -2 >Emitted(4, 6) Source(4, 2) + SourceIndex(0) name (m1_c1.constructor) ---- ->>> return m1_c1; -1->^^^^ -2 > ^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(5, 17) Source(4, 2) + SourceIndex(0) name (m1_c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class m1_c1 { - > public m1_c1_p1: number; - > } -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) name (m1_c1) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) name (m1_c1) -3 >Emitted(6, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(6, 6) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_c1 = m1_c1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >m1_c1 -3 > { - > public m1_c1_p1: number; - > } -4 > -1->Emitted(7, 1) Source(2, 14) + SourceIndex(0) -2 >Emitted(7, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(7, 22) Source(4, 2) + SourceIndex(0) -4 >Emitted(7, 23) Source(4, 2) + SourceIndex(0) ---- ->>>exports.m1_instance1 = new m1_c1(); -1-> -2 >^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >m1_instance1 -3 > = -4 > new -5 > m1_c1 -6 > () -7 > ; -1->Emitted(8, 1) Source(6, 12) + SourceIndex(0) -2 >Emitted(8, 21) Source(6, 24) + SourceIndex(0) -3 >Emitted(8, 24) Source(6, 27) + SourceIndex(0) -4 >Emitted(8, 28) Source(6, 31) + SourceIndex(0) -5 >Emitted(8, 33) Source(6, 36) + SourceIndex(0) -6 >Emitted(8, 35) Source(6, 38) + SourceIndex(0) -7 >Emitted(8, 36) Source(6, 39) + SourceIndex(0) ---- ->>>function m1_f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 1) Source(7, 1) + SourceIndex(0) ---- ->>> return exports.m1_instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function m1_f1() { - > -2 > return -3 > -4 > m1_instance1 -5 > ; -1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (m1_f1) -2 >Emitted(10, 11) Source(8, 11) + SourceIndex(0) name (m1_f1) -3 >Emitted(10, 12) Source(8, 12) + SourceIndex(0) name (m1_f1) -4 >Emitted(10, 32) Source(8, 24) + SourceIndex(0) name (m1_f1) -5 >Emitted(10, 33) Source(8, 25) + SourceIndex(0) name (m1_f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(11, 1) Source(9, 1) + SourceIndex(0) name (m1_f1) -2 >Emitted(11, 2) Source(9, 2) + SourceIndex(0) name (m1_f1) ---- ->>>exports.m1_f1 = m1_f1; -1-> -2 >^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >m1_f1 -3 > () { - > return m1_instance1; - > } -4 > -1->Emitted(12, 1) Source(7, 17) + SourceIndex(0) -2 >Emitted(12, 14) Source(7, 22) + SourceIndex(0) -3 >Emitted(12, 22) Source(9, 2) + SourceIndex(0) -4 >Emitted(12, 23) Source(9, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=m1.js.map=================================================================== -JsFile: test.js -mapUrl: test.js.map -sourceRoot: http://typescript.codeplex.com/ -sources: test.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:test.js -sourceFile:test.ts -------------------------------------------------------------------- ->>>var m1 = require("ref/m1"); -1 > -2 >^^^^ -3 > ^^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^ -6 > ^ -7 > ^ -1 > -2 >import -3 > m1 -4 > = require( -5 > "ref/m1" -6 > ) -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 7) Source(1, 10) + SourceIndex(0) -4 >Emitted(1, 18) Source(1, 21) + SourceIndex(0) -5 >Emitted(1, 26) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 27) Source(1, 30) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 31) + SourceIndex(0) ---- ->>>exports.a1 = 10; -1 > -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1 > - >export var -2 >a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 1) Source(2, 12) + SourceIndex(0) -2 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -3 >Emitted(2, 14) Source(2, 17) + SourceIndex(0) -4 >Emitted(2, 16) Source(2, 19) + SourceIndex(0) -5 >Emitted(2, 17) Source(2, 20) + SourceIndex(0) ---- ->>>var c1 = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^-> -1-> - > -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ---- ->>> function c1() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c1) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^-> -1->export class c1 { - > public p1: number; - > -2 > } -1->Emitted(5, 5) Source(5, 1) + SourceIndex(0) name (c1.constructor) -2 >Emitted(5, 6) Source(5, 2) + SourceIndex(0) name (c1.constructor) ---- ->>> return c1; -1->^^^^ -2 > ^^^^^^^^^ -1-> -2 > } -1->Emitted(6, 5) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(6, 14) Source(5, 2) + SourceIndex(0) name (c1) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > export class c1 { - > public p1: number; - > } -1 >Emitted(7, 1) Source(5, 1) + SourceIndex(0) name (c1) -2 >Emitted(7, 2) Source(5, 2) + SourceIndex(0) name (c1) -3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0) -4 >Emitted(7, 6) Source(5, 2) + SourceIndex(0) ---- ->>>exports.c1 = c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^-> -1-> -2 >c1 -3 > { - > public p1: number; - > } -4 > -1->Emitted(8, 1) Source(3, 14) + SourceIndex(0) -2 >Emitted(8, 11) Source(3, 16) + SourceIndex(0) -3 >Emitted(8, 16) Source(5, 2) + SourceIndex(0) -4 >Emitted(8, 17) Source(5, 2) + SourceIndex(0) ---- ->>>exports.instance1 = new c1(); -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^ -6 > ^^ -7 > ^ -1-> - > - >export var -2 >instance1 -3 > = -4 > new -5 > c1 -6 > () -7 > ; -1->Emitted(9, 1) Source(7, 12) + SourceIndex(0) -2 >Emitted(9, 18) Source(7, 21) + SourceIndex(0) -3 >Emitted(9, 21) Source(7, 24) + SourceIndex(0) -4 >Emitted(9, 25) Source(7, 28) + SourceIndex(0) -5 >Emitted(9, 27) Source(7, 30) + SourceIndex(0) -6 >Emitted(9, 29) Source(7, 32) + SourceIndex(0) -7 >Emitted(9, 30) Source(7, 33) + SourceIndex(0) ---- ->>>function f1() { -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(10, 1) Source(8, 1) + SourceIndex(0) ---- ->>> return exports.instance1; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^ -1->export function f1() { - > -2 > return -3 > -4 > instance1 -5 > ; -1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (f1) -2 >Emitted(11, 11) Source(9, 11) + SourceIndex(0) name (f1) -3 >Emitted(11, 12) Source(9, 12) + SourceIndex(0) name (f1) -4 >Emitted(11, 29) Source(9, 21) + SourceIndex(0) name (f1) -5 >Emitted(11, 30) Source(9, 22) + SourceIndex(0) name (f1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(12, 1) Source(10, 1) + SourceIndex(0) name (f1) -2 >Emitted(12, 2) Source(10, 2) + SourceIndex(0) name (f1) ---- ->>>exports.f1 = f1; -1-> -2 >^^^^^^^^^^ -3 > ^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 >f1 -3 > () { - > return instance1; - > } -4 > -1->Emitted(13, 1) Source(8, 17) + SourceIndex(0) -2 >Emitted(13, 11) Source(8, 19) + SourceIndex(0) -3 >Emitted(13, 16) Source(10, 2) + SourceIndex(0) -4 >Emitted(13, 17) Source(10, 2) + SourceIndex(0) ---- ->>>exports.a2 = m1.m1_c1; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^ -7 > ^ -8 > ^^^^^^^^^-> -1-> - > - >export var -2 >a2 -3 > = -4 > m1 -5 > . -6 > m1_c1 -7 > ; -1->Emitted(14, 1) Source(12, 12) + SourceIndex(0) -2 >Emitted(14, 11) Source(12, 14) + SourceIndex(0) -3 >Emitted(14, 14) Source(12, 17) + SourceIndex(0) -4 >Emitted(14, 16) Source(12, 19) + SourceIndex(0) -5 >Emitted(14, 17) Source(12, 20) + SourceIndex(0) -6 >Emitted(14, 22) Source(12, 25) + SourceIndex(0) -7 >Emitted(14, 23) Source(12, 26) + SourceIndex(0) ---- ->>>//# sourceMappingURL=test.js.map=================================================================== JsFile: test.js mapUrl: test.js.map sourceRoot: http://typescript.codeplex.com/ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts deleted file mode 100644 index a61d8541048..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import m1 = require("ref/m1"); -export declare var a1: number; -export declare class c1 { - p1: number; -} -export declare var instance1: c1; -export declare function f1(): c1; -export declare var a2: typeof m1.m1_c1; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js deleted file mode 100644 index 46c9f29e55a..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var m1 = require("ref/m1"); -exports.a1 = 10; -var c1 = (function () { - function c1() { - } - return c1; -})(); -exports.c1 = c1; -exports.instance1 = new c1(); -function f1() { - return exports.instance1; -} -exports.f1 = f1; -exports.a2 = m1.m1_c1; -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map deleted file mode 100644 index d0638b6c34c..00000000000 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,IAAO,EAAE,WAAW,QAAQ,CAAC,CAAC;AACnB,UAAE,GAAG,EAAE,CAAC;AACnB;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAFY,UAAE,KAEd,CAAA;AAEU,iBAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AAChC;IACIE,MAAMA,CAACA,iBAASA,CAACA;AACrBA,CAACA;AAFe,UAAE,KAEjB,CAAA;AAEU,UAAE,GAAG,EAAE,CAAC,KAAK,CAAC"} \ No newline at end of file From d4d60783ebf1f519c6b8a95105e63831e8daa420 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 30 Oct 2015 15:53:44 -0700 Subject: [PATCH 073/140] accept new baselines postmerge --- ...tAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...apRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...tRelativePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...apRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...otUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...rlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/outModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/outModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../node/outModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...tAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...tRelativePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../sourcemapModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- 27 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index 20fc9c39de5..f705eb8105e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== ../outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 12592331fb5..0cf639d7f1c 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index bbe6b1772ae..676e800a45e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; From f06627f780ea0420897d3dfb9cee54a1f8def643 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 30 Oct 2015 16:35:31 -0700 Subject: [PATCH 074/140] prevent absolutre paths from leaking through error baselines --- src/harness/projectsRunner.ts | 2 +- ...RootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...tAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...apRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt | 2 +- ...RootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...tRelativePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...apRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- .../maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/maprootUrlMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/maprootUrlSubfolderSpecifyOutputFile.errors.txt | 2 +- ...UrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...otUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...rlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...ootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...prootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/outMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- .../node/outModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/outModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../node/outModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/outMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/outSubfolderSpecifyOutputFile.errors.txt | 2 +- .../rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt | 4 ++-- .../rootDirectoryErrors/node/rootDirectoryErrors.errors.txt | 4 ++-- ...RootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...tAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...rceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt | 2 +- ...RootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...tRelativePathModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt | 2 +- ...ootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- ...rceRootRelativePathMultifolderSpecifyOutputFile.errors.txt | 4 ++-- ...ourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- .../sourcemapModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/sourcemapMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/sourcemapSubfolderSpecifyOutputFile.errors.txt | 2 +- .../sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt | 4 ++-- ...xedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt | 4 ++-- ...sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt | 2 +- .../sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt | 2 +- .../node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt | 4 ++-- .../node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt | 2 +- 66 files changed, 104 insertions(+), 104 deletions(-) diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index aca90c92f8e..75affe04d13 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -349,7 +349,7 @@ class ProjectRunner extends RunnerBase { let inputFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(), sourceFile => sourceFile.fileName !== "lib.d.ts"), sourceFile => { - return { unitName: sourceFile.fileName, content: sourceFile.text }; + return { unitName: RunnerBase.removeFullPaths(sourceFile.fileName), content: sourceFile.text }; }); return Harness.Compiler.getErrorBaseline(inputFiles, compilerResult.errors); diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt index dfbdd679685..cde83785831 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt @@ -2,11 +2,11 @@ error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/Fo !!! error TS6059: File 'fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. -==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== +==== fileC.ts (0 errors) ==== class C { } -==== FolderA/FolderB/fileB.ts (0 errors) ==== +==== fileB.ts (0 errors) ==== /// class B { public c: C; diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt index dfbdd679685..cde83785831 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt @@ -2,11 +2,11 @@ error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/Fo !!! error TS6059: File 'fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. -==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== +==== fileC.ts (0 errors) ==== class C { } -==== FolderA/FolderB/fileB.ts (0 errors) ==== +==== fileB.ts (0 errors) ==== /// class B { public c: C; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt index 51edf2991ad..ea1bbf2ba6b 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt index f705eb8105e..247f9e4f2f2 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. export function m1_f1() { return m1_instance1; } -==== G:/ts/typescript/tests/cases/projects/outputdir_module_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== export var m2_a1 = 10; export class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt index 0cf639d7f1c..12592331fb5 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_simple/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt index 676e800a45e..42154149020 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== G:/ts/typescript/tests/cases/projects/outputdir_module_subfolder/ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== export var m1_a1 = 10; export class m1_c1 { public m1_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt index 664beb97bc2..53a35eb2c84 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; @@ -12,7 +12,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. function m1_f1() { return m1_instance1; } -==== ../outputdir_multifolder_ref/m2.ts (0 errors) ==== +==== m2.ts (0 errors) ==== var m2_a1 = 10; class m2_c1 { public m2_c1_p1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt index 110e3849820..376cfa761b8 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.errors.txt @@ -2,7 +2,7 @@ error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -==== ref/m1.ts (0 errors) ==== +==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { public m1_c1_p1: number; From 6d683d2a967165717907a3cf43d78bbccb269309 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 2 Nov 2015 10:44:25 -0800 Subject: [PATCH 075/140] Add initial test --- .../genericClassExpressionInFunction.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts diff --git a/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts new file mode 100644 index 00000000000..ab2155c0324 --- /dev/null +++ b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts @@ -0,0 +1,13 @@ +class A { + genericVar: T +} +function B() { + // class expression can use T + return class extends A { } +} +// extends can call B +class K extends B() { + name: string; +} +var c = new K(); +c.genericVar = 12; From d48a4f0cf184f5ff045d027693282c3b1b03c003 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 2 Nov 2015 10:48:59 -0800 Subject: [PATCH 076/140] fix nits --- src/compiler/checker.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8ae8ab3d54c..b77faadd011 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -112,6 +112,7 @@ namespace ts { let circularType = createIntrinsicType(TypeFlags.Any, "__circular__"); let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + let emptyUnionType = emptyObjectType; let emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; @@ -4321,7 +4322,7 @@ namespace ts { // a named type that circularly references itself. function getUnionType(types: Type[], noSubtypeReduction?: boolean): Type { if (types.length === 0) { - return emptyObjectType; + return emptyUnionType; } let typeSet: Type[] = []; addTypesToSet(typeSet, types, TypeFlags.Union); @@ -6278,8 +6279,8 @@ namespace ts { // Only narrow when symbol is variable of type any or an object, union, or type parameter type if (node && symbol.flags & SymbolFlags.Variable) { if (isTypeAny(type) || type.flags & (TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) { - let originalType = type; - let nodeStack: {node: Node, child: Node}[] = []; + const originalType = type; + const nodeStack: {node: Node, child: Node}[] = []; loop: while (node.parent) { let child = node; node = node.parent; @@ -6304,7 +6305,7 @@ namespace ts { let nodes: {node: Node, child: Node}; while (nodes = nodeStack.pop()) { - let {node, child} = nodes; + const {node, child} = nodes; switch (node.kind) { case SyntaxKind.IfStatement: // In a branch of an if statement, narrow based on controlling expression @@ -6334,13 +6335,13 @@ namespace ts { } // Use original type if construct contains assignments to variable - if (type != originalType && isVariableAssignedWithin(symbol, node)) { + if (type !== originalType && isVariableAssignedWithin(symbol, node)) { type = originalType; } } // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type - if (type === getUnionType(emptyArray)) { + if (type === emptyUnionType) { type = originalType; } } @@ -6368,7 +6369,7 @@ namespace ts { } let flags: TypeFlags; if (typeInfo) { - flags = typeInfo.flags; + flags = typeInfo.flags; } else { assumeTrue = !assumeTrue; @@ -6377,12 +6378,12 @@ namespace ts { // At this point we can bail if it's not a union if (!(type.flags & TypeFlags.Union)) { // If the active non-union type would be removed from a union by this type guard, return an empty union - return filterUnion(type) ? type : getUnionType(emptyArray); + return filterUnion(type) ? type : emptyUnionType; } return getUnionType(filter((type as UnionType).types, filterUnion), /*noSubtypeReduction*/ true); - function filterUnion(t: Type) { - return assumeTrue === !!(t.flags & flags); + function filterUnion(type: Type) { + return assumeTrue === !!(type.flags & flags); } } @@ -12558,7 +12559,7 @@ namespace ts { arrayType = getUnionType(filter((arrayOrStringType as UnionType).types, t => !(t.flags & TypeFlags.StringLike))); } else if (arrayOrStringType.flags & TypeFlags.StringLike) { - arrayType = getUnionType(emptyArray); + arrayType = emptyUnionType; } let hasStringConstituent = arrayOrStringType !== arrayType; From 6de5221dcddf3da57869a370abf6166993ebff2f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 2 Nov 2015 12:53:27 -0800 Subject: [PATCH 077/140] dont mutate --- src/compiler/declarationEmitter.ts | 2 +- src/compiler/emitter.ts | 32 +++++++++++++----------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 426000f6282..cfb7c98968b 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -130,7 +130,7 @@ namespace ts { } else if (isExternalModule(sourceFile)) { noDeclare = true; - write(`declare module "${sourceFile.moduleName}" {`); + write(`declare module "${getModuleName(host, sourceFile)}" {`); writeLine(); increaseIndent(); emitSourceFile(sourceFile); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1343a5c85d9..2c6e2dc621f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7,6 +7,10 @@ namespace ts { return isExternalModule(sourceFile) || isDeclarationFile(sourceFile); } + export function getModuleName(host: EmitHost, file: SourceFile): string { + return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); + } + type DependencyGroup = Array; let entities: Map = { @@ -578,12 +582,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi forEach(host.getSourceFiles(), emitEmitHelpers); } forEach(host.getSourceFiles(), sourceFile => { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { + if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && isExternalModule(sourceFile))) { emitSourceFile(sourceFile); } - else if (modulekind && isExternalModule(sourceFile)) { - emitConcatenatedModule(sourceFile); - } }); } @@ -597,14 +598,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emit(sourceFile); } - function emitConcatenatedModule(sourceFile: SourceFile): void { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - let canonicalName = getExternalModuleNameFromPath(host, sourceFile.fileName); - sourceFile.moduleName = sourceFile.moduleName || canonicalName; - emit(sourceFile); - } - function isUniqueName(name: string): boolean { return !resolver.hasGlobalName(name) && !hasProperty(currentSourceFile.identifiers, name) && @@ -7282,6 +7275,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("}"); // execute } + function writeModuleName(node: SourceFile, resolveModuleNames?: boolean): void { + let moduleName = node.moduleName; + if (moduleName || (resolveModuleNames && (moduleName = getModuleName(host, node)))) { + write(`"${moduleName}", `); + } + } + function emitSystemModule(node: SourceFile, resolveModuleNames?: boolean): void { collectExternalModuleInfo(node); // System modules has the following shape @@ -7297,9 +7297,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - if (node.moduleName) { - write(`"${node.moduleName}", `); - } + writeModuleName(node, resolveModuleNames); write("["); let groupIndices: Map = {}; @@ -7459,9 +7457,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeLine(); write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } + writeModuleName(node, resolveModuleNames); emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, resolveModuleNames); increaseIndent(); let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); From 265fb518a8c3c715cf7ba43debbc635cf8b61fc4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 2 Nov 2015 16:54:12 -0800 Subject: [PATCH 078/140] feedback from CR --- src/compiler/checker.ts | 15 ++++++- src/compiler/declarationEmitter.ts | 18 ++++----- src/compiler/emitter.ts | 63 ++++++++++++------------------ src/compiler/types.ts | 2 +- 4 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 821c7ca7e7b..f5d35e6ae78 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14908,10 +14908,23 @@ namespace ts { getTypeReferenceSerializationKind, isOptionalParameter, isArgumentsLocalBinding, - getSymbolAtLocation + getExternalModuleFileFromDeclaration }; } + function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile { + const specifier = getExternalModuleName(declaration); + const moduleSymbol = getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return undefined; + } + const moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; + if (!moduleDeclaration) { + return undefined; + } + return moduleDeclaration; + } + function initializeTypeChecker() { // Bind all source files and propagate errors forEach(host.getSourceFiles(), file => { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index cfb7c98968b..9d34da29897 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -130,7 +130,7 @@ namespace ts { } else if (isExternalModule(sourceFile)) { noDeclare = true; - write(`declare module "${getModuleName(host, sourceFile)}" {`); + write(`declare module "${getResolvedExternalModuleName(host, sourceFile)}" {`); writeLine(); increaseIndent(); emitSourceFile(sourceFile); @@ -738,16 +738,12 @@ namespace ts { function emitExternalModuleSpecifier(moduleSpecifier: Expression) { if (moduleSpecifier.kind === SyntaxKind.StringLiteral && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier); - if (moduleSymbol) { - let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; - if (moduleDeclaration && !isDeclarationFile(moduleDeclaration)) { - let nonRelativeModuleName = getExternalModuleNameFromPath(host, moduleDeclaration.fileName); - write("\""); - write(nonRelativeModuleName); - write("\""); - return; - } + let moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration)); + if (moduleName) { + write("\""); + write(moduleName); + write("\""); + return; } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 2c6e2dc621f..4baf62668ad 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7,10 +7,18 @@ namespace ts { return isExternalModule(sourceFile) || isDeclarationFile(sourceFile); } - export function getModuleName(host: EmitHost, file: SourceFile): string { + export function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string { return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); } + export function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string { + let file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + type DependencyGroup = Array; let entities: Map = { @@ -553,7 +561,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi /** If removeComments is true, no leading-comments needed to be emitted **/ let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker; - let moduleEmitDelegates: Map<(node: SourceFile, resolveModuleNames?: boolean) => void> = { + let moduleEmitDelegates: Map<(node: SourceFile, emitRelativePathAsModuleName?: boolean) => void> = { [ModuleKind.ES6]: emitES6Module, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, @@ -561,7 +569,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi [ModuleKind.CommonJS]: emitCommonJSModule, }; - let bundleEmitDelegates: Map<(node: SourceFile, resolveModuleNames?: boolean) => void> = { + let bundleEmitDelegates: Map<(node: SourceFile, emitRelativePathAsModuleName?: boolean) => void> = { [ModuleKind.ES6]() {}, [ModuleKind.AMD]: emitAMDModule, [ModuleKind.System]: emitSystemModule, @@ -7275,14 +7283,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("}"); // execute } - function writeModuleName(node: SourceFile, resolveModuleNames?: boolean): void { + function writeModuleName(node: SourceFile, emitRelativePathAsModuleName?: boolean): void { let moduleName = node.moduleName; - if (moduleName || (resolveModuleNames && (moduleName = getModuleName(host, node)))) { + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { write(`"${moduleName}", `); } } - function emitSystemModule(node: SourceFile, resolveModuleNames?: boolean): void { + function emitSystemModule(node: SourceFile, emitRelativePathAsModuleName?: boolean): void { collectExternalModuleInfo(node); // System modules has the following shape // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) @@ -7297,7 +7305,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - writeModuleName(node, resolveModuleNames); + writeModuleName(node, emitRelativePathAsModuleName); write("["); let groupIndices: Map = {}; @@ -7320,8 +7328,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(", "); } - if (resolveModuleNames) { - let name = lookupSpecifierName(externalImports[i]); + if (emitRelativePathAsModuleName) { + let name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); if (name) { text = `"${name}"`; } @@ -7340,32 +7348,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("});"); } - function lookupSpecifierName(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string { - let specifier: Node; - if (declaration.kind === SyntaxKind.ImportEqualsDeclaration) { - specifier = (declaration as ImportEqualsDeclaration).moduleReference; - } - else { - specifier = (declaration as ImportDeclaration | ExportDeclaration).moduleSpecifier; - } - let moduleSymbol = resolver.getSymbolAtLocation(specifier); - if (!moduleSymbol) { - return undefined; - } - let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; - if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) { - return undefined; - } - return getExternalModuleNameFromPath(host, moduleDeclaration.fileName); - } - interface AMDDependencyNames { aliasedModuleNames: string[]; unaliasedModuleNames: string[]; importAliasNames: string[]; } - function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, resolveModuleNames?: boolean): AMDDependencyNames { + function getAMDDependencyNames(node: SourceFile, includeNonAmdDependencies: boolean, emitRelativePathAsModuleName?: boolean): AMDDependencyNames { // names of modules with corresponding parameter in the factory function let aliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in factory function @@ -7389,8 +7378,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Find the name of the external module let externalModuleName = getExternalModuleNameText(importNode); - if (resolveModuleNames) { - let name = lookupSpecifierName(importNode); + if (emitRelativePathAsModuleName) { + let name = getExternalModuleNameFromDeclaration(host, resolver, importNode); if (name) { externalModuleName = `"${name}"`; } @@ -7410,7 +7399,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return { aliasedModuleNames, unaliasedModuleNames, importAliasNames }; } - function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean, resolveModuleNames?: boolean) { + function emitAMDDependencies(node: SourceFile, includeNonAmdDependencies: boolean, emitRelativePathAsModuleName?: boolean) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // @@ -7423,7 +7412,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, resolveModuleNames); + let dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -7451,14 +7440,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(") {"); } - function emitAMDModule(node: SourceFile, resolveModuleNames?: boolean) { + function emitAMDModule(node: SourceFile, emitRelativePathAsModuleName?: boolean) { emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); - writeModuleName(node, resolveModuleNames); - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, resolveModuleNames); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); @@ -7712,7 +7701,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitModule(node); } else { - bundleEmitDelegates[modulekind](node, /*resolveModuleNames*/true); + bundleEmitDelegates[modulekind](node, /*emitRelativePathAsModuleName*/true); } } else { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 50d34286fa1..bc88356193d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1619,7 +1619,7 @@ namespace ts { getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; isOptionalParameter(node: ParameterDeclaration): boolean; isArgumentsLocalBinding(node: Identifier): boolean; - getSymbolAtLocation(node: Node): Symbol; + getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile; } export const enum SymbolFlags { From 1baea882467d1254deac181b9f1fe66a36caab1d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 2 Nov 2015 17:04:59 -0800 Subject: [PATCH 079/140] shorten function --- src/compiler/checker.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0bb87337466..f8da1edaeed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14911,11 +14911,7 @@ namespace ts { if (!moduleSymbol) { return undefined; } - const moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; - if (!moduleDeclaration) { - return undefined; - } - return moduleDeclaration; + return getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; } function initializeTypeChecker() { From 2be7f4f27b0e60ea19a83a291f353a4a9238390f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 3 Nov 2015 12:53:31 -0800 Subject: [PATCH 080/140] Skip files with no-default-lib when '--skipDefaultLibCheck' and '--noLib' are used. --- src/compiler/checker.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 65f507c13c0..3fd42865c32 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14058,8 +14058,16 @@ namespace ts { if (!(links.flags & NodeCheckFlags.TypeChecked)) { // Check whether the file has declared it is the default lib, // and whether the user has specifically chosen to avoid checking it. - if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) { - return; + if (compilerOptions.skipDefaultLibCheck) { + if (node.isDefaultLib) { + return; + } + + // If the user specified '--noLib' and a file has a `/// , + // then we should treat that file as a default lib. + if (compilerOptions.noLib && node.hasNoDefaultLib) { + return; + } } // Grammar checking From b9368a955cd43d33e4f1e86c13011f76b8afbce1 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 3 Nov 2015 12:55:18 -0800 Subject: [PATCH 081/140] Fixed comment. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3fd42865c32..9b0c5d3468c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14063,7 +14063,7 @@ namespace ts { return; } - // If the user specified '--noLib' and a file has a `/// , + // If the user specified '--noLib' and a file has a '/// ', // then we should treat that file as a default lib. if (compilerOptions.noLib && node.hasNoDefaultLib) { return; From 77c69daf2e7d67f8ec54947983ce331e672c454c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 3 Nov 2015 14:35:11 -0800 Subject: [PATCH 082/140] const all the things --- src/compiler/checker.ts | 97 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b77faadd011..4bdbebaa50b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -33,26 +33,26 @@ namespace ts { // they no longer need the information (for example, if the user started editing again). let cancellationToken: CancellationToken; - let Symbol = objectAllocator.getSymbolConstructor(); - let Type = objectAllocator.getTypeConstructor(); - let Signature = objectAllocator.getSignatureConstructor(); + const Symbol = objectAllocator.getSymbolConstructor(); + const Type = objectAllocator.getTypeConstructor(); + const Signature = objectAllocator.getSignatureConstructor(); let typeCount = 0; let symbolCount = 0; - let emptyArray: any[] = []; - let emptySymbols: SymbolTable = {}; + const emptyArray: any[] = []; + const emptySymbols: SymbolTable = {}; - let compilerOptions = host.getCompilerOptions(); - let languageVersion = compilerOptions.target || ScriptTarget.ES3; - let modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None; + const compilerOptions = host.getCompilerOptions(); + const languageVersion = compilerOptions.target || ScriptTarget.ES3; + const modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None; - let emitResolver = createResolver(); + const emitResolver = createResolver(); - let undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); - let argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); + const undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); + const argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); - let checker: TypeChecker = { + const checker: TypeChecker = { getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"), getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"), getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount, @@ -97,36 +97,35 @@ namespace ts { isOptionalParameter }; - let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); - let resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); + const unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); + const resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); - let anyType = createIntrinsicType(TypeFlags.Any, "any"); - let stringType = createIntrinsicType(TypeFlags.String, "string"); - let numberType = createIntrinsicType(TypeFlags.Number, "number"); - let booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); - let esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); - let voidType = createIntrinsicType(TypeFlags.Void, "void"); - let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); - let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); - let unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); - let circularType = createIntrinsicType(TypeFlags.Any, "__circular__"); + const anyType = createIntrinsicType(TypeFlags.Any, "any"); + const stringType = createIntrinsicType(TypeFlags.String, "string"); + const numberType = createIntrinsicType(TypeFlags.Number, "number"); + const booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + const esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); + const voidType = createIntrinsicType(TypeFlags.Void, "void"); + const undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); + const nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); + const unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); - let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - let emptyUnionType = emptyObjectType; - let emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const emptyUnionType = emptyObjectType; + const emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; - let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType; - let noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - let anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - let unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + const anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); - let globals: SymbolTable = {}; + const globals: SymbolTable = {}; let globalESSymbolConstructorSymbol: Symbol; @@ -161,29 +160,29 @@ namespace ts { let getGlobalPromiseConstructorLikeType: () => ObjectType; let getGlobalThenableType: () => ObjectType; - let tupleTypes: Map = {}; - let unionTypes: Map = {}; - let intersectionTypes: Map = {}; - let stringLiteralTypes: Map = {}; + const tupleTypes: Map = {}; + const unionTypes: Map = {}; + const intersectionTypes: Map = {}; + const stringLiteralTypes: Map = {}; let emitExtends = false; let emitDecorate = false; let emitParam = false; let emitAwaiter = false; let emitGenerator = false; - let resolutionTargets: TypeSystemEntity[] = []; - let resolutionResults: boolean[] = []; - let resolutionPropertyNames: TypeSystemPropertyName[] = []; + const resolutionTargets: TypeSystemEntity[] = []; + const resolutionResults: boolean[] = []; + const resolutionPropertyNames: TypeSystemPropertyName[] = []; - let mergedSymbols: Symbol[] = []; - let symbolLinks: SymbolLinks[] = []; - let nodeLinks: NodeLinks[] = []; - let potentialThisCollisions: Node[] = []; - let awaitedTypeStack: number[] = []; + const mergedSymbols: Symbol[] = []; + const symbolLinks: SymbolLinks[] = []; + const nodeLinks: NodeLinks[] = []; + const potentialThisCollisions: Node[] = []; + const awaitedTypeStack: number[] = []; - let diagnostics = createDiagnosticCollection(); + const diagnostics = createDiagnosticCollection(); - let primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { + const primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { "string": { type: stringType, flags: TypeFlags.StringLike @@ -210,9 +209,9 @@ namespace ts { Element: "Element" }; - let subtypeRelation: Map = {}; - let assignableRelation: Map = {}; - let identityRelation: Map = {}; + const subtypeRelation: Map = {}; + const assignableRelation: Map = {}; + const identityRelation: Map = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. let _displayBuilder: SymbolDisplayBuilder; From 9223b02136f0ede6ebeacf0404a7c8c9a2851486 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 3 Nov 2015 14:42:03 -0800 Subject: [PATCH 083/140] Improve test case and add working comparison --- .../genericClassExpressionInFunction.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts index ab2155c0324..70f63e8a929 100644 --- a/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts +++ b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts @@ -1,13 +1,25 @@ class A { genericVar: T } -function B() { +class B3 extends A { +} +function B1() { // class expression can use T - return class extends A { } + return class extends A { } +} +class B2 { + anon = class extends A { } } // extends can call B -class K extends B() { +class K extends B1() { + namae: string; +} +class C extends (new B2().anon) { name: string; } -var c = new K(); +var c = new C(); +var k = new K(); +var b3 = new B3(); c.genericVar = 12; +k.genericVar = 12; +b3.genericVar = 12 From db2b23da00b54042b966cd6387fca6d67ba88a42 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 4 Nov 2015 15:35:21 -0800 Subject: [PATCH 084/140] allow computed properties in destructuring, treat computed properties with literal expressions similar to literal named properties --- src/compiler/binder.ts | 5 + src/compiler/checker.ts | 80 +++++++++++++--- src/compiler/emitter.ts | 23 +++-- src/compiler/parser.ts | 9 +- src/compiler/types.ts | 5 +- src/compiler/utilities.ts | 14 ++- src/services/services.ts | 5 +- ...putedPropertiesInDestructuring1.errors.txt | 88 +++++++++++++++++ .../computedPropertiesInDestructuring1.js | 75 +++++++++++++++ ...dPropertiesInDestructuring1_ES6.errors.txt | 87 +++++++++++++++++ .../computedPropertiesInDestructuring1_ES6.js | 64 +++++++++++++ .../computedPropertiesInDestructuring2.js | 7 ++ ...computedPropertiesInDestructuring2.symbols | 8 ++ .../computedPropertiesInDestructuring2.types | 12 +++ .../computedPropertiesInDestructuring2_ES6.js | 8 ++ ...utedPropertiesInDestructuring2_ES6.symbols | 9 ++ ...mputedPropertiesInDestructuring2_ES6.types | 13 +++ .../computedPropertyNames10_ES5.types | 4 +- .../computedPropertyNames10_ES6.types | 4 +- .../reference/computedPropertyNames11_ES5.js | 12 +-- .../computedPropertyNames11_ES5.types | 4 +- .../computedPropertyNames11_ES6.types | 4 +- .../computedPropertyNames12_ES5.errors.txt | 8 +- .../computedPropertyNames12_ES6.errors.txt | 8 +- .../reference/computedPropertyNames16_ES5.js | 10 -- .../reference/computedPropertyNames36_ES5.js | 4 - .../reference/computedPropertyNames37_ES5.js | 4 - .../computedPropertyNames40_ES5.errors.txt | 8 +- .../computedPropertyNames40_ES6.errors.txt | 8 +- .../computedPropertyNames42_ES5.errors.txt | 5 +- .../computedPropertyNames42_ES6.errors.txt | 5 +- .../reference/computedPropertyNames43_ES5.js | 4 - .../computedPropertyNames45_ES5.errors.txt | 5 +- .../computedPropertyNames45_ES6.errors.txt | 5 +- .../computedPropertyNames4_ES5.types | 4 +- .../computedPropertyNames4_ES6.types | 4 +- .../computedPropertyNamesSourceMap2_ES5.types | 4 +- .../computedPropertyNamesSourceMap2_ES6.types | 4 +- ...itClassDeclarationWithGetterSetterInES6.js | 16 ++-- ...ssDeclarationWithGetterSetterInES6.symbols | 12 +-- ...lassDeclarationWithGetterSetterInES6.types | 16 ++-- .../emitClassDeclarationWithMethodInES6.js | 24 ++--- ...mitClassDeclarationWithMethodInES6.symbols | 24 ++--- .../emitClassDeclarationWithMethodInES6.types | 24 ++--- .../literalsInComputedProperties1.errors.txt | 66 +++++++++++++ .../literalsInComputedProperties1.js | 94 +++++++++++++++++++ .../computedPropertiesInDestructuring1.ts | 36 +++++++ .../computedPropertiesInDestructuring1_ES6.ts | 36 +++++++ .../computedPropertiesInDestructuring2.ts | 2 + .../computedPropertiesInDestructuring2_ES6.ts | 4 + .../compiler/literalsInComputedProperties1.ts | 52 ++++++++++ ...itClassDeclarationWithGetterSetterInES6.ts | 8 +- .../emitClassDeclarationWithMethodInES6.ts | 12 +-- 53 files changed, 882 insertions(+), 174 deletions(-) create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring1.js create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring1_ES6.js create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2.js create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2.symbols create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2.types create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2_ES6.js create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2_ES6.symbols create mode 100644 tests/baselines/reference/computedPropertiesInDestructuring2_ES6.types create mode 100644 tests/baselines/reference/literalsInComputedProperties1.errors.txt create mode 100644 tests/baselines/reference/literalsInComputedProperties1.js create mode 100644 tests/cases/compiler/computedPropertiesInDestructuring1.ts create mode 100644 tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts create mode 100644 tests/cases/compiler/computedPropertiesInDestructuring2.ts create mode 100644 tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts create mode 100644 tests/cases/compiler/literalsInComputedProperties1.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1169e331f1f..8a986d40435 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -188,6 +188,11 @@ namespace ts { } if (node.name.kind === SyntaxKind.ComputedPropertyName) { let nameExpression = (node.name).expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (isStringOrNumericLiteral(nameExpression.kind)) { + return (nameExpression).text; + } + Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); return getPropertyNameForKnownSymbolName((nameExpression).name.text); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 65f507c13c0..dffb360fca8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2337,6 +2337,26 @@ namespace ts { return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); } + function getTextOfPropertyName(name: PropertyName): string { + switch (name.kind) { + case SyntaxKind.Identifier: + return (name).text; + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + return (name).text; + case SyntaxKind.ComputedPropertyName: + if (isStringOrNumericLiteral((name).expression.kind)) { + return ((name).expression).text; + } + } + + return undefined; + } + + function isComputedNonLiteralName(name: PropertyName): boolean { + return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((name).expression.kind); + } + // Return the inferred type for a binding element function getTypeForBindingElement(declaration: BindingElement): Type { let pattern = declaration.parent; @@ -2359,10 +2379,17 @@ namespace ts { if (pattern.kind === SyntaxKind.ObjectBindingPattern) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) let name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { + // computed properties with non-literal names are treated as 'any' + return anyType; + } + // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || + let text = getTextOfPropertyName(name); + + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String); if (!type) { error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name)); @@ -2474,9 +2501,16 @@ namespace ts { function getTypeFromObjectBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type { let members: SymbolTable = {}; forEach(pattern.elements, e => { - let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); let name = e.propertyName || e.name; - let symbol = createSymbol(flags, name.text); + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type + return; + } + + let text = getTextOfPropertyName(name); + let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); + + let symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType); symbol.bindingElement = e; members[symbol.name] = symbol; @@ -9999,19 +10033,27 @@ namespace ts { let properties = node.properties; for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { - // TODO(andersh): Computed property support - let name = (p).name; + let name = (p).name; + if (name.kind === SyntaxKind.ComputedPropertyName) { + checkComputedPropertyName(name); + } + if (isComputedNonLiteralName(name)) { + continue; + } + + let text = getTextOfPropertyName(name); let type = isTypeAny(sourceType) ? sourceType - : getTypeOfPropertyOfType(sourceType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) || + : getTypeOfPropertyOfType(sourceType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(sourceType, IndexKind.Number) || getIndexTypeOfType(sourceType, IndexKind.String); if (type) { if (p.kind === SyntaxKind.ShorthandPropertyAssignment) { checkDestructuringAssignment(p, type); } else { - checkDestructuringAssignment((p).initializer || name, type); + // non-shorthand property assignments should always have initializers + checkDestructuringAssignment((p).initializer, type); } } else { @@ -12130,6 +12172,14 @@ namespace ts { checkExpressionCached(node.initializer); } } + + if (node.kind === SyntaxKind.BindingElement) { + // check computed properties inside property names of binding elements + if (node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName) { + checkComputedPropertyName(node.propertyName); + } + } + // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { forEach((node.name).elements, checkSourceElement); @@ -12147,6 +12197,7 @@ namespace ts { } return; } + let symbol = getSymbolOfNode(node); let type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { @@ -13234,11 +13285,14 @@ namespace ts { let enumIsConst = isConst(node); for (const member of node.members) { - if (member.name.kind === SyntaxKind.ComputedPropertyName) { + if (isComputedNonLiteralName(member.name)) { error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } - else if (isNumericLiteralName((member.name).text)) { - error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); + else { + let text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } } const previousEnumMemberIsNonConstant = autoValue === undefined; @@ -15682,7 +15736,7 @@ namespace ts { } function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((node).expression)) { + if (isDynamicName(node)) { return grammarErrorOnNode(node, message); } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f0ec75c005c..f44911a3189 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4167,15 +4167,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return node; } - function createPropertyAccessForDestructuringProperty(object: Expression, propName: Identifier | LiteralExpression): Expression { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - let syntheticName = createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== SyntaxKind.Identifier) { - return createElementAccessExpression(object, syntheticName); + function createPropertyAccessForDestructuringProperty(object: Expression, propName: PropertyName): Expression { + let index: Expression; + const nameIsComputed = propName.kind === SyntaxKind.ComputedPropertyName; + if (nameIsComputed) { + index = ensureIdentifier((propName).expression, /* reuseIdentifierExpression */ false); } - return createPropertyAccessExpression(object, syntheticName); + else { + // We create a synthetic copy of the identifier in order to avoid the rewriting that might + // otherwise occur when the identifier is emitted. + index = createSynthesizedNode(propName.kind); + (index).text = (propName).text; + } + + return !nameIsComputed && index.kind === SyntaxKind.Identifier + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); } function createSliceCall(value: Expression, sliceIndex: number): CallExpression { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3e93e31340d..65f55f14cc6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1069,7 +1069,7 @@ namespace ts { token === SyntaxKind.NumericLiteral; } - function parsePropertyNameWorker(allowComputedPropertyNames: boolean): DeclarationName { + function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName { if (token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) { return parseLiteralNode(/*internName*/ true); } @@ -1079,7 +1079,7 @@ namespace ts { return parseIdentifierName(); } - function parsePropertyName(): DeclarationName { + function parsePropertyName(): PropertyName { return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); } @@ -1189,7 +1189,7 @@ namespace ts { case ParsingContext.ObjectLiteralMembers: return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isLiteralPropertyName(); case ParsingContext.ObjectBindingElements: - return isLiteralPropertyName(); + return token === SyntaxKind.OpenBracketToken || isLiteralPropertyName(); case ParsingContext.HeritageClauseElement: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. @@ -4569,7 +4569,6 @@ namespace ts { function parseObjectBindingElement(): BindingElement { let node = createNode(SyntaxKind.BindingElement); - // TODO(andersh): Handle computed properties let tokenIsIdentifier = isIdentifier(); let propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== SyntaxKind.ColonToken) { @@ -4577,7 +4576,7 @@ namespace ts { } else { parseExpected(SyntaxKind.ColonToken); - node.propertyName = propertyName; + node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } node.initializer = parseBindingElementInitializer(/*inParameter*/ false); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f536a1e4693..af6200ac023 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -491,6 +491,7 @@ namespace ts { export type EntityName = Identifier | QualifiedName; + export type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; export interface Declaration extends Node { @@ -543,7 +544,7 @@ namespace ts { // SyntaxKind.BindingElement export interface BindingElement extends Declaration { - propertyName?: Identifier; // Binding property name (in object binding pattern) + propertyName?: PropertyName; // Binding property name (in object binding pattern) dotDotDotToken?: Node; // Present on rest binding element name: Identifier | BindingPattern; // Declared binding element name initializer?: Expression; // Optional initializer @@ -587,7 +588,7 @@ namespace ts { // SyntaxKind.ShorthandPropertyAssignment // SyntaxKind.EnumMember export interface VariableLikeDeclaration extends Declaration { - propertyName?: Identifier; + propertyName?: PropertyName; dotDotDotToken?: Node; name: DeclarationName; questionToken?: Node; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 10b35ce8a01..6764ea20c81 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1427,6 +1427,10 @@ namespace ts { return isFunctionLike(node) && (node.flags & NodeFlags.Async) !== 0 && !isAccessor(node); } + export function isStringOrNumericLiteral(kind: SyntaxKind): boolean { + return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral; + } + /** * A declaration has a dynamic name if both of the following are true: * 1. The declaration has a computed property name @@ -1435,9 +1439,13 @@ namespace ts { * Symbol. */ export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && - declaration.name.kind === SyntaxKind.ComputedPropertyName && - !isWellKnownSymbolSyntactically((declaration.name).expression); + return declaration.name && isDynamicName(declaration.name); + } + + export function isDynamicName(name: DeclarationName): boolean { + return name.kind === SyntaxKind.ComputedPropertyName && + !isStringOrNumericLiteral((name).expression.kind) && + !isWellKnownSymbolSyntactically((name).expression); } /** diff --git a/src/services/services.ts b/src/services/services.ts index 1672e4ad4ff..a2ffd2d991e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3814,7 +3814,10 @@ namespace ts { let existingName: string; if (m.kind === SyntaxKind.BindingElement && (m).propertyName) { - existingName = (m).propertyName.text; + // include only identifiers in completion list + if ((m).propertyName.kind === SyntaxKind.Identifier) { + existingName = ((m).propertyName).text + } } else { // TODO(jfreeman): Account for computed property name diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt new file mode 100644 index 00000000000..682db92f95f --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt @@ -0,0 +1,88 @@ +tests/cases/compiler/computedPropertiesInDestructuring1.ts(3,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(8,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(10,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(11,28): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,27): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,12): error TS2339: Property 'toExponential' does not exist on type 'string'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,41): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(24,18): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(28,22): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(30,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(31,24): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,23): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,26): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + +==== tests/cases/compiler/computedPropertiesInDestructuring1.ts (16 errors) ==== + // destructuring in variable declarations + let foo = "bar"; + let {[foo]: bar} = {bar: "bar"}; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + let {["bar"]: bar2} = {bar: "bar"}; + + let foo2 = () => "bar"; + let {[foo2()]: bar3} = {bar: "bar"}; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + let [{[foo]: bar4}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + let [{[foo2()]: bar5}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + function f1({["bar"]: x}: { bar: number }) {} + function f2({[foo]: x}: { bar: number }) {} + function f3({[foo2()]: x}: { bar: number }) {} + function f4([{[foo]: x}]: [{ bar: number }]) {} + function f5([{[foo2()]: x}]: [{ bar: number }]) {} + + // report errors on type errors in computed properties used in destructuring + let [{[foo()]: bar6}] = [{bar: "bar"}]; + ~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + ~~~~~~~~~~~~~ +!!! error TS2339: Property 'toExponential' does not exist on type 'string'. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + // destructuring assignment + ({[foo]: bar} = {bar: "bar"}); + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + ({["bar"]: bar2} = {bar: "bar"}); + + ({[foo2()]: bar3} = {bar: "bar"}); + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + [{[foo]: bar4}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + [{[foo2()]: bar5}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + [{[foo()]: bar4}] = [{bar: "bar"}]; + ~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + [{[(1 + {})]: bar4}] = [{bar: "bar"}]; + ~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + + \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.js b/tests/baselines/reference/computedPropertiesInDestructuring1.js new file mode 100644 index 00000000000..0bc4286ed7b --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.js @@ -0,0 +1,75 @@ +//// [computedPropertiesInDestructuring1.ts] +// destructuring in variable declarations +let foo = "bar"; +let {[foo]: bar} = {bar: "bar"}; + +let {["bar"]: bar2} = {bar: "bar"}; + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {bar: "bar"}; + +let [{[foo]: bar4}] = [{bar: "bar"}]; +let [{[foo2()]: bar5}] = [{bar: "bar"}]; + +function f1({["bar"]: x}: { bar: number }) {} +function f2({[foo]: x}: { bar: number }) {} +function f3({[foo2()]: x}: { bar: number }) {} +function f4([{[foo]: x}]: [{ bar: number }]) {} +function f5([{[foo2()]: x}]: [{ bar: number }]) {} + +// report errors on type errors in computed properties used in destructuring +let [{[foo()]: bar6}] = [{bar: "bar"}]; +let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + +// destructuring assignment +({[foo]: bar} = {bar: "bar"}); + +({["bar"]: bar2} = {bar: "bar"}); + +({[foo2()]: bar3} = {bar: "bar"}); + +[{[foo]: bar4}] = [{bar: "bar"}]; +[{[foo2()]: bar5}] = [{bar: "bar"}]; + +[{[foo()]: bar4}] = [{bar: "bar"}]; +[{[(1 + {})]: bar4}] = [{bar: "bar"}]; + + + + +//// [computedPropertiesInDestructuring1.js] +// destructuring in variable declarations +var foo = "bar"; +var _a = foo, bar = { bar: "bar" }[_a]; +var _b = "bar", bar2 = { bar: "bar" }[_b]; +var foo2 = function () { return "bar"; }; +var _c = foo2(), bar3 = { bar: "bar" }[_c]; +var _d = foo, bar4 = [{ bar: "bar" }][0][_d]; +var _e = foo2(), bar5 = [{ bar: "bar" }][0][_e]; +function f1(_a) { + var _b = "bar", x = _a[_b]; +} +function f2(_a) { + var _b = foo, x = _a[_b]; +} +function f3(_a) { + var _b = foo2(), x = _a[_b]; +} +function f4(_a) { + var _b = foo, x = _a[0][_b]; +} +function f5(_a) { + var _b = foo2(), x = _a[0][_b]; +} +// report errors on type errors in computed properties used in destructuring +var _f = foo(), bar6 = [{ bar: "bar" }][0][_f]; +var _g = foo.toExponential(), bar7 = [{ bar: "bar" }][0][_g]; +// destructuring assignment +(_h = { bar: "bar" }, _j = foo, bar = _h[_j], _h); +(_k = { bar: "bar" }, _l = "bar", bar2 = _k[_l], _k); +(_m = { bar: "bar" }, _o = foo2(), bar3 = _m[_o], _m); +_p = foo, bar4 = [{ bar: "bar" }][0][_p]; +_q = foo2(), bar5 = [{ bar: "bar" }][0][_q]; +_r = foo(), bar4 = [{ bar: "bar" }][0][_r]; +_s = (1 + {}), bar4 = [{ bar: "bar" }][0][_s]; +var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt new file mode 100644 index 00000000000..1866cf1d543 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt @@ -0,0 +1,87 @@ +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(3,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(9,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(11,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(12,28): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,27): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,12): error TS2339: Property 'toExponential' does not exist on type 'string'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,41): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(25,18): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(29,22): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(31,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(32,24): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,23): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,26): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + +==== tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts (16 errors) ==== + // destructuring in variable declarations + let foo = "bar"; + let {[foo]: bar} = {bar: "bar"}; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + let {["bar"]: bar2} = {bar: "bar"}; + let {[11]: bar2_1} = {11: "bar"}; + + let foo2 = () => "bar"; + let {[foo2()]: bar3} = {bar: "bar"}; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + let [{[foo]: bar4}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + let [{[foo2()]: bar5}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + function f1({["bar"]: x}: { bar: number }) {} + function f2({[foo]: x}: { bar: number }) {} + function f3({[foo2()]: x}: { bar: number }) {} + function f4([{[foo]: x}]: [{ bar: number }]) {} + function f5([{[foo2()]: x}]: [{ bar: number }]) {} + + // report errors on type errors in computed properties used in destructuring + let [{[foo()]: bar6}] = [{bar: "bar"}]; + ~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + ~~~~~~~~~~~~~ +!!! error TS2339: Property 'toExponential' does not exist on type 'string'. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + // destructuring assignment + ({[foo]: bar} = {bar: "bar"}); + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + ({["bar"]: bar2} = {bar: "bar"}); + + ({[foo2()]: bar3} = {bar: "bar"}); + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + [{[foo]: bar4}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + [{[foo2()]: bar5}] = [{bar: "bar"}]; + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + + [{[foo()]: bar4}] = [{bar: "bar"}]; + ~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + [{[(1 + {})]: bar4}] = [{bar: "bar"}]; + ~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. + ~~~ +!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. + \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.js b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.js new file mode 100644 index 00000000000..e6e19f93b80 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.js @@ -0,0 +1,64 @@ +//// [computedPropertiesInDestructuring1_ES6.ts] +// destructuring in variable declarations +let foo = "bar"; +let {[foo]: bar} = {bar: "bar"}; + +let {["bar"]: bar2} = {bar: "bar"}; +let {[11]: bar2_1} = {11: "bar"}; + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {bar: "bar"}; + +let [{[foo]: bar4}] = [{bar: "bar"}]; +let [{[foo2()]: bar5}] = [{bar: "bar"}]; + +function f1({["bar"]: x}: { bar: number }) {} +function f2({[foo]: x}: { bar: number }) {} +function f3({[foo2()]: x}: { bar: number }) {} +function f4([{[foo]: x}]: [{ bar: number }]) {} +function f5([{[foo2()]: x}]: [{ bar: number }]) {} + +// report errors on type errors in computed properties used in destructuring +let [{[foo()]: bar6}] = [{bar: "bar"}]; +let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + +// destructuring assignment +({[foo]: bar} = {bar: "bar"}); + +({["bar"]: bar2} = {bar: "bar"}); + +({[foo2()]: bar3} = {bar: "bar"}); + +[{[foo]: bar4}] = [{bar: "bar"}]; +[{[foo2()]: bar5}] = [{bar: "bar"}]; + +[{[foo()]: bar4}] = [{bar: "bar"}]; +[{[(1 + {})]: bar4}] = [{bar: "bar"}]; + + +//// [computedPropertiesInDestructuring1_ES6.js] +// destructuring in variable declarations +let foo = "bar"; +let { [foo]: bar } = { bar: "bar" }; +let { ["bar"]: bar2 } = { bar: "bar" }; +let { [11]: bar2_1 } = { 11: "bar" }; +let foo2 = () => "bar"; +let { [foo2()]: bar3 } = { bar: "bar" }; +let [{ [foo]: bar4 }] = [{ bar: "bar" }]; +let [{ [foo2()]: bar5 }] = [{ bar: "bar" }]; +function f1({ ["bar"]: x }) { } +function f2({ [foo]: x }) { } +function f3({ [foo2()]: x }) { } +function f4([{ [foo]: x }]) { } +function f5([{ [foo2()]: x }]) { } +// report errors on type errors in computed properties used in destructuring +let [{ [foo()]: bar6 }] = [{ bar: "bar" }]; +let [{ [foo.toExponential()]: bar7 }] = [{ bar: "bar" }]; +// destructuring assignment +({ [foo]: bar } = { bar: "bar" }); +({ ["bar"]: bar2 } = { bar: "bar" }); +({ [foo2()]: bar3 } = { bar: "bar" }); +[{ [foo]: bar4 }] = [{ bar: "bar" }]; +[{ [foo2()]: bar5 }] = [{ bar: "bar" }]; +[{ [foo()]: bar4 }] = [{ bar: "bar" }]; +[{ [(1 + {})]: bar4 }] = [{ bar: "bar" }]; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2.js b/tests/baselines/reference/computedPropertiesInDestructuring2.js new file mode 100644 index 00000000000..8579881b775 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2.js @@ -0,0 +1,7 @@ +//// [computedPropertiesInDestructuring2.ts] +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {}; + +//// [computedPropertiesInDestructuring2.js] +var foo2 = function () { return "bar"; }; +var _a = foo2(), bar3 = {}[_a]; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2.symbols b/tests/baselines/reference/computedPropertiesInDestructuring2.symbols new file mode 100644 index 00000000000..4ae6d5323e1 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/computedPropertiesInDestructuring2.ts === +let foo2 = () => "bar"; +>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring2.ts, 0, 3)) + +let {[foo2()]: bar3} = {}; +>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring2.ts, 0, 3)) +>bar3 : Symbol(bar3, Decl(computedPropertiesInDestructuring2.ts, 1, 5)) + diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2.types b/tests/baselines/reference/computedPropertiesInDestructuring2.types new file mode 100644 index 00000000000..0fa20662270 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/computedPropertiesInDestructuring2.ts === +let foo2 = () => "bar"; +>foo2 : () => string +>() => "bar" : () => string +>"bar" : string + +let {[foo2()]: bar3} = {}; +>foo2() : string +>foo2 : () => string +>bar3 : any +>{} : {} + diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.js b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.js new file mode 100644 index 00000000000..e0bd16287ee --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.js @@ -0,0 +1,8 @@ +//// [computedPropertiesInDestructuring2_ES6.ts] + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {}; + +//// [computedPropertiesInDestructuring2_ES6.js] +let foo2 = () => "bar"; +let { [foo2()]: bar3 } = {}; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.symbols b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.symbols new file mode 100644 index 00000000000..cd7cfda9844 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts === + +let foo2 = () => "bar"; +>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring2_ES6.ts, 1, 3)) + +let {[foo2()]: bar3} = {}; +>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring2_ES6.ts, 1, 3)) +>bar3 : Symbol(bar3, Decl(computedPropertiesInDestructuring2_ES6.ts, 2, 5)) + diff --git a/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.types b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.types new file mode 100644 index 00000000000..f0d8b1033c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertiesInDestructuring2_ES6.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts === + +let foo2 = () => "bar"; +>foo2 : () => string +>() => "bar" : () => string +>"bar" : string + +let {[foo2()]: bar3} = {}; +>foo2() : string +>foo2 : () => string +>bar3 : any +>{} : {} + diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.types b/tests/baselines/reference/computedPropertyNames10_ES5.types index 87648c1ed80..9dea9cfca93 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} +>v : { [0](): void; [""](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types index 996dfc99fe9..d2faa138980 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES6.types +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} +>v : { [0](): void; [""](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 64c0b0bd67e..0917f824770 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -46,16 +46,8 @@ var v = (_a = {}, enumerable: true, configurable: true }), - Object.defineProperty(_a, "", { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 0, { - get: function () { return 0; }, - enumerable: true, - configurable: true - }), + , + , Object.defineProperty(_a, a, { set: function (v) { }, enumerable: true, diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.types b/tests/baselines/reference/computedPropertyNames11_ES5.types index c3c59c2eb9c..e0787fc3ee7 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} +>v : { [0]: number; [""]: any; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [0]: number; [""]: any; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types index ef11511baae..8ad31a7c2a1 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES6.types +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} +>v : { [0]: number; [""]: any; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [0]: number; [""]: any; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt index 9d07f34f3c4..71f81c27245 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -3,15 +3,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6, tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (9 errors) ==== var s: string; var n: number; var a: any; @@ -32,11 +30,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15 ~~~~ !!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [""]: number; - ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [0]: number; - ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [a]: number; ~~~ !!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt index f0a2267f8b3..8d8cce7e140 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -3,15 +3,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(6, tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (11 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (9 errors) ==== var s: string; var n: number; var a: any; @@ -32,11 +30,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15 ~~~~ !!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [""]: number; - ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [0]: number; - ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [a]: number; ~~~ !!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js index 2c7316e1398..f4d90579d63 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.js +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -48,16 +48,6 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C, "", { - set: function (v) { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, 0, { - get: function () { return 0; }, - enumerable: true, - configurable: true - }); Object.defineProperty(C.prototype, a, { set: function (v) { }, enumerable: true, diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.js b/tests/baselines/reference/computedPropertyNames36_ES5.js index 5519a6d284c..4bb10ea7543 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES5.js +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -27,10 +27,6 @@ var C = (function () { Object.defineProperty(C.prototype, "get1", { // Computed properties get: function () { return new Foo; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.js b/tests/baselines/reference/computedPropertyNames37_ES5.js index 54a7243f3fa..c2a346608fe 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES5.js +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -27,10 +27,6 @@ var C = (function () { Object.defineProperty(C.prototype, "get1", { // Computed properties get: function () { return new Foo; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt index e8ceef0d581..482978064d1 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -1,7 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2393: Duplicate function implementation. tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9,5): error TS2393: Duplicate function implementation. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (3 errors) ==== class Foo { x } class Foo2 { x; y } @@ -10,7 +12,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8, // Computed properties [""]() { return new Foo } + ~~~~ +!!! error TS2393: Duplicate function implementation. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. [""]() { return new Foo2 } + ~~~~ +!!! error TS2393: Duplicate function implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt index 1a032a87b2b..669d0d04e66 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt @@ -1,7 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8,5): error TS2393: Duplicate function implementation. tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(9,5): error TS2393: Duplicate function implementation. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts (3 errors) ==== class Foo { x } class Foo2 { x; y } @@ -10,7 +12,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8, // Computed properties [""]() { return new Foo } + ~~~~ +!!! error TS2393: Duplicate function implementation. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. [""]() { return new Foo2 } + ~~~~ +!!! error TS2393: Duplicate function implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt index 94153c47aa5..bdb978220a0 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -11,8 +10,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8, // Computed properties [""]: Foo; - ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt index 1f4e27d6e81..9feb6ba3d32 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -11,8 +10,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8, // Computed properties [""]: Foo; - ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index c3b7f6a71d0..57026c3c706 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -41,10 +41,6 @@ var D = (function (_super) { Object.defineProperty(D.prototype, "get1", { // Computed properties get: function () { return new Foo; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(D.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 83855c5f0b7..8baae68f337 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,12 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } class C { get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } class D extends C { diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt index 963e01ed86b..e329785f4cf 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -1,12 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } class C { get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } class D extends C { diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.types b/tests/baselines/reference/computedPropertyNames4_ES5.types index 51baca26586..6984d2e69b8 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} +>v : { [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types index 05267049517..1fece561f5a 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES6.types +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : {} ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} +>v : { [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types index 9470aee8eb6..147b2966509 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === var v = { ->v : {} ->{ ["hello"]() { debugger; }} : {} +>v : { ["hello"](): void; } +>{ ["hello"]() { debugger; }} : { ["hello"](): void; } ["hello"]() { >"hello" : string diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types index c4f02155a95..00334680362 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === var v = { ->v : {} ->{ ["hello"]() { debugger; }} : {} +>v : { ["hello"](): void; } +>{ ["hello"]() { debugger; }} : { ["hello"](): void; } ["hello"]() { >"hello" : string diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.js b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.js index ece24d691da..e7f88b92775 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.js +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.js @@ -10,16 +10,16 @@ class C { static get ["computedname"]() { return ""; } - get ["computedname"]() { + get ["computedname1"]() { return ""; } - get ["computedname"]() { + get ["computedname2"]() { return ""; } - set ["computedname"](x: any) { + set ["computedname3"](x: any) { } - set ["computedname"](y: string) { + set ["computedname4"](y: string) { } set foo(a: string) { } @@ -38,15 +38,15 @@ class C { static get ["computedname"]() { return ""; } - get ["computedname"]() { + get ["computedname1"]() { return ""; } - get ["computedname"]() { + get ["computedname2"]() { return ""; } - set ["computedname"](x) { + set ["computedname3"](x) { } - set ["computedname"](y) { + set ["computedname4"](y) { } set foo(a) { } static set bar(b) { } diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols index 2d249348f9b..b2b1a000dc9 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols @@ -21,18 +21,18 @@ class C { static get ["computedname"]() { return ""; } - get ["computedname"]() { + get ["computedname1"]() { return ""; } - get ["computedname"]() { + get ["computedname2"]() { return ""; } - set ["computedname"](x: any) { ->x : Symbol(x, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 18, 25)) + set ["computedname3"](x: any) { +>x : Symbol(x, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 18, 26)) } - set ["computedname"](y: string) { ->y : Symbol(y, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 20, 25)) + set ["computedname4"](y: string) { +>y : Symbol(y, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 20, 26)) } set foo(a: string) { } diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types index 292fb961b10..e4f7d6c00b4 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types @@ -25,25 +25,25 @@ class C { return ""; >"" : string } - get ["computedname"]() { ->"computedname" : string + get ["computedname1"]() { +>"computedname1" : string return ""; >"" : string } - get ["computedname"]() { ->"computedname" : string + get ["computedname2"]() { +>"computedname2" : string return ""; >"" : string } - set ["computedname"](x: any) { ->"computedname" : string + set ["computedname3"](x: any) { +>"computedname3" : string >x : any } - set ["computedname"](y: string) { ->"computedname" : string + set ["computedname4"](y: string) { +>"computedname4" : string >y : string } diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.js b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.js index fc0a510461b..8a79d45b678 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.js +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.js @@ -2,18 +2,18 @@ class D { _bar: string; foo() { } - ["computedName"]() { } - ["computedName"](a: string) { } - ["computedName"](a: string): number { return 1; } + ["computedName1"]() { } + ["computedName2"](a: string) { } + ["computedName3"](a: string): number { return 1; } bar(): string { return this._bar; } baz(a: any, x: string): string { return "HELLO"; } - static ["computedname"]() { } - static ["computedname"](a: string) { } - static ["computedname"](a: string): boolean { return true; } + static ["computedname4"]() { } + static ["computedname5"](a: string) { } + static ["computedname6"](a: string): boolean { return true; } static staticMethod() { var x = 1 + 2; return x @@ -25,18 +25,18 @@ class D { //// [emitClassDeclarationWithMethodInES6.js] class D { foo() { } - ["computedName"]() { } - ["computedName"](a) { } - ["computedName"](a) { return 1; } + ["computedName1"]() { } + ["computedName2"](a) { } + ["computedName3"](a) { return 1; } bar() { return this._bar; } baz(a, x) { return "HELLO"; } - static ["computedname"]() { } - static ["computedname"](a) { } - static ["computedname"](a) { return true; } + static ["computedname4"]() { } + static ["computedname5"](a) { } + static ["computedname6"](a) { return true; } static staticMethod() { var x = 1 + 2; return x; diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols index b7a4dbbf341..970076f6b78 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols @@ -8,15 +8,15 @@ class D { foo() { } >foo : Symbol(foo, Decl(emitClassDeclarationWithMethodInES6.ts, 1, 17)) - ["computedName"]() { } - ["computedName"](a: string) { } ->a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 4, 21)) + ["computedName1"]() { } + ["computedName2"](a: string) { } +>a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 4, 22)) - ["computedName"](a: string): number { return 1; } ->a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 21)) + ["computedName3"](a: string): number { return 1; } +>a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 22)) bar(): string { ->bar : Symbol(bar, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 53)) +>bar : Symbol(bar, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 54)) return this._bar; >this._bar : Symbol(_bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) @@ -30,15 +30,15 @@ class D { return "HELLO"; } - static ["computedname"]() { } - static ["computedname"](a: string) { } ->a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 13, 28)) + static ["computedname4"]() { } + static ["computedname5"](a: string) { } +>a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 13, 29)) - static ["computedname"](a: string): boolean { return true; } ->a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 28)) + static ["computedname6"](a: string): boolean { return true; } +>a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 29)) static staticMethod() { ->staticMethod : Symbol(D.staticMethod, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 64)) +>staticMethod : Symbol(D.staticMethod, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 65)) var x = 1 + 2; >x : Symbol(x, Decl(emitClassDeclarationWithMethodInES6.ts, 16, 11)) diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types index 10ae930c244..02a90729486 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types @@ -8,15 +8,15 @@ class D { foo() { } >foo : () => void - ["computedName"]() { } ->"computedName" : string + ["computedName1"]() { } +>"computedName1" : string - ["computedName"](a: string) { } ->"computedName" : string + ["computedName2"](a: string) { } +>"computedName2" : string >a : string - ["computedName"](a: string): number { return 1; } ->"computedName" : string + ["computedName3"](a: string): number { return 1; } +>"computedName3" : string >a : string >1 : number @@ -36,15 +36,15 @@ class D { return "HELLO"; >"HELLO" : string } - static ["computedname"]() { } ->"computedname" : string + static ["computedname4"]() { } +>"computedname4" : string - static ["computedname"](a: string) { } ->"computedname" : string + static ["computedname5"](a: string) { } +>"computedname5" : string >a : string - static ["computedname"](a: string): boolean { return true; } ->"computedname" : string + static ["computedname6"](a: string): boolean { return true; } +>"computedname6" : string >a : string >true : boolean diff --git a/tests/baselines/reference/literalsInComputedProperties1.errors.txt b/tests/baselines/reference/literalsInComputedProperties1.errors.txt new file mode 100644 index 00000000000..e9972229f79 --- /dev/null +++ b/tests/baselines/reference/literalsInComputedProperties1.errors.txt @@ -0,0 +1,66 @@ +tests/cases/compiler/literalsInComputedProperties1.ts(40,5): error TS2452: An enum member cannot have a numeric name. +tests/cases/compiler/literalsInComputedProperties1.ts(41,5): error TS2452: An enum member cannot have a numeric name. +tests/cases/compiler/literalsInComputedProperties1.ts(42,5): error TS2452: An enum member cannot have a numeric name. +tests/cases/compiler/literalsInComputedProperties1.ts(43,5): error TS2452: An enum member cannot have a numeric name. + + +==== tests/cases/compiler/literalsInComputedProperties1.ts (4 errors) ==== + + let x = { + 1:1, + [2]:1, + "3":1, + ["4"]:1 + } + x[1].toExponential(); + x[2].toExponential(); + x[3].toExponential(); + x[4].toExponential(); + + interface A { + 1:number; + [2]:number; + "3":number; + ["4"]:number; + } + + let y:A; + y[1].toExponential(); + y[2].toExponential(); + y[3].toExponential(); + y[4].toExponential(); + + class C { + 1:number; + [2]:number; + "3":number; + ["4"]:number; + } + + let z:C; + z[1].toExponential(); + z[2].toExponential(); + z[3].toExponential(); + z[4].toExponential(); + + enum X { + 1 = 1, + ~ +!!! error TS2452: An enum member cannot have a numeric name. + [2] = 2, + ~~~ +!!! error TS2452: An enum member cannot have a numeric name. + "3" = 3, + ~~~ +!!! error TS2452: An enum member cannot have a numeric name. + ["4"] = 4, + ~~~~~ +!!! error TS2452: An enum member cannot have a numeric name. + "foo" = 5, + ["bar"] = 6 + } + + let a = X["foo"]; + let a0 = X["bar"]; + + // TODO: make sure that enum still disallow template literals as member names \ No newline at end of file diff --git a/tests/baselines/reference/literalsInComputedProperties1.js b/tests/baselines/reference/literalsInComputedProperties1.js new file mode 100644 index 00000000000..ef11dbff6ea --- /dev/null +++ b/tests/baselines/reference/literalsInComputedProperties1.js @@ -0,0 +1,94 @@ +//// [literalsInComputedProperties1.ts] + +let x = { + 1:1, + [2]:1, + "3":1, + ["4"]:1 +} +x[1].toExponential(); +x[2].toExponential(); +x[3].toExponential(); +x[4].toExponential(); + +interface A { + 1:number; + [2]:number; + "3":number; + ["4"]:number; +} + +let y:A; +y[1].toExponential(); +y[2].toExponential(); +y[3].toExponential(); +y[4].toExponential(); + +class C { + 1:number; + [2]:number; + "3":number; + ["4"]:number; +} + +let z:C; +z[1].toExponential(); +z[2].toExponential(); +z[3].toExponential(); +z[4].toExponential(); + +enum X { + 1 = 1, + [2] = 2, + "3" = 3, + ["4"] = 4, + "foo" = 5, + ["bar"] = 6 +} + +let a = X["foo"]; +let a0 = X["bar"]; + +// TODO: make sure that enum still disallow template literals as member names + +//// [literalsInComputedProperties1.js] +var x = (_a = { + 1: 1 + }, + _a[2] = 1, + _a["3"] = 1, + _a["4"] = 1, + _a +); +x[1].toExponential(); +x[2].toExponential(); +x[3].toExponential(); +x[4].toExponential(); +var y; +y[1].toExponential(); +y[2].toExponential(); +y[3].toExponential(); +y[4].toExponential(); +var C = (function () { + function C() { + } + return C; +})(); +var z; +z[1].toExponential(); +z[2].toExponential(); +z[3].toExponential(); +z[4].toExponential(); +var X; +(function (X) { + X[X["1"] = 1] = "1"; + X[X[2] = 2] = 2; + X[X["3"] = 3] = "3"; + X[X["4"] = 4] = "4"; + X[X["foo"] = 5] = "foo"; + X[X["bar"] = 6] = "bar"; +})(X || (X = {})); +var a = X["foo"]; +var a0 = X["bar"]; +var _a; +// TODO: make sure that enum still disallow template literals as member names diff --git a/tests/cases/compiler/computedPropertiesInDestructuring1.ts b/tests/cases/compiler/computedPropertiesInDestructuring1.ts new file mode 100644 index 00000000000..d3ccaa57ad1 --- /dev/null +++ b/tests/cases/compiler/computedPropertiesInDestructuring1.ts @@ -0,0 +1,36 @@ +// destructuring in variable declarations +let foo = "bar"; +let {[foo]: bar} = {bar: "bar"}; + +let {["bar"]: bar2} = {bar: "bar"}; + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {bar: "bar"}; + +let [{[foo]: bar4}] = [{bar: "bar"}]; +let [{[foo2()]: bar5}] = [{bar: "bar"}]; + +function f1({["bar"]: x}: { bar: number }) {} +function f2({[foo]: x}: { bar: number }) {} +function f3({[foo2()]: x}: { bar: number }) {} +function f4([{[foo]: x}]: [{ bar: number }]) {} +function f5([{[foo2()]: x}]: [{ bar: number }]) {} + +// report errors on type errors in computed properties used in destructuring +let [{[foo()]: bar6}] = [{bar: "bar"}]; +let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + +// destructuring assignment +({[foo]: bar} = {bar: "bar"}); + +({["bar"]: bar2} = {bar: "bar"}); + +({[foo2()]: bar3} = {bar: "bar"}); + +[{[foo]: bar4}] = [{bar: "bar"}]; +[{[foo2()]: bar5}] = [{bar: "bar"}]; + +[{[foo()]: bar4}] = [{bar: "bar"}]; +[{[(1 + {})]: bar4}] = [{bar: "bar"}]; + + diff --git a/tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts b/tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts new file mode 100644 index 00000000000..4951e474fdb --- /dev/null +++ b/tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts @@ -0,0 +1,36 @@ +// @target: ES6 +// destructuring in variable declarations +let foo = "bar"; +let {[foo]: bar} = {bar: "bar"}; + +let {["bar"]: bar2} = {bar: "bar"}; +let {[11]: bar2_1} = {11: "bar"}; + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {bar: "bar"}; + +let [{[foo]: bar4}] = [{bar: "bar"}]; +let [{[foo2()]: bar5}] = [{bar: "bar"}]; + +function f1({["bar"]: x}: { bar: number }) {} +function f2({[foo]: x}: { bar: number }) {} +function f3({[foo2()]: x}: { bar: number }) {} +function f4([{[foo]: x}]: [{ bar: number }]) {} +function f5([{[foo2()]: x}]: [{ bar: number }]) {} + +// report errors on type errors in computed properties used in destructuring +let [{[foo()]: bar6}] = [{bar: "bar"}]; +let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; + +// destructuring assignment +({[foo]: bar} = {bar: "bar"}); + +({["bar"]: bar2} = {bar: "bar"}); + +({[foo2()]: bar3} = {bar: "bar"}); + +[{[foo]: bar4}] = [{bar: "bar"}]; +[{[foo2()]: bar5}] = [{bar: "bar"}]; + +[{[foo()]: bar4}] = [{bar: "bar"}]; +[{[(1 + {})]: bar4}] = [{bar: "bar"}]; diff --git a/tests/cases/compiler/computedPropertiesInDestructuring2.ts b/tests/cases/compiler/computedPropertiesInDestructuring2.ts new file mode 100644 index 00000000000..806c528c17c --- /dev/null +++ b/tests/cases/compiler/computedPropertiesInDestructuring2.ts @@ -0,0 +1,2 @@ +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {}; \ No newline at end of file diff --git a/tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts b/tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts new file mode 100644 index 00000000000..c21f86bed1c --- /dev/null +++ b/tests/cases/compiler/computedPropertiesInDestructuring2_ES6.ts @@ -0,0 +1,4 @@ +// @target: ES6 + +let foo2 = () => "bar"; +let {[foo2()]: bar3} = {}; \ No newline at end of file diff --git a/tests/cases/compiler/literalsInComputedProperties1.ts b/tests/cases/compiler/literalsInComputedProperties1.ts new file mode 100644 index 00000000000..e3fed5b80aa --- /dev/null +++ b/tests/cases/compiler/literalsInComputedProperties1.ts @@ -0,0 +1,52 @@ +// @noImplicitAny: true + +let x = { + 1:1, + [2]:1, + "3":1, + ["4"]:1 +} +x[1].toExponential(); +x[2].toExponential(); +x[3].toExponential(); +x[4].toExponential(); + +interface A { + 1:number; + [2]:number; + "3":number; + ["4"]:number; +} + +let y:A; +y[1].toExponential(); +y[2].toExponential(); +y[3].toExponential(); +y[4].toExponential(); + +class C { + 1:number; + [2]:number; + "3":number; + ["4"]:number; +} + +let z:C; +z[1].toExponential(); +z[2].toExponential(); +z[3].toExponential(); +z[4].toExponential(); + +enum X { + 1 = 1, + [2] = 2, + "3" = 3, + ["4"] = 4, + "foo" = 5, + ["bar"] = 6 +} + +let a = X["foo"]; +let a0 = X["bar"]; + +// TODO: make sure that enum still disallow template literals as member names \ No newline at end of file diff --git a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithGetterSetterInES6.ts b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithGetterSetterInES6.ts index 70c0b35763e..54c95c95a37 100644 --- a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithGetterSetterInES6.ts +++ b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithGetterSetterInES6.ts @@ -10,16 +10,16 @@ class C { static get ["computedname"]() { return ""; } - get ["computedname"]() { + get ["computedname1"]() { return ""; } - get ["computedname"]() { + get ["computedname2"]() { return ""; } - set ["computedname"](x: any) { + set ["computedname3"](x: any) { } - set ["computedname"](y: string) { + set ["computedname4"](y: string) { } set foo(a: string) { } diff --git a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithMethodInES6.ts b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithMethodInES6.ts index c5d95bc6cb1..b7399a3511c 100644 --- a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithMethodInES6.ts +++ b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithMethodInES6.ts @@ -2,18 +2,18 @@ class D { _bar: string; foo() { } - ["computedName"]() { } - ["computedName"](a: string) { } - ["computedName"](a: string): number { return 1; } + ["computedName1"]() { } + ["computedName2"](a: string) { } + ["computedName3"](a: string): number { return 1; } bar(): string { return this._bar; } baz(a: any, x: string): string { return "HELLO"; } - static ["computedname"]() { } - static ["computedname"](a: string) { } - static ["computedname"](a: string): boolean { return true; } + static ["computedname4"]() { } + static ["computedname5"](a: string) { } + static ["computedname6"](a: string): boolean { return true; } static staticMethod() { var x = 1 + 2; return x From ea87bbaee6d98f5359d924f9734849de9c256d43 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 4 Nov 2015 15:48:44 -0800 Subject: [PATCH 085/140] Have travis build against node 5 Since it is the latest stable release, but 4 is the latest LTS release, we should have CI against both. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 03e319f6b16..b31d1f10da0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: + - 'stable' - '4' - '0.10' From 31331ff6d1399acf51ec68edef0d6052a468b255 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 5 Nov 2015 16:31:30 -0800 Subject: [PATCH 086/140] Addressing CR feedback --- src/compiler/checker.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1fde2711e12..836c16b51d8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5603,28 +5603,30 @@ namespace ts { return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - // A source signature matches a target signature if the two signatures have the same number of required, - // optional, and rest parameters. - function isMatchingSignature(source: Signature, target: Signature) { - return source.parameters.length === target.parameters.length && + function isMatchingSignature(source: Signature, target: Signature, partialMatch: boolean) { + // A source signature matches a target signature if the two signatures have the same number of required, + // optional, and rest parameters. + if (source.parameters.length === target.parameters.length && source.minArgumentCount === target.minArgumentCount && - source.hasRestParameter === target.hasRestParameter; - } - - // A source signature partially matches a target signature if the target signature has no fewer required - // parameters and no more overall parameters than the source signature (where a signature with a rest - // parameter is always considered to have more overall parameters than one without). - function isPartiallyMatchingSignature(source: Signature, target: Signature) { - return source.minArgumentCount <= target.minArgumentCount && ( + source.hasRestParameter === target.hasRestParameter) { + return true; + } + // A source signature partially matches a target signature if the target signature has no fewer required + // parameters and no more overall parameters than the source signature (where a signature with a rest + // parameter is always considered to have more overall parameters than one without). + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && ( source.hasRestParameter && !target.hasRestParameter || - source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length); + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; } function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { if (source === target) { return Ternary.True; } - if (!(isMatchingSignature(source, target) || partialMatch && isPartiallyMatchingSignature(source, target))) { + if (!(isMatchingSignature(source, target, partialMatch))) { return Ternary.False; } let result = Ternary.True; From eee211a2a6b73029554880fc917b402c09ee58c1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Nov 2015 08:54:22 -0800 Subject: [PATCH 087/140] Instantiate type parameter constraints with type parameter as 'this' --- src/compiler/checker.ts | 24 +++++++++++++++++------- src/compiler/types.ts | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3d836ce38d4..8161ead7c78 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2990,7 +2990,7 @@ namespace ts { (type).typeArguments = type.typeParameters; type.thisType = createType(TypeFlags.TypeParameter | TypeFlags.ThisType); type.thisType.symbol = symbol; - type.thisType.constraint = getTypeWithThisArgument(type); + type.thisType.constraint = type; } } return links.declaredType; @@ -3533,6 +3533,21 @@ namespace ts { return type.flags & TypeFlags.UnionOrIntersection ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + /** + * The apparent type of a type parameter is the base constraint instantiated with the type parameter + * as the type argument for the 'this' type. + */ + function getApparentTypeOfTypeParameter(type: TypeParameter) { + if (!type.resolvedApparentType) { + let constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & TypeFlags.TypeParameter) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } + /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the @@ -3540,12 +3555,7 @@ namespace ts { */ function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { - do { - type = getConstraintOfTypeParameter(type); - } while (type && type.flags & TypeFlags.TypeParameter); - if (!type) { - type = emptyObjectType; - } + type = getApparentTypeOfTypeParameter(type); } if (type.flags & TypeFlags.StringLike) { type = globalStringType; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f536a1e4693..679957d1d38 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1956,6 +1956,8 @@ namespace ts { target?: TypeParameter; // Instantiation target /* @internal */ mapper?: TypeMapper; // Instantiation mapper + /* @internal */ + resolvedApparentType: Type; } export const enum SignatureKind { From 870e96e525b19ec88a9c31beef80c89f2080933c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Nov 2015 08:55:08 -0800 Subject: [PATCH 088/140] Adding test --- .../types/thisType/thisTypeAndConstraints.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts diff --git a/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts new file mode 100644 index 00000000000..f46b251c3b2 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts @@ -0,0 +1,21 @@ +class A { + self() { + return this; + } +} + +function f(x: T) { + function g(x: U) { + x = x.self(); + } + x = x.self(); +} + +class B { + foo(x: T) { + x = x.self(); + } + bar(x: U) { + x = x.self(); + } +} From a234497004b5d2ad05e6832c896e17e086980cec Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Nov 2015 08:55:26 -0800 Subject: [PATCH 089/140] Updating existing test --- tests/cases/conformance/types/thisType/thisTypeInClasses.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts index 17dc13cf558..6c650341fbe 100644 --- a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts +++ b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts @@ -1,7 +1,6 @@ class C1 { x: this; f(x: this): this { return undefined; } - constructor(x: this) { } } class C2 { From d52455f8902a5182ebdfbc6b8813c7e740c0dede Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Nov 2015 08:56:09 -0800 Subject: [PATCH 090/140] Accepting new baselines --- tests/baselines/reference/fuzzy.errors.txt | 2 + .../reference/thisTypeAndConstraints.js | 50 +++++++++ .../reference/thisTypeAndConstraints.symbols | 70 ++++++++++++ .../reference/thisTypeAndConstraints.types | 78 +++++++++++++ .../reference/thisTypeInClasses.errors.txt | 57 ---------- .../baselines/reference/thisTypeInClasses.js | 3 +- .../reference/thisTypeInClasses.symbols | 105 +++++++++--------- .../reference/thisTypeInClasses.types | 3 - 8 files changed, 252 insertions(+), 116 deletions(-) create mode 100644 tests/baselines/reference/thisTypeAndConstraints.js create mode 100644 tests/baselines/reference/thisTypeAndConstraints.symbols create mode 100644 tests/baselines/reference/thisTypeAndConstraints.types delete mode 100644 tests/baselines/reference/thisTypeInClasses.errors.txt diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index 72ac4c816f9..0aa8207ff98 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -4,6 +4,7 @@ tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; on Types of property 'oneI' are incompatible. Type 'this' is not assignable to type 'I'. Type 'C' is not assignable to type 'I'. + Property 'alsoWorks' is missing in type 'C'. tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other. Property 'anything' is missing in type '{ oneI: this; }'. @@ -38,6 +39,7 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; !!! error TS2322: Types of property 'oneI' are incompatible. !!! error TS2322: Type 'this' is not assignable to type 'I'. !!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property 'alsoWorks' is missing in type 'C'. } worksToo():R { diff --git a/tests/baselines/reference/thisTypeAndConstraints.js b/tests/baselines/reference/thisTypeAndConstraints.js new file mode 100644 index 00000000000..d62ebe6917c --- /dev/null +++ b/tests/baselines/reference/thisTypeAndConstraints.js @@ -0,0 +1,50 @@ +//// [thisTypeAndConstraints.ts] +class A { + self() { + return this; + } +} + +function f(x: T) { + function g(x: U) { + x = x.self(); + } + x = x.self(); +} + +class B { + foo(x: T) { + x = x.self(); + } + bar(x: U) { + x = x.self(); + } +} + + +//// [thisTypeAndConstraints.js] +var A = (function () { + function A() { + } + A.prototype.self = function () { + return this; + }; + return A; +})(); +function f(x) { + function g(x) { + x = x.self(); + } + x = x.self(); +} +var B = (function () { + function B() { + } + B.prototype.foo = function (x) { + x = x.self(); + }; + B.prototype.bar = function (x) { + x = x.self(); + }; + return B; +})(); diff --git a/tests/baselines/reference/thisTypeAndConstraints.symbols b/tests/baselines/reference/thisTypeAndConstraints.symbols new file mode 100644 index 00000000000..5f93df22c1a --- /dev/null +++ b/tests/baselines/reference/thisTypeAndConstraints.symbols @@ -0,0 +1,70 @@ +=== tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts === +class A { +>A : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) + + self() { +>self : Symbol(self, Decl(thisTypeAndConstraints.ts, 0, 9)) + + return this; +>this : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) + } +} + +function f(x: T) { +>f : Symbol(f, Decl(thisTypeAndConstraints.ts, 4, 1)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 6, 11)) +>A : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 6, 24)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 6, 11)) + + function g(x: U) { +>g : Symbol(g, Decl(thisTypeAndConstraints.ts, 6, 31)) +>U : Symbol(U, Decl(thisTypeAndConstraints.ts, 7, 15)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 6, 11)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 7, 28)) +>U : Symbol(U, Decl(thisTypeAndConstraints.ts, 7, 15)) + + x = x.self(); +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 7, 28)) +>x.self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 7, 28)) +>self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) + } + x = x.self(); +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 6, 24)) +>x.self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 6, 24)) +>self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) +} + +class B { +>B : Symbol(B, Decl(thisTypeAndConstraints.ts, 11, 1)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 13, 8)) +>A : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) + + foo(x: T) { +>foo : Symbol(foo, Decl(thisTypeAndConstraints.ts, 13, 22)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 14, 8)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 13, 8)) + + x = x.self(); +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 14, 8)) +>x.self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 14, 8)) +>self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) + } + bar(x: U) { +>bar : Symbol(bar, Decl(thisTypeAndConstraints.ts, 16, 5)) +>U : Symbol(U, Decl(thisTypeAndConstraints.ts, 17, 8)) +>T : Symbol(T, Decl(thisTypeAndConstraints.ts, 13, 8)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 17, 21)) +>U : Symbol(U, Decl(thisTypeAndConstraints.ts, 17, 8)) + + x = x.self(); +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 17, 21)) +>x.self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) +>x : Symbol(x, Decl(thisTypeAndConstraints.ts, 17, 21)) +>self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) + } +} + diff --git a/tests/baselines/reference/thisTypeAndConstraints.types b/tests/baselines/reference/thisTypeAndConstraints.types new file mode 100644 index 00000000000..af7a06e83cf --- /dev/null +++ b/tests/baselines/reference/thisTypeAndConstraints.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts === +class A { +>A : A + + self() { +>self : () => this + + return this; +>this : this + } +} + +function f(x: T) { +>f : (x: T) => void +>T : T +>A : A +>x : T +>T : T + + function g(x: U) { +>g : (x: U) => void +>U : U +>T : T +>x : U +>U : U + + x = x.self(); +>x = x.self() : U +>x : U +>x.self() : U +>x.self : () => U +>x : U +>self : () => U + } + x = x.self(); +>x = x.self() : T +>x : T +>x.self() : T +>x.self : () => T +>x : T +>self : () => T +} + +class B { +>B : B +>T : T +>A : A + + foo(x: T) { +>foo : (x: T) => void +>x : T +>T : T + + x = x.self(); +>x = x.self() : T +>x : T +>x.self() : T +>x.self : () => T +>x : T +>self : () => T + } + bar(x: U) { +>bar : (x: U) => void +>U : U +>T : T +>x : U +>U : U + + x = x.self(); +>x = x.self() : U +>x : U +>x.self() : U +>x.self : () => U +>x : U +>self : () => U + } +} + diff --git a/tests/baselines/reference/thisTypeInClasses.errors.txt b/tests/baselines/reference/thisTypeInClasses.errors.txt deleted file mode 100644 index db2ae1b5793..00000000000 --- a/tests/baselines/reference/thisTypeInClasses.errors.txt +++ /dev/null @@ -1,57 +0,0 @@ -tests/cases/conformance/types/thisType/thisTypeInClasses.ts(4,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface. - - -==== tests/cases/conformance/types/thisType/thisTypeInClasses.ts (1 errors) ==== - class C1 { - x: this; - f(x: this): this { return undefined; } - constructor(x: this) { } - ~~~~ -!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. - } - - class C2 { - [x: string]: this; - } - - interface Foo { - x: T; - y: this; - } - - class C3 { - a: this[]; - b: [this, this]; - c: this | Date; - d: this & Date; - e: (((this))); - f: (x: this) => this; - g: new (x: this) => this; - h: Foo; - i: Foo this)>; - j: (x: any) => x is this; - } - - declare class C4 { - x: this; - f(x: this): this; - } - - class C5 { - foo() { - let f1 = (x: this): this => this; - let f2 = (x: this) => this; - let f3 = (x: this) => (y: this) => this; - let f4 = (x: this) => { - let g = (y: this) => { - return () => this; - } - return g(this); - } - } - bar() { - let x1 = undefined; - let x2 = undefined as this; - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInClasses.js b/tests/baselines/reference/thisTypeInClasses.js index 93344fa62cb..52ad452aa56 100644 --- a/tests/baselines/reference/thisTypeInClasses.js +++ b/tests/baselines/reference/thisTypeInClasses.js @@ -2,7 +2,6 @@ class C1 { x: this; f(x: this): this { return undefined; } - constructor(x: this) { } } class C2 { @@ -53,7 +52,7 @@ class C5 { //// [thisTypeInClasses.js] var C1 = (function () { - function C1(x) { + function C1() { } C1.prototype.f = function (x) { return undefined; }; return C1; diff --git a/tests/baselines/reference/thisTypeInClasses.symbols b/tests/baselines/reference/thisTypeInClasses.symbols index 04ed47b09ff..0915d6e5e6b 100644 --- a/tests/baselines/reference/thisTypeInClasses.symbols +++ b/tests/baselines/reference/thisTypeInClasses.symbols @@ -9,131 +9,128 @@ class C1 { >f : Symbol(f, Decl(thisTypeInClasses.ts, 1, 12)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 2, 6)) >undefined : Symbol(undefined) - - constructor(x: this) { } ->x : Symbol(x, Decl(thisTypeInClasses.ts, 3, 16)) } class C2 { ->C2 : Symbol(C2, Decl(thisTypeInClasses.ts, 4, 1)) +>C2 : Symbol(C2, Decl(thisTypeInClasses.ts, 3, 1)) [x: string]: this; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 7, 5)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 6, 5)) } interface Foo { ->Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 8, 1)) ->T : Symbol(T, Decl(thisTypeInClasses.ts, 10, 14)) +>Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 7, 1)) +>T : Symbol(T, Decl(thisTypeInClasses.ts, 9, 14)) x: T; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 10, 18)) ->T : Symbol(T, Decl(thisTypeInClasses.ts, 10, 14)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 9, 18)) +>T : Symbol(T, Decl(thisTypeInClasses.ts, 9, 14)) y: this; ->y : Symbol(y, Decl(thisTypeInClasses.ts, 11, 9)) +>y : Symbol(y, Decl(thisTypeInClasses.ts, 10, 9)) } class C3 { ->C3 : Symbol(C3, Decl(thisTypeInClasses.ts, 13, 1)) +>C3 : Symbol(C3, Decl(thisTypeInClasses.ts, 12, 1)) a: this[]; ->a : Symbol(a, Decl(thisTypeInClasses.ts, 15, 10)) +>a : Symbol(a, Decl(thisTypeInClasses.ts, 14, 10)) b: [this, this]; ->b : Symbol(b, Decl(thisTypeInClasses.ts, 16, 14)) +>b : Symbol(b, Decl(thisTypeInClasses.ts, 15, 14)) c: this | Date; ->c : Symbol(c, Decl(thisTypeInClasses.ts, 17, 20)) +>c : Symbol(c, Decl(thisTypeInClasses.ts, 16, 20)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) d: this & Date; ->d : Symbol(d, Decl(thisTypeInClasses.ts, 18, 19)) +>d : Symbol(d, Decl(thisTypeInClasses.ts, 17, 19)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) e: (((this))); ->e : Symbol(e, Decl(thisTypeInClasses.ts, 19, 19)) +>e : Symbol(e, Decl(thisTypeInClasses.ts, 18, 19)) f: (x: this) => this; ->f : Symbol(f, Decl(thisTypeInClasses.ts, 20, 18)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 21, 8)) +>f : Symbol(f, Decl(thisTypeInClasses.ts, 19, 18)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 20, 8)) g: new (x: this) => this; ->g : Symbol(g, Decl(thisTypeInClasses.ts, 21, 25)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 22, 12)) +>g : Symbol(g, Decl(thisTypeInClasses.ts, 20, 25)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 21, 12)) h: Foo; ->h : Symbol(h, Decl(thisTypeInClasses.ts, 22, 29)) ->Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 8, 1)) +>h : Symbol(h, Decl(thisTypeInClasses.ts, 21, 29)) +>Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 7, 1)) i: Foo this)>; ->i : Symbol(i, Decl(thisTypeInClasses.ts, 23, 17)) ->Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 8, 1)) +>i : Symbol(i, Decl(thisTypeInClasses.ts, 22, 17)) +>Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 7, 1)) j: (x: any) => x is this; ->j : Symbol(j, Decl(thisTypeInClasses.ts, 24, 32)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 25, 8)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 25, 8)) +>j : Symbol(j, Decl(thisTypeInClasses.ts, 23, 32)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 24, 8)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 24, 8)) } declare class C4 { ->C4 : Symbol(C4, Decl(thisTypeInClasses.ts, 26, 1)) +>C4 : Symbol(C4, Decl(thisTypeInClasses.ts, 25, 1)) x: this; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 28, 18)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 27, 18)) f(x: this): this; ->f : Symbol(f, Decl(thisTypeInClasses.ts, 29, 12)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 30, 6)) +>f : Symbol(f, Decl(thisTypeInClasses.ts, 28, 12)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 29, 6)) } class C5 { ->C5 : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>C5 : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) foo() { ->foo : Symbol(foo, Decl(thisTypeInClasses.ts, 33, 10)) +>foo : Symbol(foo, Decl(thisTypeInClasses.ts, 32, 10)) let f1 = (x: this): this => this; ->f1 : Symbol(f1, Decl(thisTypeInClasses.ts, 35, 11)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 35, 18)) ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>f1 : Symbol(f1, Decl(thisTypeInClasses.ts, 34, 11)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 34, 18)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) let f2 = (x: this) => this; ->f2 : Symbol(f2, Decl(thisTypeInClasses.ts, 36, 11)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 36, 18)) ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>f2 : Symbol(f2, Decl(thisTypeInClasses.ts, 35, 11)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 35, 18)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) let f3 = (x: this) => (y: this) => this; ->f3 : Symbol(f3, Decl(thisTypeInClasses.ts, 37, 11)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 37, 18)) ->y : Symbol(y, Decl(thisTypeInClasses.ts, 37, 31)) ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>f3 : Symbol(f3, Decl(thisTypeInClasses.ts, 36, 11)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 36, 18)) +>y : Symbol(y, Decl(thisTypeInClasses.ts, 36, 31)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) let f4 = (x: this) => { ->f4 : Symbol(f4, Decl(thisTypeInClasses.ts, 38, 11)) ->x : Symbol(x, Decl(thisTypeInClasses.ts, 38, 18)) +>f4 : Symbol(f4, Decl(thisTypeInClasses.ts, 37, 11)) +>x : Symbol(x, Decl(thisTypeInClasses.ts, 37, 18)) let g = (y: this) => { ->g : Symbol(g, Decl(thisTypeInClasses.ts, 39, 15)) ->y : Symbol(y, Decl(thisTypeInClasses.ts, 39, 21)) +>g : Symbol(g, Decl(thisTypeInClasses.ts, 38, 15)) +>y : Symbol(y, Decl(thisTypeInClasses.ts, 38, 21)) return () => this; ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) } return g(this); ->g : Symbol(g, Decl(thisTypeInClasses.ts, 39, 15)) ->this : Symbol(C5, Decl(thisTypeInClasses.ts, 31, 1)) +>g : Symbol(g, Decl(thisTypeInClasses.ts, 38, 15)) +>this : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) } } bar() { ->bar : Symbol(bar, Decl(thisTypeInClasses.ts, 44, 5)) +>bar : Symbol(bar, Decl(thisTypeInClasses.ts, 43, 5)) let x1 = undefined; ->x1 : Symbol(x1, Decl(thisTypeInClasses.ts, 46, 11)) +>x1 : Symbol(x1, Decl(thisTypeInClasses.ts, 45, 11)) >undefined : Symbol(undefined) let x2 = undefined as this; ->x2 : Symbol(x2, Decl(thisTypeInClasses.ts, 47, 11)) +>x2 : Symbol(x2, Decl(thisTypeInClasses.ts, 46, 11)) >undefined : Symbol(undefined) } } diff --git a/tests/baselines/reference/thisTypeInClasses.types b/tests/baselines/reference/thisTypeInClasses.types index ddfdfb277a9..512359decd9 100644 --- a/tests/baselines/reference/thisTypeInClasses.types +++ b/tests/baselines/reference/thisTypeInClasses.types @@ -9,9 +9,6 @@ class C1 { >f : (x: this) => this >x : this >undefined : undefined - - constructor(x: this) { } ->x : this } class C2 { From 8dbfe1ca631111e28a59b62e1ddc941ea6fe2e3f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 6 Nov 2015 12:58:03 -0800 Subject: [PATCH 091/140] Added specific checks for comparing stringlike types. --- src/compiler/checker.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 50b826c1d14..3bbc27d71b0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9400,7 +9400,12 @@ namespace ts { let targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { let widenedType = getWidenedType(exprType); - if (!(isTypeAssignableTo(targetType, widenedType))) { + + // Permit 'number[] | "foo"' to be asserted to 'string'. + const bothAreStringLike = + someConstituentTypeHasKind(targetType, TypeFlags.StringLike) && + someConstituentTypeHasKind(widenedType, TypeFlags.StringLike); + if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } } @@ -10244,6 +10249,10 @@ namespace ts { case SyntaxKind.ExclamationEqualsToken: case SyntaxKind.EqualsEqualsEqualsToken: case SyntaxKind.ExclamationEqualsEqualsToken: + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (someConstituentTypeHasKind(leftType, TypeFlags.StringLike) && someConstituentTypeHasKind(rightType, TypeFlags.StringLike)) { + return booleanType; + } if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -12703,6 +12712,7 @@ namespace ts { let hasDuplicateDefaultClause = false; let expressionType = checkExpression(node.expression); + const expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, TypeFlags.StringLike); forEach(node.caseBlock.clauses, clause => { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === SyntaxKind.DefaultClause && !hasDuplicateDefaultClause) { @@ -12723,6 +12733,12 @@ namespace ts { // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. let caseType = checkExpression(caseClause.expression); + + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, TypeFlags.StringLike)) { + return; + } + if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); From a1fcfaf5744bdf33767cb9cc720e2cc636cfe213 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 6 Nov 2015 12:59:06 -0800 Subject: [PATCH 092/140] Accepted baselines. --- .../stringLiteralCheckedInIf01.errors.txt | 26 ----- .../stringLiteralCheckedInIf01.symbols | 36 ++++++ .../stringLiteralCheckedInIf01.types | 46 ++++++++ .../stringLiteralCheckedInIf02.errors.txt | 27 ----- .../stringLiteralCheckedInIf02.symbols | 42 +++++++ .../stringLiteralCheckedInIf02.types | 52 +++++++++ .../stringLiteralMatchedInSwitch01.errors.txt | 26 ----- .../stringLiteralMatchedInSwitch01.symbols | 28 +++++ .../stringLiteralMatchedInSwitch01.types | 37 ++++++ .../stringLiteralTypeAssertion01.errors.txt | 55 --------- .../stringLiteralTypeAssertion01.symbols | 83 ++++++++++++++ .../stringLiteralTypeAssertion01.types | 107 ++++++++++++++++++ ...tringLiteralTypesInUnionTypes03.errors.txt | 29 ----- .../stringLiteralTypesInUnionTypes03.symbols | 52 +++++++++ .../stringLiteralTypesInUnionTypes03.types | 61 ++++++++++ ...eralTypesWithVariousOperators02.errors.txt | 13 +-- 16 files changed, 546 insertions(+), 174 deletions(-) delete mode 100644 tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf01.symbols create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf01.types delete mode 100644 tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf02.symbols create mode 100644 tests/baselines/reference/stringLiteralCheckedInIf02.types delete mode 100644 tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralMatchedInSwitch01.symbols create mode 100644 tests/baselines/reference/stringLiteralMatchedInSwitch01.types delete mode 100644 tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypeAssertion01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypeAssertion01.types delete mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesInUnionTypes03.types diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt b/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt deleted file mode 100644 index fb94cf6bc96..00000000000 --- a/tests/baselines/reference/stringLiteralCheckedInIf01.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts(6,9): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. -tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts(9,14): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts (2 errors) ==== - - type S = "a" | "b"; - type T = S[] | S; - - function f(foo: T) { - if (foo === "a") { - ~~~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - return foo; - } - else if (foo === "b") { - ~~~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - return foo; - } - else { - return (foo as S[])[0]; - } - - throw new Error("Unreachable code hit."); - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.symbols b/tests/baselines/reference/stringLiteralCheckedInIf01.symbols new file mode 100644 index 00000000000..bd382a66ffa --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.symbols @@ -0,0 +1,36 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts === + +type S = "a" | "b"; +>S : Symbol(S, Decl(stringLiteralCheckedInIf01.ts, 0, 0)) + +type T = S[] | S; +>T : Symbol(T, Decl(stringLiteralCheckedInIf01.ts, 1, 19)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf01.ts, 0, 0)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf01.ts, 0, 0)) + +function f(foo: T) { +>f : Symbol(f, Decl(stringLiteralCheckedInIf01.ts, 2, 17)) +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) +>T : Symbol(T, Decl(stringLiteralCheckedInIf01.ts, 1, 19)) + + if (foo === "a") { +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) + + return foo; +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) + } + else if (foo === "b") { +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) + + return foo; +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) + } + else { + return (foo as S[])[0]; +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf01.ts, 0, 0)) + } + + throw new Error("Unreachable code hit."); +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.types b/tests/baselines/reference/stringLiteralCheckedInIf01.types new file mode 100644 index 00000000000..1b3e663be74 --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts === + +type S = "a" | "b"; +>S : "a" | "b" + +type T = S[] | S; +>T : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>S : "a" | "b" + +function f(foo: T) { +>f : (foo: ("a" | "b")[] | "a" | "b") => ("a" | "b")[] | "a" | "b" +>foo : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" + + if (foo === "a") { +>foo === "a" : boolean +>foo : ("a" | "b")[] | "a" | "b" +>"a" : string + + return foo; +>foo : ("a" | "b")[] | "a" | "b" + } + else if (foo === "b") { +>foo === "b" : boolean +>foo : ("a" | "b")[] | "a" | "b" +>"b" : string + + return foo; +>foo : ("a" | "b")[] | "a" | "b" + } + else { + return (foo as S[])[0]; +>(foo as S[])[0] : "a" | "b" +>(foo as S[]) : ("a" | "b")[] +>foo as S[] : ("a" | "b")[] +>foo : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>0 : number + } + + throw new Error("Unreachable code hit."); +>new Error("Unreachable code hit.") : Error +>Error : ErrorConstructor +>"Unreachable code hit." : string +} diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt b/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt deleted file mode 100644 index ced5adf6263..00000000000 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts(6,12): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. -tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts(6,25): error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts (2 errors) ==== - - type S = "a" | "b"; - type T = S[] | S; - - function isS(t: T): t is S { - return t === "a" || t === "b"; - ~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - ~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '("a" | "b")[] | "a" | "b"' and 'string'. - } - - function f(foo: T) { - if (isS(foo)) { - return foo; - } - else { - return foo[0]; - } - - throw new Error("Unreachable code hit."); - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.symbols b/tests/baselines/reference/stringLiteralCheckedInIf02.symbols new file mode 100644 index 00000000000..84a19936371 --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.symbols @@ -0,0 +1,42 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts === + +type S = "a" | "b"; +>S : Symbol(S, Decl(stringLiteralCheckedInIf02.ts, 0, 0)) + +type T = S[] | S; +>T : Symbol(T, Decl(stringLiteralCheckedInIf02.ts, 1, 19)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf02.ts, 0, 0)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf02.ts, 0, 0)) + +function isS(t: T): t is S { +>isS : Symbol(isS, Decl(stringLiteralCheckedInIf02.ts, 2, 17)) +>t : Symbol(t, Decl(stringLiteralCheckedInIf02.ts, 4, 13)) +>T : Symbol(T, Decl(stringLiteralCheckedInIf02.ts, 1, 19)) +>t : Symbol(t, Decl(stringLiteralCheckedInIf02.ts, 4, 13)) +>S : Symbol(S, Decl(stringLiteralCheckedInIf02.ts, 0, 0)) + + return t === "a" || t === "b"; +>t : Symbol(t, Decl(stringLiteralCheckedInIf02.ts, 4, 13)) +>t : Symbol(t, Decl(stringLiteralCheckedInIf02.ts, 4, 13)) +} + +function f(foo: T) { +>f : Symbol(f, Decl(stringLiteralCheckedInIf02.ts, 6, 1)) +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf02.ts, 8, 11)) +>T : Symbol(T, Decl(stringLiteralCheckedInIf02.ts, 1, 19)) + + if (isS(foo)) { +>isS : Symbol(isS, Decl(stringLiteralCheckedInIf02.ts, 2, 17)) +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf02.ts, 8, 11)) + + return foo; +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf02.ts, 8, 11)) + } + else { + return foo[0]; +>foo : Symbol(foo, Decl(stringLiteralCheckedInIf02.ts, 8, 11)) + } + + throw new Error("Unreachable code hit."); +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.types b/tests/baselines/reference/stringLiteralCheckedInIf02.types new file mode 100644 index 00000000000..005ec356f39 --- /dev/null +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts === + +type S = "a" | "b"; +>S : "a" | "b" + +type T = S[] | S; +>T : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>S : "a" | "b" + +function isS(t: T): t is S { +>isS : (t: ("a" | "b")[] | "a" | "b") => t is "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" +>t : any +>S : "a" | "b" + + return t === "a" || t === "b"; +>t === "a" || t === "b" : boolean +>t === "a" : boolean +>t : ("a" | "b")[] | "a" | "b" +>"a" : string +>t === "b" : boolean +>t : ("a" | "b")[] | "a" | "b" +>"b" : string +} + +function f(foo: T) { +>f : (foo: ("a" | "b")[] | "a" | "b") => "a" | "b" +>foo : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" + + if (isS(foo)) { +>isS(foo) : boolean +>isS : (t: ("a" | "b")[] | "a" | "b") => t is "a" | "b" +>foo : ("a" | "b")[] | "a" | "b" + + return foo; +>foo : "a" | "b" + } + else { + return foo[0]; +>foo[0] : "a" | "b" +>foo : ("a" | "b")[] +>0 : number + } + + throw new Error("Unreachable code hit."); +>new Error("Unreachable code hit.") : Error +>Error : ErrorConstructor +>"Unreachable code hit." : string +} diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt b/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt deleted file mode 100644 index 17e690715a1..00000000000 --- a/tests/baselines/reference/stringLiteralMatchedInSwitch01.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts(7,10): error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. - Type 'string' is not assignable to type '"b"'. -tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts(8,10): error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. - Type 'string' is not assignable to type '"b"'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts (2 errors) ==== - - type S = "a" | "b"; - type T = S[] | S; - - var foo: T; - switch (foo) { - case "a": - ~~~ -!!! error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. -!!! error TS2322: Type 'string' is not assignable to type '"b"'. - case "b": - ~~~ -!!! error TS2322: Type 'string' is not assignable to type '("a" | "b")[] | "a" | "b"'. -!!! error TS2322: Type 'string' is not assignable to type '"b"'. - break; - default: - foo = (foo as S[])[0]; - break; - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.symbols b/tests/baselines/reference/stringLiteralMatchedInSwitch01.symbols new file mode 100644 index 00000000000..0323371c307 --- /dev/null +++ b/tests/baselines/reference/stringLiteralMatchedInSwitch01.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts === + +type S = "a" | "b"; +>S : Symbol(S, Decl(stringLiteralMatchedInSwitch01.ts, 0, 0)) + +type T = S[] | S; +>T : Symbol(T, Decl(stringLiteralMatchedInSwitch01.ts, 1, 19)) +>S : Symbol(S, Decl(stringLiteralMatchedInSwitch01.ts, 0, 0)) +>S : Symbol(S, Decl(stringLiteralMatchedInSwitch01.ts, 0, 0)) + +var foo: T; +>foo : Symbol(foo, Decl(stringLiteralMatchedInSwitch01.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralMatchedInSwitch01.ts, 1, 19)) + +switch (foo) { +>foo : Symbol(foo, Decl(stringLiteralMatchedInSwitch01.ts, 4, 3)) + + case "a": + case "b": + break; + default: + foo = (foo as S[])[0]; +>foo : Symbol(foo, Decl(stringLiteralMatchedInSwitch01.ts, 4, 3)) +>foo : Symbol(foo, Decl(stringLiteralMatchedInSwitch01.ts, 4, 3)) +>S : Symbol(S, Decl(stringLiteralMatchedInSwitch01.ts, 0, 0)) + + break; +} diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.types b/tests/baselines/reference/stringLiteralMatchedInSwitch01.types new file mode 100644 index 00000000000..cfbb77e07e0 --- /dev/null +++ b/tests/baselines/reference/stringLiteralMatchedInSwitch01.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralMatchedInSwitch01.ts === + +type S = "a" | "b"; +>S : "a" | "b" + +type T = S[] | S; +>T : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>S : "a" | "b" + +var foo: T; +>foo : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" + +switch (foo) { +>foo : ("a" | "b")[] | "a" | "b" + + case "a": +>"a" : string + + case "b": +>"b" : string + + break; + default: + foo = (foo as S[])[0]; +>foo = (foo as S[])[0] : "a" | "b" +>foo : ("a" | "b")[] | "a" | "b" +>(foo as S[])[0] : "a" | "b" +>(foo as S[]) : ("a" | "b")[] +>foo as S[] : ("a" | "b")[] +>foo : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>0 : number + + break; +} diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt b/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt deleted file mode 100644 index 867ad80ee7f..00000000000 --- a/tests/baselines/reference/stringLiteralTypeAssertion01.errors.txt +++ /dev/null @@ -1,55 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(22,5): error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. - Type 'string' is not assignable to type '"b"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(23,5): error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. - Type 'string' is not assignable to type '"b"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(30,7): error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. - Type '("a" | "b")[]' is not assignable to type 'string'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts(31,7): error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. - Type '("a" | "b")[]' is not assignable to type 'string'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts (4 errors) ==== - - type S = "a" | "b"; - type T = S[] | S; - - var s: S; - var t: T; - var str: string; - - //////////////// - - s = t; - s = t as S; - - s = str; - s = str as S; - - //////////////// - - t = s; - t = s as T; - - t = str; - ~~~~~~ -!!! error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type '"b"'. - t = str as T; - ~~~~~~~~ -!!! error TS2352: Neither type 'string' nor type '("a" | "b")[] | "a" | "b"' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type '"b"'. - - //////////////// - - str = s; - str = s as string; - - str = t; - ~~~~~~~~~ -!!! error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. -!!! error TS2352: Type '("a" | "b")[]' is not assignable to type 'string'. - str = t as string; - ~~~~~~~~~~~ -!!! error TS2352: Neither type '("a" | "b")[] | "a" | "b"' nor type 'string' is assignable to the other. -!!! error TS2352: Type '("a" | "b")[]' is not assignable to type 'string'. - \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.symbols b/tests/baselines/reference/stringLiteralTypeAssertion01.symbols new file mode 100644 index 00000000000..1491a32b6f8 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeAssertion01.symbols @@ -0,0 +1,83 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts === + +type S = "a" | "b"; +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) + +type T = S[] | S; +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) + +var s: S; +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) + +var t: T; +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) + +var str: string; +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) + +//////////////// + +s = t; +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) + +s = t as S; +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) + +s = str; +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) + +s = str as S; +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>S : Symbol(S, Decl(stringLiteralTypeAssertion01.ts, 0, 0)) + +//////////////// + +t = s; +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) + +t = s as T; +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) + +t = str; +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) + +t = str as T; +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>T : Symbol(T, Decl(stringLiteralTypeAssertion01.ts, 1, 19)) + +//////////////// + +str = s; +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) + +str = s as string; +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>s : Symbol(s, Decl(stringLiteralTypeAssertion01.ts, 4, 3)) + +str = t; +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) + +str = t as string; +>str : Symbol(str, Decl(stringLiteralTypeAssertion01.ts, 6, 3)) +>t : Symbol(t, Decl(stringLiteralTypeAssertion01.ts, 5, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.types b/tests/baselines/reference/stringLiteralTypeAssertion01.types new file mode 100644 index 00000000000..f70313f8347 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeAssertion01.types @@ -0,0 +1,107 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts === + +type S = "a" | "b"; +>S : "a" | "b" + +type T = S[] | S; +>T : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" +>S : "a" | "b" + +var s: S; +>s : "a" | "b" +>S : "a" | "b" + +var t: T; +>t : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" + +var str: string; +>str : string + +//////////////// + +s = t; +>s = t : "a" | "b" +>s : "a" | "b" +>t : "a" | "b" +>S : "a" | "b" +>t : ("a" | "b")[] | "a" | "b" + +s = t as S; +>s = t as S : "a" | "b" +>s : "a" | "b" +>t as S : "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>S : "a" | "b" + +s = str; +>s = str : "a" | "b" +>s : "a" | "b" +>str : "a" | "b" +>S : "a" | "b" +>str : string + +s = str as S; +>s = str as S : "a" | "b" +>s : "a" | "b" +>str as S : "a" | "b" +>str : string +>S : "a" | "b" + +//////////////// + +t = s; +>t = s : ("a" | "b")[] | "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>s : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" +>s : "a" | "b" + +t = s as T; +>t = s as T : ("a" | "b")[] | "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>s as T : ("a" | "b")[] | "a" | "b" +>s : "a" | "b" +>T : ("a" | "b")[] | "a" | "b" + +t = str; +>t = str : ("a" | "b")[] | "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>str : ("a" | "b")[] | "a" | "b" +>T : ("a" | "b")[] | "a" | "b" +>str : string + +t = str as T; +>t = str as T : ("a" | "b")[] | "a" | "b" +>t : ("a" | "b")[] | "a" | "b" +>str as T : ("a" | "b")[] | "a" | "b" +>str : string +>T : ("a" | "b")[] | "a" | "b" + +//////////////// + +str = s; +>str = s : string +>str : string +>s : string +>s : "a" | "b" + +str = s as string; +>str = s as string : string +>str : string +>s as string : string +>s : "a" | "b" + +str = t; +>str = t : string +>str : string +>t : string +>t : ("a" | "b")[] | "a" | "b" + +str = t as string; +>str = t as string : string +>str : string +>t as string : string +>t : ("a" | "b")[] | "a" | "b" + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt deleted file mode 100644 index 74249b178d6..00000000000 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(7,5): error TS2365: Operator '===' cannot be applied to types '"foo" | "bar" | number' and 'string'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(10,10): error TS2365: Operator '!==' cannot be applied to types '"foo" | "bar" | number' and 'string'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (2 errors) ==== - - type T = number | "foo" | "bar"; - - var x: "foo" | "bar" | number; - var y: T = "bar"; - - if (x === "foo") { - ~~~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '"foo" | "bar" | number' and 'string'. - let a = x; - } - else if (x !== "bar") { - ~~~~~~~~~~~ -!!! error TS2365: Operator '!==' cannot be applied to types '"foo" | "bar" | number' and 'string'. - let b = x || y; - } - else { - let c = x; - let d = y; - let e: (typeof x) | (typeof y) = c || d; - } - - x = y; - y = x; \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols new file mode 100644 index 00000000000..df5498d9a59 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts === + +type T = number | "foo" | "bar"; +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes03.ts, 0, 0)) + +var x: "foo" | "bar" | number; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) + +var y: T = "bar"; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) +>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes03.ts, 0, 0)) + +if (x === "foo") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesInUnionTypes03.ts, 7, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) +} +else if (x !== "bar") { +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) + + let b = x || y; +>b : Symbol(b, Decl(stringLiteralTypesInUnionTypes03.ts, 10, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) +} +else { + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes03.ts, 13, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) + + let d = y; +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes03.ts, 14, 7)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) + + let e: (typeof x) | (typeof y) = c || d; +>e : Symbol(e, Decl(stringLiteralTypesInUnionTypes03.ts, 15, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) +>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes03.ts, 13, 7)) +>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes03.ts, 14, 7)) +} + +x = y; +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) + +y = x; +>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) +>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types new file mode 100644 index 00000000000..5fca6e69be9 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts === + +type T = number | "foo" | "bar"; +>T : number | "foo" | "bar" + +var x: "foo" | "bar" | number; +>x : "foo" | "bar" | number + +var y: T = "bar"; +>y : number | "foo" | "bar" +>T : number | "foo" | "bar" +>"bar" : "bar" + +if (x === "foo") { +>x === "foo" : boolean +>x : "foo" | "bar" | number +>"foo" : string + + let a = x; +>a : "foo" | "bar" | number +>x : "foo" | "bar" | number +} +else if (x !== "bar") { +>x !== "bar" : boolean +>x : "foo" | "bar" | number +>"bar" : string + + let b = x || y; +>b : "foo" | "bar" | number +>x || y : "foo" | "bar" | number +>x : "foo" | "bar" | number +>y : number | "foo" | "bar" +} +else { + let c = x; +>c : "foo" | "bar" | number +>x : "foo" | "bar" | number + + let d = y; +>d : number | "foo" | "bar" +>y : number | "foo" | "bar" + + let e: (typeof x) | (typeof y) = c || d; +>e : "foo" | "bar" | number +>x : "foo" | "bar" | number +>y : number | "foo" | "bar" +>c || d : "foo" | "bar" | number +>c : "foo" | "bar" | number +>d : number | "foo" | "bar" +} + +x = y; +>x = y : number | "foo" | "bar" +>x : "foo" | "bar" | number +>y : number | "foo" | "bar" + +y = x; +>y = x : "foo" | "bar" | number +>y : number | "foo" | "bar" +>x : "foo" | "bar" | number + diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt index 92afe67df0c..69dd6c2f6a9 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt @@ -7,12 +7,9 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (9 errors) ==== let abc: "ABC" = "ABC"; let xyz: "XYZ" = "XYZ"; @@ -47,11 +44,5 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato ~~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. let j = abc < xyz; - ~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. let k = abc === xyz; - ~~~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. - let l = abc != xyz; - ~~~~~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. \ No newline at end of file + let l = abc != xyz; \ No newline at end of file From 7a940314753e96aefb1f00fe61440d06296f3899 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 6 Nov 2015 14:11:15 -0800 Subject: [PATCH 093/140] Rename `isTsx` for clarity --- src/compiler/parser.ts | 4 ++-- src/compiler/utilities.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b477724475f..f81d4d5f86b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -554,7 +554,7 @@ namespace ts { scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(isTsx(fileName) ? LanguageVariant.JSX : LanguageVariant.Standard); + scanner.setLanguageVariant(allowsJsxExpressions(fileName) ? LanguageVariant.JSX : LanguageVariant.Standard); } function clearState() { @@ -671,7 +671,7 @@ namespace ts { sourceFile.languageVersion = languageVersion; sourceFile.fileName = normalizePath(fileName); sourceFile.flags = fileExtensionIs(sourceFile.fileName, ".d.ts") ? NodeFlags.DeclarationFile : 0; - sourceFile.languageVariant = isTsx(sourceFile.fileName) ? LanguageVariant.JSX : LanguageVariant.Standard; + sourceFile.languageVariant = allowsJsxExpressions(sourceFile.fileName) ? LanguageVariant.JSX : LanguageVariant.Standard; return sourceFile; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5506a1d5e3d..67f16cbfd0f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2142,7 +2142,7 @@ namespace ts { return fileExtensionIs(fileName, ".js") || fileExtensionIs(fileName, ".jsx"); } - export function isTsx(fileName: string) { + export function allowsJsxExpressions(fileName: string) { return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx"); } From c0bb2eaaea0a34a276b944ace65b868a2ad216a8 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 6 Nov 2015 14:16:44 -0800 Subject: [PATCH 094/140] Add getCurrentDirectory to call to createDocumentRegistry --- src/services/shims.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 8482cb50975..fca72e49d36 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1032,7 +1032,7 @@ namespace ts { public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim { try { if (this.documentRegistry === undefined) { - this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var hostAdapter = new LanguageServiceShimHostAdapter(host); var languageService = createLanguageService(hostAdapter, this.documentRegistry); @@ -1068,7 +1068,7 @@ namespace ts { public close(): void { // Forget all the registered shims this._shims = []; - this.documentRegistry = createDocumentRegistry(); + this.documentRegistry = undefined; } public registerShim(shim: Shim): void { From f939ff23ce66ce8c461a2d5da400eb3c09fd384c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 6 Nov 2015 14:25:25 -0800 Subject: [PATCH 095/140] Fixed unreachable code in tests. --- .../types/stringLiteral/stringLiteralCheckedInIf01.ts | 2 -- .../types/stringLiteral/stringLiteralCheckedInIf02.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts index 093824acf0d..f13ce35e829 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf01.ts @@ -12,6 +12,4 @@ function f(foo: T) { else { return (foo as S[])[0]; } - - throw new Error("Unreachable code hit."); } \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts index 53d625f7200..4eaf18ca7cc 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralCheckedInIf02.ts @@ -13,6 +13,4 @@ function f(foo: T) { else { return foo[0]; } - - throw new Error("Unreachable code hit."); } \ No newline at end of file From d234b8df2ee3b26843d29e31e512c567ebf09e22 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 6 Nov 2015 14:28:54 -0800 Subject: [PATCH 096/140] Accepted baselines. --- tests/baselines/reference/stringLiteralCheckedInIf01.js | 3 --- tests/baselines/reference/stringLiteralCheckedInIf01.symbols | 3 --- tests/baselines/reference/stringLiteralCheckedInIf01.types | 5 ----- tests/baselines/reference/stringLiteralCheckedInIf02.js | 3 --- tests/baselines/reference/stringLiteralCheckedInIf02.symbols | 3 --- tests/baselines/reference/stringLiteralCheckedInIf02.types | 5 ----- 6 files changed, 22 deletions(-) diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.js b/tests/baselines/reference/stringLiteralCheckedInIf01.js index 227a243133c..161c39b96ef 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf01.js +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.js @@ -13,8 +13,6 @@ function f(foo: T) { else { return (foo as S[])[0]; } - - throw new Error("Unreachable code hit."); } //// [stringLiteralCheckedInIf01.js] @@ -28,5 +26,4 @@ function f(foo) { else { return foo[0]; } - throw new Error("Unreachable code hit."); } diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.symbols b/tests/baselines/reference/stringLiteralCheckedInIf01.symbols index bd382a66ffa..1b4d5e6b071 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf01.symbols +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.symbols @@ -30,7 +30,4 @@ function f(foo: T) { >foo : Symbol(foo, Decl(stringLiteralCheckedInIf01.ts, 4, 11)) >S : Symbol(S, Decl(stringLiteralCheckedInIf01.ts, 0, 0)) } - - throw new Error("Unreachable code hit."); ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.types b/tests/baselines/reference/stringLiteralCheckedInIf01.types index 1b3e663be74..75b7eadbc19 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf01.types +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.types @@ -38,9 +38,4 @@ function f(foo: T) { >S : "a" | "b" >0 : number } - - throw new Error("Unreachable code hit."); ->new Error("Unreachable code hit.") : Error ->Error : ErrorConstructor ->"Unreachable code hit." : string } diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.js b/tests/baselines/reference/stringLiteralCheckedInIf02.js index b0b3a64116b..22bd6359f61 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.js +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.js @@ -14,8 +14,6 @@ function f(foo: T) { else { return foo[0]; } - - throw new Error("Unreachable code hit."); } //// [stringLiteralCheckedInIf02.js] @@ -29,5 +27,4 @@ function f(foo) { else { return foo[0]; } - throw new Error("Unreachable code hit."); } diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.symbols b/tests/baselines/reference/stringLiteralCheckedInIf02.symbols index 84a19936371..629f990b912 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.symbols +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.symbols @@ -36,7 +36,4 @@ function f(foo: T) { return foo[0]; >foo : Symbol(foo, Decl(stringLiteralCheckedInIf02.ts, 8, 11)) } - - throw new Error("Unreachable code hit."); ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.types b/tests/baselines/reference/stringLiteralCheckedInIf02.types index 005ec356f39..79f4c6a223a 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.types +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.types @@ -44,9 +44,4 @@ function f(foo: T) { >foo : ("a" | "b")[] >0 : number } - - throw new Error("Unreachable code hit."); ->new Error("Unreachable code hit.") : Error ->Error : ErrorConstructor ->"Unreachable code hit." : string } From d880d4f4fb7c16bc5c6cb8fa38ace4371aa90850 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 6 Nov 2015 14:38:29 -0800 Subject: [PATCH 097/140] Don't look for .js files when resolving node modules --- src/compiler/program.ts | 2 +- tests/cases/unittests/moduleResolution.ts | 26 +---------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 583db7850b9..62fb6850274 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -70,7 +70,7 @@ namespace ts { } function loadNodeModuleFromFile(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { - return forEach(supportedJsExtensions, tryLoad); + return forEach(supportedExtensions, tryLoad); function tryLoad(ext: string): string { let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext; diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 7e363d80d6d..2a5742a06dd 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -82,7 +82,7 @@ module ts { assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); // expect three failed lookup location - attempt to load module as file with all supported extensions - assert.equal(resolution.failedLookupLocations.length, 5); + assert.equal(resolution.failedLookupLocations.length, 3); } it("module name as directory - load from typings", () => { @@ -103,8 +103,6 @@ module ts { "/a/b/foo.ts", "/a/b/foo.tsx", "/a/b/foo.d.ts", - "/a/b/foo.js", - "/a/b/foo.jsx", "/a/b/foo/index.ts", "/a/b/foo/index.tsx", ]); @@ -121,25 +119,17 @@ module ts { "/a/b/c/d/node_modules/foo.ts", "/a/b/c/d/node_modules/foo.tsx", "/a/b/c/d/node_modules/foo.d.ts", - "/a/b/c/d/node_modules/foo.js", - "/a/b/c/d/node_modules/foo.jsx", "/a/b/c/d/node_modules/foo/package.json", "/a/b/c/d/node_modules/foo/index.ts", "/a/b/c/d/node_modules/foo/index.tsx", "/a/b/c/d/node_modules/foo/index.d.ts", - "/a/b/c/d/node_modules/foo/index.js", - "/a/b/c/d/node_modules/foo/index.jsx", "/a/b/c/node_modules/foo.ts", "/a/b/c/node_modules/foo.tsx", "/a/b/c/node_modules/foo.d.ts", - "/a/b/c/node_modules/foo.js", - "/a/b/c/node_modules/foo.jsx", "/a/b/c/node_modules/foo/package.json", "/a/b/c/node_modules/foo/index.ts", "/a/b/c/node_modules/foo/index.tsx", "/a/b/c/node_modules/foo/index.d.ts", - "/a/b/c/node_modules/foo/index.js", - "/a/b/c/node_modules/foo/index.jsx" ]) }); @@ -161,41 +151,27 @@ module ts { "/a/node_modules/b/c/node_modules/d/node_modules/foo.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/foo.js", - "/a/node_modules/b/c/node_modules/d/node_modules/foo.jsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.js", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.jsx", "/a/node_modules/b/c/node_modules/foo.ts", "/a/node_modules/b/c/node_modules/foo.tsx", "/a/node_modules/b/c/node_modules/foo.d.ts", - "/a/node_modules/b/c/node_modules/foo.js", - "/a/node_modules/b/c/node_modules/foo.jsx", "/a/node_modules/b/c/node_modules/foo/package.json", "/a/node_modules/b/c/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/foo/index.d.ts", - "/a/node_modules/b/c/node_modules/foo/index.js", - "/a/node_modules/b/c/node_modules/foo/index.jsx", "/a/node_modules/b/node_modules/foo.ts", "/a/node_modules/b/node_modules/foo.tsx", "/a/node_modules/b/node_modules/foo.d.ts", - "/a/node_modules/b/node_modules/foo.js", - "/a/node_modules/b/node_modules/foo.jsx", "/a/node_modules/b/node_modules/foo/package.json", "/a/node_modules/b/node_modules/foo/index.ts", "/a/node_modules/b/node_modules/foo/index.tsx", "/a/node_modules/b/node_modules/foo/index.d.ts", - "/a/node_modules/b/node_modules/foo/index.js", - "/a/node_modules/b/node_modules/foo/index.jsx", "/a/node_modules/foo.ts", "/a/node_modules/foo.tsx", "/a/node_modules/foo.d.ts", - "/a/node_modules/foo.js", - "/a/node_modules/foo.jsx", "/a/node_modules/foo/package.json", "/a/node_modules/foo/index.ts", "/a/node_modules/foo/index.tsx" From c011ed455bd06551c170ee781189f1c02c4a7c1a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 6 Nov 2015 15:00:35 -0800 Subject: [PATCH 098/140] Const. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 44dcc423e8f..e0e9a6e620f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10403,7 +10403,7 @@ namespace ts { function checkStringLiteralExpression(node: StringLiteral): Type { // TODO (drosen): Do we want to apply the same approach to no-sub template literals? - let contextualType = getContextualType(node); + const contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { return getStringLiteralType(node); } From 45746d11a61a0fd8ec405f85a38d2a2045f3e567 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 6 Nov 2015 16:21:43 -0800 Subject: [PATCH 099/140] make emitter singleton, replace reading file properties with local access, use one constructor function for all nodes --- src/compiler/core.ts | 19 ++- src/compiler/declarationEmitter.ts | 93 +++++++------- src/compiler/emitter.ts | 194 ++++++++++++++++++----------- src/compiler/parser.ts | 10 +- src/compiler/scanner.ts | 12 +- src/compiler/utilities.ts | 163 ++++++++++++++---------- 6 files changed, 285 insertions(+), 206 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 5c882fb5304..8ed8edf927a 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -804,17 +804,16 @@ namespace ts { function Signature(checker: TypeChecker) { } + function Node(pos: number, end: number, kind: SyntaxKind) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = NodeFlags.None; + this.parent = undefined; + } + export let objectAllocator: ObjectAllocator = { - getNodeConstructor: kind => { - function Node(pos: number, end: number) { - this.pos = pos; - this.end = end; - this.flags = NodeFlags.None; - this.parent = undefined; - } - Node.prototype = { kind }; - return Node; - }, + getNodeConstructor: _ => Node, getSymbolConstructor: () => Symbol, getTypeConstructor: () => Type, getSignatureConstructor: () => Signature diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index ac91a39a78b..081f3fd7d00 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -45,12 +45,15 @@ namespace ts { let writeLine: () => void; let increaseIndent: () => void; let decreaseIndent: () => void; - let writeTextOfNode: (sourceFile: SourceFile, node: Node) => void; + let writeTextOfNode: (text: string, node: Node) => void; let writer = createAndSetNewTextWriterWithSymbolWriter(); let enclosingDeclaration: Node; - let currentSourceFile: SourceFile; + let currentText: string; + let currentLineMap: number[]; + let currentIdentifiers: Map; + let isCurrentFileExternalModule: boolean; let reportedDeclarationError = false; let errorNameNode: DeclarationName; const emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; @@ -134,14 +137,13 @@ namespace ts { }; function hasInternalAnnotation(range: CommentRange) { - const text = currentSourceFile.text; - const comment = text.substring(range.pos, range.end); + const comment = currentText.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node: Node) { if (node) { - const leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); + const leadingCommentRanges = getLeadingCommentRanges(currentText, node.pos); if (forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -243,7 +245,7 @@ namespace ts { if (errorInfo.typeName) { diagnostics.push(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, - getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), + getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } @@ -321,10 +323,10 @@ namespace ts { function writeJsDocComments(declaration: Node) { if (declaration) { - const jsDocComments = getJsDocComments(declaration, currentSourceFile); - emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + const jsDocComments = getJsDocCommentsFromText(declaration, currentText); + emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, writeCommentRange); + emitComments(currentText, currentLineMap, writer, jsDocComments, /*trailingSeparator*/ true, newLine, writeCommentRange); } } @@ -343,7 +345,7 @@ namespace ts { case SyntaxKind.VoidKeyword: case SyntaxKind.ThisKeyword: case SyntaxKind.StringLiteral: - return writeTextOfNode(currentSourceFile, type); + return writeTextOfNode(currentText, type); case SyntaxKind.ExpressionWithTypeArguments: return emitExpressionWithTypeArguments(type); case SyntaxKind.TypeReference: @@ -375,14 +377,14 @@ namespace ts { function writeEntityName(entityName: EntityName | Expression) { if (entityName.kind === SyntaxKind.Identifier) { - writeTextOfNode(currentSourceFile, entityName); + writeTextOfNode(currentText, entityName); } else { const left = entityName.kind === SyntaxKind.QualifiedName ? (entityName).left : (entityName).expression; const right = entityName.kind === SyntaxKind.QualifiedName ? (entityName).right : (entityName).name; writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, right); + writeTextOfNode(currentText, right); } } @@ -417,7 +419,7 @@ namespace ts { } function emitTypePredicate(type: TypePredicateNode) { - writeTextOfNode(currentSourceFile, type.parameterName); + writeTextOfNode(currentText, type.parameterName); write(" is "); emitType(type.type); } @@ -466,9 +468,12 @@ namespace ts { } function emitSourceFile(node: SourceFile) { - currentSourceFile = node; + currentText = node.text; + currentLineMap = getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = isExternalModule(node); enclosingDeclaration = node; - emitDetachedComments(currentSourceFile, writer, writeCommentRange, node, newLine, true /* remove comments */); + emitDetachedComments(currentText, currentLineMap, writer, writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } @@ -478,13 +483,13 @@ namespace ts { // do not need to keep track of created temp names. function getExportDefaultTempVariableName(): string { const baseName = "_default"; - if (!hasProperty(currentSourceFile.identifiers, baseName)) { + if (!hasProperty(currentIdentifiers, baseName)) { return baseName; } let count = 0; while (true) { const name = baseName + "_" + (++count); - if (!hasProperty(currentSourceFile.identifiers, name)) { + if (!hasProperty(currentIdentifiers, name)) { return name; } } @@ -493,7 +498,7 @@ namespace ts { function emitExportAssignment(node: ExportAssignment) { if (node.expression.kind === SyntaxKind.Identifier) { write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentSourceFile, node.expression); + writeTextOfNode(currentText, node.expression); } else { // Expression @@ -537,7 +542,7 @@ namespace ts { } // Import equals declaration in internal module can become visible as part of any emit so lets make sure we add these irrespective else if (node.kind === SyntaxKind.ImportEqualsDeclaration || - (node.parent.kind === SyntaxKind.SourceFile && isExternalModule(currentSourceFile))) { + (node.parent.kind === SyntaxKind.SourceFile && isCurrentFileExternalModule)) { let isVisible: boolean; if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== SyntaxKind.SourceFile) { // Import declaration of another module that is visited async so lets put it in right spot @@ -593,7 +598,7 @@ namespace ts { function emitModuleElementDeclarationFlags(node: Node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent === currentSourceFile) { + if (node.parent.kind === SyntaxKind.SourceFile) { // If the node is exported if (node.flags & NodeFlags.Export) { write("export "); @@ -632,7 +637,7 @@ namespace ts { write("export "); } write("import "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" = "); if (isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); @@ -640,7 +645,7 @@ namespace ts { } else { write("require("); - writeTextOfNode(currentSourceFile, getExternalModuleImportEqualsDeclarationExpression(node)); + writeTextOfNode(currentText, getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -678,7 +683,7 @@ namespace ts { if (node.importClause) { const currentWriterPos = writer.getTextPos(); if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentSourceFile, node.importClause.name); + writeTextOfNode(currentText, node.importClause.name); } if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { if (currentWriterPos !== writer.getTextPos()) { @@ -687,7 +692,7 @@ namespace ts { } if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { write("* as "); - writeTextOfNode(currentSourceFile, (node.importClause.namedBindings).name); + writeTextOfNode(currentText, (node.importClause.namedBindings).name); } else { write("{ "); @@ -697,17 +702,17 @@ namespace ts { } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + writeTextOfNode(currentText, node.moduleSpecifier); write(";"); writer.writeLine(); } function emitImportOrExportSpecifier(node: ImportOrExportSpecifier) { if (node.propertyName) { - writeTextOfNode(currentSourceFile, node.propertyName); + writeTextOfNode(currentText, node.propertyName); write(" as "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } function emitExportSpecifier(node: ExportSpecifier) { @@ -733,7 +738,7 @@ namespace ts { } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + writeTextOfNode(currentText, node.moduleSpecifier); } write(";"); writer.writeLine(); @@ -748,11 +753,11 @@ namespace ts { else { write("module "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); while (node.body.kind !== SyntaxKind.ModuleBlock) { node = node.body; write("."); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } const prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; @@ -772,7 +777,7 @@ namespace ts { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); @@ -796,7 +801,7 @@ namespace ts { write("const "); } write("enum "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" {"); writeLine(); increaseIndent(); @@ -808,7 +813,7 @@ namespace ts { function emitEnumMemberDeclaration(node: EnumMember) { emitJsDocComments(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); const enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); @@ -827,7 +832,7 @@ namespace ts { increaseIndent(); emitJsDocComments(node); decreaseIndent(); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); @@ -958,7 +963,7 @@ namespace ts { } write("class "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); const prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -982,7 +987,7 @@ namespace ts { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("interface "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); const prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -1020,7 +1025,7 @@ namespace ts { // If this node is a computed name, it can only be a symbol, because we've already skipped // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If optional property emit ? if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) { write("?"); @@ -1107,7 +1112,7 @@ namespace ts { emitBindingPattern(bindingElement.name); } else { - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); } } @@ -1157,7 +1162,7 @@ namespace ts { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (!(node.flags & NodeFlags.Private)) { accessorWithTypeAnnotation = node; let type = getTypeAnnotationFromAccessor(node); @@ -1247,13 +1252,13 @@ namespace ts { } if (node.kind === SyntaxKind.FunctionDeclaration) { write("function "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } else if (node.kind === SyntaxKind.Constructor) { write("constructor"); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (hasQuestionToken(node)) { write("?"); } @@ -1393,7 +1398,7 @@ namespace ts { emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } if (resolver.isOptionalParameter(node)) { write("?"); @@ -1519,7 +1524,7 @@ namespace ts { // Example: // original: function foo({y: [a,b,c]}) {} // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; - writeTextOfNode(currentSourceFile, bindingElement.propertyName); + writeTextOfNode(currentText, bindingElement.propertyName); write(": "); } if (bindingElement.name) { @@ -1542,7 +1547,7 @@ namespace ts { if (bindingElement.dotDotDotToken) { write("..."); } - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); } } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 464bd51a91d..cb4cd3b3803 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -333,6 +333,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi const jsxDesugaring = host.getCompilerOptions().jsx !== JsxEmit.Preserve; const shouldEmitJsx = (s: SourceFile) => (s.languageVariant === LanguageVariant.JSX && !jsxDesugaring); + const emitJavaScript = createFileEmitter(); + if (targetSourceFile === undefined) { forEach(host.getSourceFiles(), sourceFile => { if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { @@ -470,11 +472,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function emitJavaScript(jsFilePath: string, root?: SourceFile) { - const writer = createTextWriter(newLine); + function createFileEmitter(): (jsFilePath: string, root?: SourceFile) => void { + const writer: EmitTextWriter = createTextWriter(newLine); const { write, writeTextOfNode, writeLine, increaseIndent, decreaseIndent } = writer; let currentSourceFile: SourceFile; + let currentText: string; + let currentLineMap: number[]; + let currentFileIdentifiers: Map; + let renamedDependencies: Map; + let isEs6Module: boolean; + let isCurrentFileExternalModule: boolean; + // name of an exporter function if file is a System external module // System.register([...], function () {...}) // exporting in System modules looks like: @@ -483,17 +492,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // var x;... exporter("x", x = 1) let exportFunctionForFile: string; - const generatedNameSet: Map = {}; - const nodeToGeneratedName: string[] = []; + let generatedNameSet: Map; + let nodeToGeneratedName: string[]; let computedPropertyNamesToGeneratedNames: string[]; let convertedLoopState: ConvertedLoopState; - let extendsEmitted = false; - let decorateEmitted = false; - let paramEmitted = false; - let awaiterEmitted = false; - let tempFlags = 0; + let extendsEmitted: boolean; + let decorateEmitted: boolean; + let paramEmitted: boolean; + let awaiterEmitted: boolean; + let tempFlags: TempFlags; let tempVariables: Identifier[]; let tempParameters: Identifier[]; let externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; @@ -547,35 +556,74 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi [ModuleKind.CommonJS]: emitCommonJSModule, }; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } + return doEmit; - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - forEach(host.getSourceFiles(), sourceFile => { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } + function doEmit(jsFilePath: string, root?: SourceFile) { + // reset the state + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + generatedNameSet = {}; + nodeToGeneratedName = []; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); - return; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(jsFilePath, root); + } + + if (root) { + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); + } + else { + forEach(host.getSourceFiles(), sourceFile => { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + + writeLine(); + writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); + } function emitSourceFile(sourceFile: SourceFile): void { currentSourceFile = sourceFile; + + currentText = sourceFile.text; + currentLineMap = getLineStarts(sourceFile); exportFunctionForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = isExternalModule(sourceFile); + emit(sourceFile); } function isUniqueName(name: string): boolean { return !resolver.hasGlobalName(name) && - !hasProperty(currentSourceFile.identifiers, name) && + !hasProperty(currentFileIdentifiers, name) && !hasProperty(generatedNameSet, name); } @@ -667,7 +715,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps() { + function initializeEmitterWithSourceMaps(jsFilePath: string, root?: SourceFile) { let sourceMapDir: string; // The directory in which sourcemap will be // Current source map file and its index in the sources list @@ -771,7 +819,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function recordSourceMapSpan(pos: number) { - const sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + const sourceLinePos = computeLineAndCharacterOfPosition(currentLineMap, pos); // Convert the location to be one-based. sourceLinePos.line++; @@ -810,7 +858,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function recordEmitNodeStartSpan(node: Node) { // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(skipTrivia(currentSourceFile.text, node.pos)); + recordSourceMapSpan(skipTrivia(currentText, node.pos)); } function recordEmitNodeEndSpan(node: Node) { @@ -818,7 +866,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function writeTextWithSpanRecord(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) { - const tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + const tokenStartPos = ts.skipTrivia(currentText, startPos); recordSourceMapSpan(tokenStartPos); const tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); @@ -912,9 +960,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi sourceMapNameIndices.pop(); }; - function writeCommentRangeWithMap(curentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) { + function writeCommentRangeWithMap(currentText: string, currentLineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) { recordSourceMapSpan(comment.pos); - writeCommentRange(currentSourceFile, writer, comment, newLine); + writeCommentRange(currentText, currentLineMap, writer, comment, newLine); recordSourceMapSpan(comment.end); } @@ -950,7 +998,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function writeJavaScriptAndSourceMapFile(emitOutput: string, writeByteOrderMark: boolean) { + function writeJavaScriptAndSourceMapFile(emitOutput: string, jsFilePath: string, writeByteOrderMark: boolean) { encodeLastRecordedSourceMapSpan(); const sourceMapText = serializeSourceMapContents( @@ -977,7 +1025,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); } // Initialize source map data @@ -1059,7 +1107,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeComment = writeCommentRangeWithMap; } - function writeJavaScriptFile(emitOutput: string, writeByteOrderMark: boolean) { + function writeJavaScriptFile(emitOutput: string, jsFilePath: string, writeByteOrderMark: boolean) { writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } @@ -1269,7 +1317,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. if (node.parent) { - return getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + return getTextOfNodeFromSourceText(currentText, node); } // If we can't reach the original source text, use the canonical form if it's a number, @@ -1300,7 +1348,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Find original source text, since we need to emit the raw strings of the tagged template. // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + let text = getTextOfNodeFromSourceText(currentText, node); // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), // thus we need to remove those characters. @@ -1772,7 +1820,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write((node).text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } write("\""); @@ -1876,7 +1924,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); const name = (declaration).propertyName || (declaration).name; - const identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + const identifier = getTextOfNodeFromSourceText(currentText, name); if (languageVersion === ScriptTarget.ES3 && identifier === "default") { write(`["default"]`); } @@ -1902,7 +1950,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } @@ -1943,7 +1991,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } @@ -2403,7 +2451,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) { // The name property of a short-hand property assignment is considered an expression position, so here // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, // we emit a normal property assignment. For example: // module m { @@ -2480,11 +2528,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // 1 .toString is a valid property access, emit a space after the literal // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - let shouldEmitSpace: boolean; + let shouldEmitSpace = false; if (!indentedBeforeDot) { if (node.expression.kind === SyntaxKind.NumericLiteral) { // check if numeric literal was originally written with a dot - const text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + const text = getTextOfNodeFromSourceText(currentText, node.expression); shouldEmitSpace = text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0; } else { @@ -3815,18 +3863,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { - return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPositionFromLineMap(currentLineMap, skipTrivia(currentText, node1.pos)) === + getLineOfLocalPositionFromLineMap(currentLineMap, skipTrivia(currentText, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1: Node, node2: Node) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + getLineOfLocalPositionFromLineMap(currentLineMap, skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node: CaseOrDefaultClause) { @@ -3948,7 +3996,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi Debug.assert(!!(node.flags & NodeFlags.Default) || node.kind === SyntaxKind.ExportAssignment); // only allow export default at a source file level if (modulekind === ModuleKind.CommonJS || modulekind === ModuleKind.AMD || modulekind === ModuleKind.UMD) { - if (!currentSourceFile.symbol.exports["___esModule"]) { + if (!isEs6Module) { if (languageVersion === ScriptTarget.ES5) { // default value of configurable, enumerable, writable are `false`. write("Object.defineProperty(exports, \"__esModule\", { value: true });"); @@ -6304,8 +6352,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName: LiteralExpression): string { - if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return `"${currentSourceFile.renamedDependencies[moduleName.text]}"`; + if (renamedDependencies && hasProperty(renamedDependencies, moduleName.text)) { + return `"${renamedDependencies[moduleName.text]}"`; } return undefined; } @@ -6467,7 +6515,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // - current file is not external module // - import declaration is top level and target is value imported by entity name if (resolver.isReferencedAliasDeclaration(node) || - (!isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); @@ -6708,7 +6756,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string { const namespaceDeclaration = getNamespaceDeclarationNode(node); if (namespaceDeclaration && !isDefaultImport(node)) { - return getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + return getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } if (node.kind === SyntaxKind.ImportDeclaration && (node).importClause) { return getGeneratedNameForNode(node); @@ -7064,7 +7112,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function isCurrentFileSystemExternalModule() { - return modulekind === ModuleKind.System && isExternalModule(currentSourceFile); + return modulekind === ModuleKind.System && isCurrentFileExternalModule; } function emitSystemModuleBody(node: SourceFile, dependencyGroups: DependencyGroup[], startIndex: number): void { @@ -7927,7 +7975,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - const leadingComments = getLeadingCommentRanges(currentSourceFile.text, + const leadingComments = getLeadingCommentRanges(currentText, lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); @@ -7947,10 +7995,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function isTripleSlashComment(comment: CommentRange) { // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && + if (currentText.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash) { - const textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + currentText.charCodeAt(comment.pos + 2) === CharacterCodes.slash) { + const textSubStr = currentText.substring(comment.pos, comment.end); return textSubStr.match(fullTripleSlashReferencePathRegEx) || textSubStr.match(fullTripleSlashAMDReferencePathRegEx) ? true : false; @@ -7968,7 +8016,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { // get the leading comments from the node - return getLeadingCommentRangesOfNode(node, currentSourceFile); + return getLeadingCommentRangesOfNodeFromText(node, currentText); } } } @@ -7978,7 +8026,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) { - return getTrailingCommentRanges(currentSourceFile.text, node.end); + return getTrailingCommentRanges(currentText, node.end); } } } @@ -8017,10 +8065,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node: Node) { @@ -8032,7 +8080,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi const trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } /** @@ -8045,10 +8093,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return; } - const trailingComments = getTrailingCommentRanges(currentSourceFile.text, pos); + const trailingComments = getTrailingCommentRanges(currentText, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitLeadingCommentsOfPositionWorker(pos: number) { @@ -8063,17 +8111,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { // get the leading comments from the node - leadingComments = getLeadingCommentRanges(currentSourceFile.text, pos); + leadingComments = getLeadingCommentRanges(currentText, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAndUpdateCommentsInfo(node: TextRange) { - const currentDetachedCommentInfo = emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + const currentDetachedCommentInfo = emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); if (currentDetachedCommentInfo) { if (detachedCommentsInfo) { @@ -8086,7 +8134,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitShebang() { - const shebang = getShebang(currentSourceFile.text); + const shebang = getShebang(currentText); if (shebang) { write(shebang); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ab06b12318b..5ec56496ff3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2,15 +2,15 @@ /// namespace ts { - const nodeConstructors = new Array Node>(SyntaxKind.Count); + const nodeConstructors = new Array Node>(SyntaxKind.Count); /* @internal */ export let parseTime = 0; - export function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node { + export function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number, kind?: SyntaxKind) => Node { return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)); } export function createNode(kind: SyntaxKind, pos?: number, end?: number): Node { - return new (getNodeConstructor(kind))(pos, end); + return new (getNodeConstructor(kind))(pos, end, kind); } function visitNode(cbNode: (node: Node) => T, node: Node): T { @@ -671,7 +671,7 @@ namespace ts { return sourceFile; } - function setContextFlag(val: Boolean, flag: ParserContextFlags) { + function setContextFlag(val: boolean, flag: ParserContextFlags) { if (val) { contextFlags |= flag; } @@ -996,7 +996,7 @@ namespace ts { if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(pos, pos); + return new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(pos, pos, kind); } function finishNode(node: T, end?: number): T { diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 4e11e0d6b99..9703ef8517b 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -580,7 +580,7 @@ namespace ts { function getCommentRanges(text: string, pos: number, trailing: boolean): CommentRange[] { let result: CommentRange[]; let collecting = trailing || pos === 0; - while (true) { + while (pos < text.length) { const ch = text.charCodeAt(pos); switch (ch) { case CharacterCodes.carriageReturn: @@ -650,6 +650,8 @@ namespace ts { } return result; } + + return result; } export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] { @@ -741,7 +743,7 @@ namespace ts { } } - function scanNumber(): number { + function scanNumber(): string { const start = pos; while (isDigit(text.charCodeAt(pos))) pos++; if (text.charCodeAt(pos) === CharacterCodes.dot) { @@ -761,7 +763,7 @@ namespace ts { error(Diagnostics.Digit_expected); } } - return +(text.substring(start, end)); + return "" + +(text.substring(start, end)); } function scanOctalDigits(): number { @@ -1229,7 +1231,7 @@ namespace ts { return pos++, token = SyntaxKind.MinusToken; case CharacterCodes.dot: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = SyntaxKind.NumericLiteral; } if (text.charCodeAt(pos + 1) === CharacterCodes.dot && text.charCodeAt(pos + 2) === CharacterCodes.dot) { @@ -1343,7 +1345,7 @@ namespace ts { case CharacterCodes._7: case CharacterCodes._8: case CharacterCodes._9: - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = SyntaxKind.NumericLiteral; case CharacterCodes.colon: return pos++, token = SyntaxKind.ColonToken; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index aecf8ab76ba..38d4fd9c7da 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -421,18 +421,26 @@ namespace ts { return getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } + export function getLeadingCommentRangesOfNodeFromText(node: Node, text: string) { + return getLeadingCommentRanges(text, node.pos); + } + export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) { + return getJsDocCommentsFromText(node, sourceFileOfNode.text); + } + + export function getJsDocCommentsFromText(node: Node, text: string) { const commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ? - concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos), - getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : - getLeadingCommentRangesOfNode(node, sourceFileOfNode); + concatenate(getTrailingCommentRanges(text, node.pos), + getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); return filter(commentRanges, isJsDocComment); function isJsDocComment(comment: CommentRange) { // True if the comment starts with '/**' but not if it is '/**/' - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash; + return text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && + text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk && + text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash; } } @@ -1383,8 +1391,8 @@ namespace ts { export function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult { const simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.exec(comment)) { - if (isNoDefaultLibRegEx.exec(comment)) { + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; @@ -1689,7 +1697,7 @@ namespace ts { export interface EmitTextWriter { write(s: string): void; - writeTextOfNode(sourceFile: SourceFile, node: Node): void; + writeTextOfNode(text: string, node: Node): void; writeLine(): void; increaseIndent(): void; decreaseIndent(): void; @@ -1700,6 +1708,7 @@ namespace ts { getLine(): number; getColumn(): number; getIndent(): number; + reset(): void; } const indentStrings: string[] = ["", " "]; @@ -1715,11 +1724,11 @@ namespace ts { } export function createTextWriter(newLine: String): EmitTextWriter { - let output = ""; - let indent = 0; - let lineStart = true; - let lineCount = 0; - let linePos = 0; + let output: string; + let indent: number; + let lineStart: boolean; + let lineCount: number; + let linePos: number; function write(s: string) { if (s && s.length) { @@ -1731,6 +1740,14 @@ namespace ts { } } + function reset(): void { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } + function rawWrite(s: string) { if (s !== undefined) { if (lineStart) { @@ -1760,10 +1777,12 @@ namespace ts { } } - function writeTextOfNode(sourceFile: SourceFile, node: Node) { - write(getSourceTextOfNodeFromSourceFile(sourceFile, node)); + function writeTextOfNode(text: string, node: Node) { + write(getTextOfNodeFromSourceText(text, node)); } + reset(); + return { write, rawWrite, @@ -1777,6 +1796,7 @@ namespace ts { getLine: () => lineCount + 1, getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1, getText: () => output, + reset }; } @@ -1809,6 +1829,10 @@ namespace ts { return getLineAndCharacterOfPosition(currentSourceFile, pos).line; } + export function getLineOfLocalPositionFromLineMap(lineMap: number[], pos: number) { + return computeLineAndCharacterOfPosition(lineMap, pos).line; + } + export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration { return forEach(node.members, member => { if (member.kind === SyntaxKind.Constructor && nodeIsPresent((member).body)) { @@ -1883,23 +1907,23 @@ namespace ts { }; } - export function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { + export function emitNewLineBeforeLeadingComments(lineMap: number[], writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } - export function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, - writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void) { + export function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, + writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void) { let emitLeadingSpace = !trailingSeparator; forEach(comments, comment => { if (emitLeadingSpace) { writer.write(" "); emitLeadingSpace = false; } - writeComment(currentSourceFile, writer, comment, newLine); + writeComment(text, lineMap, writer, comment, newLine); if (comment.hasTrailingNewLine) { writer.writeLine(); } @@ -1917,8 +1941,8 @@ namespace ts { * Detached comment is a comment at the top of file or function body that is separated from * the next statement by space. */ - export function emitDetachedComments(currentSourceFile: SourceFile, writer: EmitTextWriter, - writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void, + export function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, + writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean) { let leadingComments: CommentRange[]; let currentDetachedCommentInfo: {nodePos: number, detachedCommentEndPos: number}; @@ -1929,12 +1953,12 @@ namespace ts { // // var x = 10; if (node.pos === 0) { - leadingComments = filter(getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + leadingComments = filter(getLeadingCommentRanges(text, node.pos), isPinnedComment); } } else { // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); + leadingComments = getLeadingCommentRanges(text, node.pos); } if (leadingComments) { @@ -1943,8 +1967,8 @@ namespace ts { for (const comment of leadingComments) { if (lastComment) { - const lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - const commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + const lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + const commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -1962,12 +1986,12 @@ namespace ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - const lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastOrUndefined(detachedComments).end); - const nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + const lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastOrUndefined(detachedComments).end); + const nodeLine = getLineOfLocalPositionFromLineMap(lineMap, skipTrivia(text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: lastOrUndefined(detachedComments).end }; } } @@ -1976,25 +2000,26 @@ namespace ts { return currentDetachedCommentInfo; function isPinnedComment(comment: CommentRange) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && - currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; + return text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && + text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } + } - export function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - const firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - const lineCount = getLineStarts(currentSourceFile).length; + export function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) { + if (text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { + const firstCommentLineAndCharacter = computeLineAndCharacterOfPosition(lineMap, comment.pos); + const lineCount = lineMap.length; let firstCommentLineIndent: number; for (let pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { const nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + ? text.length + 1 + : lineMap[currentLine + 1]; if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); } // These are number of spaces writer is going to write at current indent @@ -2014,7 +2039,7 @@ namespace ts { // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } - const spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + const spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { let numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); const indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); @@ -2035,47 +2060,47 @@ namespace ts { } // Write the comment line text - writeTrimmedCurrentLine(pos, nextLineStart); + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { // Single line comment of style //.... - writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); + writer.write(text.substring(comment.pos, comment.end)); } + } - function writeTrimmedCurrentLine(pos: number, nextLineStart: number) { - const end = Math.min(comment.end, nextLineStart - 1); - const currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - // trimmed forward and ending spaces text - writer.write(currentLineText); - if (end !== comment.end) { - writer.writeLine(); - } + function writeTrimmedCurrentLine(text: string, comment: CommentRange, writer: EmitTextWriter, newLine: string, pos: number, nextLineStart: number) { + const end = Math.min(comment.end, nextLineStart - 1); + const currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + // trimmed forward and ending spaces text + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + // Empty string - make sure we write empty line + writer.writeLiteral(newLine); + } + } + + function calculateIndent(text: string, pos: number, end: number) { + let currentLineIndent = 0; + for (; pos < end && isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === CharacterCodes.tab) { + // Tabs = TabSize = indent size and go to next tabStop + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); } else { - // Empty string - make sure we write empty line - writer.writeLiteral(newLine); + // Single space + currentLineIndent++; } } - function calculateIndent(pos: number, end: number) { - let currentLineIndent = 0; - for (; pos < end && isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === CharacterCodes.tab) { - // Tabs = TabSize = indent size and go to next tabStop - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - // Single space - currentLineIndent++; - } - } - - return currentLineIndent; - } + return currentLineIndent; } export function modifierToFlag(token: SyntaxKind): NodeFlags { From 3f1596bba7e61df6a48a6a445d89245cdef45786 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sat, 7 Nov 2015 15:28:21 -0800 Subject: [PATCH 100/140] remove nodeConstructors array, replace it with single local --- src/compiler/core.ts | 8 +++++--- src/compiler/parser.ts | 31 ++++++++++++++++++++++--------- src/services/services.ts | 28 +++++++++++++++------------- 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 8ed8edf927a..2ce3bbfaf3b 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -785,7 +785,8 @@ namespace ts { }; export interface ObjectAllocator { - getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node; + getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; + getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile; getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; getSignatureConstructor(): new (checker: TypeChecker) => Signature; @@ -804,7 +805,7 @@ namespace ts { function Signature(checker: TypeChecker) { } - function Node(pos: number, end: number, kind: SyntaxKind) { + function Node(kind: SyntaxKind, pos: number, end: number) { this.kind = kind; this.pos = pos; this.end = end; @@ -813,7 +814,8 @@ namespace ts { } export let objectAllocator: ObjectAllocator = { - getNodeConstructor: _ => Node, + getNodeConstructor: () => Node, + getSourceFileConstructor: () => Node, getSymbolConstructor: () => Symbol, getTypeConstructor: () => Type, getSignatureConstructor: () => Signature diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5ec56496ff3..ec2aeb25af9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2,15 +2,18 @@ /// namespace ts { - const nodeConstructors = new Array Node>(SyntaxKind.Count); /* @internal */ export let parseTime = 0; - export function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number, kind?: SyntaxKind) => Node { - return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)); - } + let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; + let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; export function createNode(kind: SyntaxKind, pos?: number, end?: number): Node { - return new (getNodeConstructor(kind))(pos, end, kind); + if (kind === SyntaxKind.SourceFile) { + return new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, pos, end); + } } function visitNode(cbNode: (node: Node) => T, node: Node): T { @@ -437,6 +440,10 @@ namespace ts { const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); const disallowInAndDecoratorContext = ParserContextFlags.DisallowIn | ParserContextFlags.Decorator; + // capture constructors in 'initializeState' to avoid null checks + let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; + let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; + let sourceFile: SourceFile; let parseDiagnostics: Diagnostic[]; let syntaxCursor: IncrementalParser.SyntaxCursor; @@ -537,6 +544,9 @@ namespace ts { } function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor) { + NodeConstructor = objectAllocator.getNodeConstructor(); + SourceFileConstructor = objectAllocator.getSourceFileConstructor(); + sourceText = _sourceText; syntaxCursor = _syntaxCursor; @@ -657,10 +667,11 @@ namespace ts { } function createSourceFile(fileName: string, languageVersion: ScriptTarget): SourceFile { - const sourceFile = createNode(SyntaxKind.SourceFile, /*pos*/ 0); + // code from createNode is inlined here so createNode won't have to deal with special case of creating source files + // this is quite rare comparing to other nodes and createNode should be as fast as possible + const sourceFile = new SourceFileConstructor(SyntaxKind.SourceFile, /*pos*/ 0, /* end */ sourceText.length); + nodeCount++; - sourceFile.pos = 0; - sourceFile.end = sourceText.length; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; @@ -991,12 +1002,14 @@ namespace ts { } } + // note: this function creates only node function createNode(kind: SyntaxKind, pos?: number): Node { nodeCount++; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(pos, pos, kind); + + return new NodeConstructor(kind, pos, pos); } function finishNode(node: T, end?: number): T { diff --git a/src/services/services.ts b/src/services/services.ts index 1672e4ad4ff..113a52459e9 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -174,7 +174,7 @@ namespace ts { let jsDocCompletionEntries: CompletionEntry[]; function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject { - let node = new (getNodeConstructor(kind))(pos, end); + let node = new NodeObject(kind, pos, end); node.flags = flags; node.parent = parent; return node; @@ -188,6 +188,14 @@ namespace ts { public parent: Node; private _children: Node[]; + constructor(kind: SyntaxKind, pos: number, end: number) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = NodeFlags.None; + this.parent = undefined; + } + public getSourceFile(): SourceFile { return getSourceFileOfNode(this); } @@ -805,6 +813,10 @@ namespace ts { public imports: LiteralExpression[]; private namedDeclarations: Map; + constructor(kind: SyntaxKind, pos: number, end: number) { + super(kind, pos, end) + } + public update(newText: string, textChangeRange: TextChangeRange): SourceFile { return updateSourceFile(this, newText, textChangeRange); } @@ -7970,18 +7982,8 @@ namespace ts { function initializeServices() { objectAllocator = { - getNodeConstructor: kind => { - function Node(pos: number, end: number) { - this.pos = pos; - this.end = end; - this.flags = NodeFlags.None; - this.parent = undefined; - } - let proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject(); - proto.kind = kind; - Node.prototype = proto; - return Node; - }, + getNodeConstructor: () => NodeObject, + getSourceFileConstructor: () => SourceFileObject, getSymbolConstructor: () => SymbolObject, getTypeConstructor: () => TypeObject, getSignatureConstructor: () => SignatureObject, From 72723e93bebe87c657ebe1c69f771b00b3d4f780 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sat, 7 Nov 2015 16:56:16 -0800 Subject: [PATCH 101/140] do not report 'excess property error' if object literal pattern contains computed properties --- src/compiler/checker.ts | 15 ++++++-- src/compiler/types.ts | 1 + ...putedPropertiesInDestructuring1.errors.txt | 38 +------------------ ...dPropertiesInDestructuring1_ES6.errors.txt | 38 +------------------ 4 files changed, 15 insertions(+), 77 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cb15d6d9401..8b3b0417d5d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2500,10 +2500,12 @@ namespace ts { // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type { const members: SymbolTable = {}; + let hasComputedProperties = false; forEach(pattern.elements, e => { const name = e.propertyName || e.name; if (isComputedNonLiteralName(name)) { // do not include computed properties in the implied type + hasComputedProperties = true; return; } @@ -2518,6 +2520,9 @@ namespace ts { if (includePatternInType) { result.pattern = pattern; } + if (hasComputedProperties) { + result.flags |= TypeFlags.ObjectLiteralPatternWithComputedProperties; + } return result; } @@ -5010,7 +5015,7 @@ namespace ts { } function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean { - if (someConstituentTypeHasKind(target, TypeFlags.ObjectType)) { + if (!(target.flags & TypeFlags.ObjectLiteralPatternWithComputedProperties) && someConstituentTypeHasKind(target, TypeFlags.ObjectType)) { for (const prop of getPropertiesOfObjectType(source)) { if (!isKnownProperty(target, prop.name)) { if (reportErrors) { @@ -7428,6 +7433,7 @@ namespace ts { (contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression); let typeFlags: TypeFlags = 0; + let patternWithComputedProperties = false; for (const memberDecl of node.properties) { let member = memberDecl.symbol; if (memberDecl.kind === SyntaxKind.PropertyAssignment || @@ -7455,8 +7461,11 @@ namespace ts { if (isOptional) { prop.flags |= SymbolFlags.Optional; } + if (hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } } - else if (contextualTypeHasPattern) { + else if (contextualTypeHasPattern && !(contextualType.flags & TypeFlags.ObjectLiteralPatternWithComputedProperties)) { // If object literal is contextually typed by the implied type of a binding pattern, and if the // binding pattern specifies a default value for the property, make the property optional. const impliedProp = getPropertyOfType(contextualType, member.name); @@ -7513,7 +7522,7 @@ namespace ts { const numberIndexType = getIndexType(IndexKind.Number); const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral; - result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags); + result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags) | (patternWithComputedProperties ? TypeFlags.ObjectLiteralPatternWithComputedProperties : 0); if (inDestructuringPattern) { result.pattern = node; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index af6200ac023..4ed64b07f17 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1822,6 +1822,7 @@ namespace ts { ContainsAnyFunctionType = 0x00800000, // Type is or contains object literal type ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6 ThisType = 0x02000000, // This type + ObjectLiteralPatternWithComputedProperties = 0x04000000, // Object literal type implied by binding pattern has computed properties /* @internal */ Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt index 682db92f95f..dc536e544b2 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt @@ -1,41 +1,21 @@ -tests/cases/compiler/computedPropertiesInDestructuring1.ts(3,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(8,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(10,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(11,28): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,27): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,12): error TS2339: Property 'toExponential' does not exist on type 'string'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,41): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(24,18): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(28,22): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(30,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(31,24): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,23): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,26): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -==== tests/cases/compiler/computedPropertiesInDestructuring1.ts (16 errors) ==== +==== tests/cases/compiler/computedPropertiesInDestructuring1.ts (4 errors) ==== // destructuring in variable declarations let foo = "bar"; let {[foo]: bar} = {bar: "bar"}; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let {["bar"]: bar2} = {bar: "bar"}; let foo2 = () => "bar"; let {[foo2()]: bar3} = {bar: "bar"}; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo]: bar4}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo2()]: bar5}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. function f1({["bar"]: x}: { bar: number }) {} function f2({[foo]: x}: { bar: number }) {} @@ -47,42 +27,26 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,26): error TS2353: let [{[foo()]: bar6}] = [{bar: "bar"}]; ~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; ~~~~~~~~~~~~~ !!! error TS2339: Property 'toExponential' does not exist on type 'string'. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. // destructuring assignment ({[foo]: bar} = {bar: "bar"}); - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. ({["bar"]: bar2} = {bar: "bar"}); ({[foo2()]: bar3} = {bar: "bar"}); - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo]: bar4}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo2()]: bar5}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo()]: bar4}] = [{bar: "bar"}]; ~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; ~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt index 1866cf1d543..96ab892d1b9 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt @@ -1,42 +1,22 @@ -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(3,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(9,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(11,25): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(12,28): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,27): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,12): error TS2339: Property 'toExponential' does not exist on type 'string'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,41): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(25,18): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(29,22): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(31,21): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(32,24): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,23): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,26): error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. -==== tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts (16 errors) ==== +==== tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts (4 errors) ==== // destructuring in variable declarations let foo = "bar"; let {[foo]: bar} = {bar: "bar"}; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let {["bar"]: bar2} = {bar: "bar"}; let {[11]: bar2_1} = {11: "bar"}; let foo2 = () => "bar"; let {[foo2()]: bar3} = {bar: "bar"}; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo]: bar4}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo2()]: bar5}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. function f1({["bar"]: x}: { bar: number }) {} function f2({[foo]: x}: { bar: number }) {} @@ -48,40 +28,24 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,26): error TS2 let [{[foo()]: bar6}] = [{bar: "bar"}]; ~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; ~~~~~~~~~~~~~ !!! error TS2339: Property 'toExponential' does not exist on type 'string'. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. // destructuring assignment ({[foo]: bar} = {bar: "bar"}); - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. ({["bar"]: bar2} = {bar: "bar"}); ({[foo2()]: bar3} = {bar: "bar"}); - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo]: bar4}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo2()]: bar5}] = [{bar: "bar"}]; - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[foo()]: bar4}] = [{bar: "bar"}]; ~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; ~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. - ~~~ -!!! error TS2353: Object literal may only specify known properties, and 'bar' does not exist in type '{}'. \ No newline at end of file From efbacb97c9d57a449a45da2110b550303e0a0398 Mon Sep 17 00:00:00 2001 From: mihailik Date: Mon, 9 Nov 2015 09:45:57 +0000 Subject: [PATCH 102/140] Use ts.indexOf instead of Array.prototype.indexOf (keep consistent with the rest of codebase, and thus enable ES3-compatibility of tsc and services) --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 706ed1c65a3..c4a60cd3355 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3731,7 +3731,7 @@ namespace ts { if (node.initializer) { const signatureDeclaration = node.parent; const signature = getSignatureFromDeclaration(signatureDeclaration); - const parameterIndex = signatureDeclaration.parameters.indexOf(node); + const parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } From 4ca24bf1318d26b0770275417cf2e634a8ad5049 Mon Sep 17 00:00:00 2001 From: mihailik Date: Mon, 9 Nov 2015 09:52:13 +0000 Subject: [PATCH 103/140] Use ts.indexOf instead of Array.prototype.indexOf (keep consistent with the rest of codebase, and thus enable ES3-compatibility of tsc and services) --- src/services/formatting/tokenRange.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 19185cdf78d..1afde613618 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -14,7 +14,7 @@ namespace ts.formatting { constructor(from: SyntaxKind, to: SyntaxKind, except: SyntaxKind[]) { this.tokens = []; for (let token = from; token <= to; token++) { - if (except.indexOf(token) < 0) { + if (ts.indexOf(except, token) < 0) { this.tokens.push(token); } } @@ -123,4 +123,4 @@ namespace ts.formatting { static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); } } -} \ No newline at end of file +} From 81c2cb90e8c1beacd780d5e5b90cdfc15fa9ea8f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Nov 2015 10:16:16 -0800 Subject: [PATCH 104/140] apply captured type parameters to returned classes Get instantiated constructors for classes with captured (outer) type parameters that have not yet been applied. The fast path was incorrect for these classes. --- src/compiler/checker.ts | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d1dbc966952..4f39ada7a53 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2868,23 +2868,25 @@ namespace ts { function resolveBaseTypesOfClass(type: InterfaceType): void { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - let baseContructorType = getBaseConstructorTypeOfClass(type); - if (!(baseContructorType.flags & TypeFlags.ObjectType)) { + let baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & TypeFlags.ObjectType)) { return; } let baseTypeNode = getBaseTypeNodeOfClass(type); let baseType: Type; - if (baseContructorType.symbol && baseContructorType.symbol.flags & SymbolFlags.Class) { - // When base constructor type is a class we know that the constructors all have the same type parameters as the + let originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class && + !baseTypeHasUnappliedOuterTypeParameters(originalBaseType)) { + // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the // class and all return the instance type of the class. There is no need for further checks and we can apply the // type arguments in the same manner as a type reference to get the same error reporting experience. - baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseContructorType.symbol); + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } else { // The class derives from a "class-like" constructor function, check that we have at least one construct signature // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere // we check that all instantiated signatures return the same type. - let constructors = getInstantiatedConstructorsForTypeArguments(baseContructorType, baseTypeNode.typeArguments); + let constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); if (!constructors.length) { error(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -2911,6 +2913,21 @@ namespace ts { } } + function baseTypeHasUnappliedOuterTypeParameters(type: Type): boolean { + let originalBaseType = type; + let originalTypeReference = type; + if (originalBaseType.outerTypeParameters) { + // an unapplied type type parameter is one + // whose argument symbol is still the same as the parameter symbol + for (let i = 0; i < originalBaseType.outerTypeParameters.length; i++) { + if (originalBaseType.outerTypeParameters[i].symbol === originalTypeReference.typeArguments[i].symbol) { + return true; + } + } + } + return false; + } + function resolveBaseTypesOfInterface(type: InterfaceType): void { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (let declaration of type.symbol.declarations) { From a6068e1c08553c843e34ca00ff76da550cfa4159 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Nov 2015 10:21:54 -0800 Subject: [PATCH 105/140] More test cases and accept baselines --- .../genericClassExpressionInFunction.js | 104 +++++++++++++++++ .../genericClassExpressionInFunction.symbols | 92 +++++++++++++++ .../genericClassExpressionInFunction.types | 108 ++++++++++++++++++ .../genericClassExpressionInFunction.ts | 13 ++- 4 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/genericClassExpressionInFunction.js create mode 100644 tests/baselines/reference/genericClassExpressionInFunction.symbols create mode 100644 tests/baselines/reference/genericClassExpressionInFunction.types diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js new file mode 100644 index 00000000000..bb45587eea1 --- /dev/null +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -0,0 +1,104 @@ +//// [genericClassExpressionInFunction.ts] +class A { + genericVar: T +} +function B1() { + // class expression can use T + return class extends A { } +} +class B2 { + anon = class extends A { } +} +function B3() { + return class Inner extends A { } +} +// extends can call B +class K extends B1() { + namae: string; +} +class C extends (new B2().anon) { + name: string; +} +let b3Number = B3(); +class S extends b3Number { + nom: string; +} +var c = new C(); +var k = new K(); +var s = new S(); +c.genericVar = 12; +k.genericVar = 12; +s.genericVar = 12; + + +//// [genericClassExpressionInFunction.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + } + return A; +})(); +function B1() { + // class expression can use T + return (function (_super) { + __extends(class_1, _super); + function class_1() { + _super.apply(this, arguments); + } + return class_1; + })(A); +} +var B2 = (function () { + function B2() { + this.anon = (function (_super) { + __extends(class_2, _super); + function class_2() { + _super.apply(this, arguments); + } + return class_2; + })(A); + } + return B2; +})(); +function B3() { + return (function (_super) { + __extends(Inner, _super); + function Inner() { + _super.apply(this, arguments); + } + return Inner; + })(A); +} +// extends can call B +var K = (function (_super) { + __extends(K, _super); + function K() { + _super.apply(this, arguments); + } + return K; +})(B1()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})((new B2().anon)); +var b3Number = B3(); +var S = (function (_super) { + __extends(S, _super); + function S() { + _super.apply(this, arguments); + } + return S; +})(b3Number); +var c = new C(); +var k = new K(); +var s = new S(); +c.genericVar = 12; +k.genericVar = 12; +s.genericVar = 12; diff --git a/tests/baselines/reference/genericClassExpressionInFunction.symbols b/tests/baselines/reference/genericClassExpressionInFunction.symbols new file mode 100644 index 00000000000..b5a6b8c6c70 --- /dev/null +++ b/tests/baselines/reference/genericClassExpressionInFunction.symbols @@ -0,0 +1,92 @@ +=== tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts === +class A { +>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0)) +>T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8)) + + genericVar: T +>genericVar : Symbol(genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) +>T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8)) +} +function B1() { +>B1 : Symbol(B1, Decl(genericClassExpressionInFunction.ts, 2, 1)) +>U : Symbol(U, Decl(genericClassExpressionInFunction.ts, 3, 12)) + + // class expression can use T + return class extends A { } +>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0)) +>U : Symbol(U, Decl(genericClassExpressionInFunction.ts, 3, 12)) +} +class B2 { +>B2 : Symbol(B2, Decl(genericClassExpressionInFunction.ts, 6, 1)) +>V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9)) + + anon = class extends A { } +>anon : Symbol(anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) +>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0)) +>V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9)) +} +function B3() { +>B3 : Symbol(B3, Decl(genericClassExpressionInFunction.ts, 9, 1)) +>W : Symbol(W, Decl(genericClassExpressionInFunction.ts, 10, 12)) + + return class Inner extends A { } +>Inner : Symbol(Inner, Decl(genericClassExpressionInFunction.ts, 11, 10)) +>TInner : Symbol(TInner, Decl(genericClassExpressionInFunction.ts, 11, 23)) +>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0)) +>W : Symbol(W, Decl(genericClassExpressionInFunction.ts, 10, 12)) +} +// extends can call B +class K extends B1() { +>K : Symbol(K, Decl(genericClassExpressionInFunction.ts, 12, 1)) +>B1 : Symbol(B1, Decl(genericClassExpressionInFunction.ts, 2, 1)) + + namae: string; +>namae : Symbol(namae, Decl(genericClassExpressionInFunction.ts, 14, 30)) +} +class C extends (new B2().anon) { +>C : Symbol(C, Decl(genericClassExpressionInFunction.ts, 16, 1)) +>new B2().anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) +>B2 : Symbol(B2, Decl(genericClassExpressionInFunction.ts, 6, 1)) +>anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) + + name: string; +>name : Symbol(name, Decl(genericClassExpressionInFunction.ts, 17, 41)) +} +let b3Number = B3(); +>b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3)) +>B3 : Symbol(B3, Decl(genericClassExpressionInFunction.ts, 9, 1)) + +class S extends b3Number { +>S : Symbol(S, Decl(genericClassExpressionInFunction.ts, 20, 28)) +>b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3)) + + nom: string; +>nom : Symbol(nom, Decl(genericClassExpressionInFunction.ts, 21, 34)) +} +var c = new C(); +>c : Symbol(c, Decl(genericClassExpressionInFunction.ts, 24, 3)) +>C : Symbol(C, Decl(genericClassExpressionInFunction.ts, 16, 1)) + +var k = new K(); +>k : Symbol(k, Decl(genericClassExpressionInFunction.ts, 25, 3)) +>K : Symbol(K, Decl(genericClassExpressionInFunction.ts, 12, 1)) + +var s = new S(); +>s : Symbol(s, Decl(genericClassExpressionInFunction.ts, 26, 3)) +>S : Symbol(S, Decl(genericClassExpressionInFunction.ts, 20, 28)) + +c.genericVar = 12; +>c.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) +>c : Symbol(c, Decl(genericClassExpressionInFunction.ts, 24, 3)) +>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) + +k.genericVar = 12; +>k.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) +>k : Symbol(k, Decl(genericClassExpressionInFunction.ts, 25, 3)) +>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) + +s.genericVar = 12; +>s.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) +>s : Symbol(s, Decl(genericClassExpressionInFunction.ts, 26, 3)) +>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) + diff --git a/tests/baselines/reference/genericClassExpressionInFunction.types b/tests/baselines/reference/genericClassExpressionInFunction.types new file mode 100644 index 00000000000..943391fdd59 --- /dev/null +++ b/tests/baselines/reference/genericClassExpressionInFunction.types @@ -0,0 +1,108 @@ +=== tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts === +class A { +>A : A +>T : T + + genericVar: T +>genericVar : T +>T : T +} +function B1() { +>B1 : () => typeof (Anonymous class) +>U : U + + // class expression can use T + return class extends A { } +>class extends A { } : typeof (Anonymous class) +>A : A +>U : U +} +class B2 { +>B2 : B2 +>V : V + + anon = class extends A { } +>anon : typeof (Anonymous class) +>class extends A { } : typeof (Anonymous class) +>A : A +>V : V +} +function B3() { +>B3 : () => typeof Inner +>W : W + + return class Inner extends A { } +>class Inner extends A { } : typeof Inner +>Inner : typeof Inner +>TInner : TInner +>A : A +>W : W +} +// extends can call B +class K extends B1() { +>K : K +>B1() : B1.(Anonymous class) +>B1 : () => typeof (Anonymous class) + + namae: string; +>namae : string +} +class C extends (new B2().anon) { +>C : C +>(new B2().anon) : B2.(Anonymous class) +>new B2().anon : typeof (Anonymous class) +>new B2() : B2 +>B2 : typeof B2 +>anon : typeof (Anonymous class) + + name: string; +>name : string +} +let b3Number = B3(); +>b3Number : typeof Inner +>B3() : typeof Inner +>B3 : () => typeof Inner + +class S extends b3Number { +>S : S +>b3Number : B3.Inner + + nom: string; +>nom : string +} +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +var k = new K(); +>k : K +>new K() : K +>K : typeof K + +var s = new S(); +>s : S +>new S() : S +>S : typeof S + +c.genericVar = 12; +>c.genericVar = 12 : number +>c.genericVar : number +>c : C +>genericVar : number +>12 : number + +k.genericVar = 12; +>k.genericVar = 12 : number +>k.genericVar : number +>k : K +>genericVar : number +>12 : number + +s.genericVar = 12; +>s.genericVar = 12 : number +>s.genericVar : number +>s : S +>genericVar : number +>12 : number + diff --git a/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts index 70f63e8a929..14885ca9905 100644 --- a/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts +++ b/tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts @@ -1,8 +1,6 @@ class A { genericVar: T } -class B3 extends A { -} function B1() { // class expression can use T return class extends A { } @@ -10,6 +8,9 @@ function B1() { class B2 { anon = class extends A { } } +function B3() { + return class Inner extends A { } +} // extends can call B class K extends B1() { namae: string; @@ -17,9 +18,13 @@ class K extends B1() { class C extends (new B2().anon) { name: string; } +let b3Number = B3(); +class S extends b3Number { + nom: string; +} var c = new C(); var k = new K(); -var b3 = new B3(); +var s = new S(); c.genericVar = 12; k.genericVar = 12; -b3.genericVar = 12 +s.genericVar = 12; From 0cf4c6caba1f46e6094e1c59c0906f2b6ee9b5d1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Nov 2015 10:44:02 -0800 Subject: [PATCH 106/140] Fix linter error --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4f39ada7a53..1a5348018b8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2875,7 +2875,7 @@ namespace ts { let baseTypeNode = getBaseTypeNodeOfClass(type); let baseType: Type; let originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; - if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class && + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class && !baseTypeHasUnappliedOuterTypeParameters(originalBaseType)) { // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the // class and all return the instance type of the class. There is no need for further checks and we can apply the From 569cf96d06f612e1464704e85b16eef3add37be2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Nov 2015 10:48:22 -0800 Subject: [PATCH 107/140] Fix new and improved linter errors --- src/compiler/checker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ff30b67d9c6..2494009333b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2876,7 +2876,7 @@ namespace ts { } const baseTypeNode = getBaseTypeNodeOfClass(type); let baseType: Type; - let originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + const originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class && !baseTypeHasUnappliedOuterTypeParameters(originalBaseType)) { // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the @@ -2916,8 +2916,8 @@ namespace ts { } function baseTypeHasUnappliedOuterTypeParameters(type: Type): boolean { - let originalBaseType = type; - let originalTypeReference = type; + const originalBaseType = type; + const originalTypeReference = type; if (originalBaseType.outerTypeParameters) { // an unapplied type type parameter is one // whose argument symbol is still the same as the parameter symbol From 38090c6ba50f11fbfe4700b3771f95f194de4783 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 12:48:58 -0800 Subject: [PATCH 108/140] Added tests for template strings with string literal types. --- .../stringLiteralTypesWithTemplateStrings01.ts | 7 +++++++ .../stringLiteralTypesWithTemplateStrings02.ts | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts new file mode 100644 index 00000000000..1920551abd8 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts @@ -0,0 +1,7 @@ +// @declaration: true + +let ABC: "ABC" = `ABC`; +let DE_NEWLINE_F: "DE\nF" = `DE +F`; +let G_QUOTE_HI: 'G"HI'; +let JK_BACKTICK_L: "JK`L" = `JK\`L`; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts new file mode 100644 index 00000000000..12debae4e20 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts @@ -0,0 +1,5 @@ +// @declaration: true + +let abc: "AB\r\nC" = `AB +C`; +let de_NEWLINE_f: "DE\nF" = `DE${"\n"}F`; \ No newline at end of file From e630ce247b6501d7a61ff1439ed628f63ca4ca71 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 9 Nov 2015 12:49:36 -0800 Subject: [PATCH 109/140] Fix merge problems from master --- src/compiler/binder.ts | 11 +++++------ src/compiler/checker.ts | 6 +++--- src/compiler/parser.ts | 2 +- src/compiler/program.ts | 22 +++++++++++----------- src/compiler/utilities.ts | 1 - src/harness/fourslash.ts | 6 +++--- src/server/editorServices.ts | 4 ++-- tests/cases/unittests/moduleResolution.ts | 6 ++++-- tests/webTestServer.ts | 17 ----------------- 9 files changed, 29 insertions(+), 46 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 366ad799cd1..49b259ea695 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,3 +1,4 @@ +/// /// /* @internal */ @@ -109,8 +110,6 @@ namespace ts { let lastContainer: Node; let seenThisKeyword: boolean; - const isJavaScriptFile = isSourceFileJavaScript(file); - // state used by reachability checks let hasExplicitReturn: boolean; let currentReachabilityState: Reachability; @@ -1154,7 +1153,7 @@ namespace ts { case SyntaxKind.Identifier: return checkStrictModeIdentifier(node); case SyntaxKind.BinaryExpression: - if (isJavaScriptFile) { + if (isInJavaScriptFile(node)) { if (isExportsPropertyAssignment(node)) { bindExportsPropertyAssignment(node); } @@ -1229,7 +1228,7 @@ namespace ts { return bindAnonymousDeclaration(node, SymbolFlags.Function, bindingName); case SyntaxKind.CallExpression: - if (isJavaScriptFile) { + if (isInJavaScriptFile(node)) { bindCallExpression(node); } break; @@ -1275,8 +1274,8 @@ namespace ts { bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName) }"`); } - function bindExportAssignment(node: ExportAssignment|BinaryExpression) { - let boundExpression = node.kind === SyntaxKind.ExportAssignment ? (node).expression : (node).right; + function bindExportAssignment(node: ExportAssignment | BinaryExpression) { + const boundExpression = node.kind === SyntaxKind.ExportAssignment ? (node).expression : (node).right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node)); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index caff64672fe..fe406c00180 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -990,7 +990,7 @@ namespace ts { // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. - const moduleName = escapeIdentifier(moduleReferenceLiteral.text); + let moduleName = escapeIdentifier(moduleReferenceLiteral.text); if (moduleName === undefined) { return; @@ -3845,9 +3845,9 @@ namespace ts { } function resolveExternalModuleTypeByLiteral(name: StringLiteral) { - let moduleSym = resolveExternalModuleName(name, name); + const moduleSym = resolveExternalModuleName(name, name); if (moduleSym) { - let resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + const resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); if (resolvedModuleSymbol) { return getTypeOfSymbol(resolvedModuleSymbol); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 894aa13cd05..5c57bfb5501 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,5 +1,5 @@ -/// /// +/// namespace ts { const nodeConstructors = new Array Node>(SyntaxKind.Count); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b38ffb03859..496dcbd0d7c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -53,13 +53,13 @@ namespace ts { if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { const failedLookupLocations: string[] = []; const candidate = normalizePath(combinePaths(containingDirectory, moduleName)); - let resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + let resolvedFileName = loadNodeModuleFromFile(supportedJsExtensions, candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName }, failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(supportedJsExtensions, candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName }, failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations }; @@ -69,8 +69,8 @@ namespace ts { } } - function loadNodeModuleFromFile(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { - return forEach(supportedExtensions, tryLoad); + function loadNodeModuleFromFile(extensions: string[], candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { + return forEach(extensions, tryLoad); function tryLoad(ext: string): string { const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext; @@ -84,7 +84,7 @@ namespace ts { } } - function loadNodeModuleFromDirectory(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { + function loadNodeModuleFromDirectory(extensions: string[], candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string { const packageJsonPath = combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { @@ -100,7 +100,7 @@ namespace ts { } if (jsonContent.typings) { - const result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + const result = loadNodeModuleFromFile(extensions, normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -111,7 +111,7 @@ namespace ts { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(combinePaths(candidate, "index"), failedLookupLocation, host); + return loadNodeModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { @@ -122,12 +122,12 @@ namespace ts { if (baseName !== "node_modules") { const nodeModulesFolder = combinePaths(directory, "node_modules"); const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); - let result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + let result = loadNodeModuleFromFile(supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } @@ -162,7 +162,7 @@ namespace ts { const failedLookupLocations: string[] = []; let referencedSourceFile: string; - let extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions; + const extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions; while (true) { searchName = normalizePath(combinePaths(searchPath, moduleName)); referencedSourceFile = forEach(extensions, extension => { @@ -689,7 +689,7 @@ namespace ts { return; } - let isJavaScriptFile = isSourceFileJavaScript(file); + const isJavaScriptFile = isSourceFileJavaScript(file); let imports: LiteralExpression[]; for (const node of file.statements) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 956cebc8a24..a1f649f3cf8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,3 @@ -/// /// /* @internal */ diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 4aa3a371b6d..1c8593a9e12 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -224,8 +224,8 @@ namespace FourSlash { // Add input file which has matched file name with the given reference-file path. // This is necessary when resolveReference flag is specified private addMatchedInputFile(referenceFilePath: string, extensions: string[]) { - let inputFiles = this.inputFiles; - let languageServiceAdapterHost = this.languageServiceAdapterHost; + const inputFiles = this.inputFiles; + const languageServiceAdapterHost = this.languageServiceAdapterHost; if (!extensions) { tryAdd(referenceFilePath); } @@ -234,7 +234,7 @@ namespace FourSlash { } function tryAdd(path: string) { - let inputFile = inputFiles[path]; + const inputFile = inputFiles[path]; if (inputFile && !Harness.isLibraryFile(path)) { languageServiceAdapterHost.addScript(path, inputFile); return true; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index fb7a221b124..333cea2745d 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -371,7 +371,7 @@ namespace ts.server { openRefCount = 0; constructor(public projectService: ProjectService, public projectOptions?: ProjectOptions) { - if(projectOptions && projectOptions.files){ + if (projectOptions && projectOptions.files) { // If files are listed explicitly, allow all extensions projectOptions.compilerOptions.allowNonTsExtensions = true; } @@ -1321,7 +1321,7 @@ namespace ts.server { this.setCompilerOptions(opt); } else { - var defaultOpts = ts.getDefaultCompilerOptions(); + const defaultOpts = ts.getDefaultCompilerOptions(); defaultOpts.allowNonTsExtensions = true; this.setCompilerOptions(defaultOpts); } diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 096f9914019..c53cad5725a 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -95,8 +95,8 @@ module ts { let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); - // expect three failed lookup location - attempt to load module as file with all supported extensions - assert.equal(resolution.failedLookupLocations.length, 3); + // expect five failed lookup location - attempt to load module as file with all supported extensions + assert.equal(resolution.failedLookupLocations.length, 5); } it("module name as directory - load from typings", () => { @@ -117,6 +117,8 @@ module ts { "/a/b/foo.ts", "/a/b/foo.tsx", "/a/b/foo.d.ts", + "/a/b/foo.js", + "/a/b/foo.jsx", "/a/b/foo/index.ts", "/a/b/foo/index.tsx", ]); diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index ad9316ed04f..6bd15359e3f 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -263,21 +263,6 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) { var browserPath: string; if ((browser && browser === 'chrome')) { -<<<<<<< HEAD - const platform = os.platform(); - let defaultChromePath: string; - switch(platform) { - case "win32": - defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"; - break; - case "linux": - defaultChromePath = "/opt/google/chrome/chrome"; - break; - default: - console.log(`Default Chrome location for platform ${platform} is unknown`); - break; - } -======= let defaultChromePath = ""; switch (os.platform()) { case "win32": @@ -291,8 +276,6 @@ if ((browser && browser === 'chrome')) { console.log(`default Chrome location is unknown for platform '${os.platform()}'`); break; } - ->>>>>>> master if (fs.existsSync(defaultChromePath)) { browserPath = defaultChromePath; } else { From 977c3eec22470df8cb0053282f515fc6eb84c640 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 9 Nov 2015 12:50:38 -0800 Subject: [PATCH 110/140] fix lints --- src/compiler/declarationEmitter.ts | 4 ++-- src/compiler/emitter.ts | 10 +++++----- src/compiler/utilities.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 9693d6b4c33..669cbcbcf0c 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -143,7 +143,7 @@ namespace ts { // create asynchronous output for the importDeclarations if (moduleElementDeclarationEmitInfo.length) { - let oldWriter = writer; + const oldWriter = writer; forEach(moduleElementDeclarationEmitInfo, aliasEmitInfo => { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { Debug.assert(aliasEmitInfo.node.kind === SyntaxKind.ImportDeclaration); @@ -744,7 +744,7 @@ namespace ts { function emitExternalModuleSpecifier(moduleSpecifier: Expression) { if (moduleSpecifier.kind === SyntaxKind.StringLiteral && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - let moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration)); + const moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration)); if (moduleName) { write("\""); write(moduleName); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8635dc44f91..ce92150f9fd 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -12,7 +12,7 @@ namespace ts { } export function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string { - let file = resolver.getExternalModuleFileFromDeclaration(declaration); + const file = resolver.getExternalModuleFileFromDeclaration(declaration); if (!file || isDeclarationFile(file)) { return undefined; } @@ -355,7 +355,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else { forEach(host.getSourceFiles(), sourceFile => { if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { - let jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, sourceFile); } }); @@ -616,7 +616,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(jsFilePath, root); } - + if (root) { // Do not call emit directly. It does not set the currentSourceFile. emitSourceFile(root); @@ -7372,7 +7372,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (emitRelativePathAsModuleName) { - let name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); + const name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); if (name) { text = `"${name}"`; } @@ -7422,7 +7422,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalModuleName = getExternalModuleNameText(importNode); if (emitRelativePathAsModuleName) { - let name = getExternalModuleNameFromDeclaration(host, resolver, importNode); + const name = getExternalModuleNameFromDeclaration(host, resolver, importNode); if (name) { externalModuleName = `"${name}"`; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a9aadec16b3..17d780df574 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1805,8 +1805,8 @@ namespace ts { * Resolves a local path to a path which is absolute to the base of the emit */ export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string { - let dir = host.getCurrentDirectory(); - let relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); + const dir = host.getCurrentDirectory(); + const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); return removeFileExtension(relativePath); } From d294524861e9486c6f5d9c91a0557269206598e3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 13:27:08 -0800 Subject: [PATCH 111/140] Accepted baselines. --- ...teralTypesWithTemplateStrings01.errors.txt | 18 +++++++++++++++++ ...stringLiteralTypesWithTemplateStrings01.js | 20 +++++++++++++++++++ ...teralTypesWithTemplateStrings02.errors.txt | 13 ++++++++++++ ...stringLiteralTypesWithTemplateStrings02.js | 14 +++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.js create mode 100644 tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.js diff --git a/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.errors.txt b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.errors.txt new file mode 100644 index 00000000000..3851a0b10ef --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(2,5): error TS2322: Type 'string' is not assignable to type '"ABC"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(3,5): error TS2322: Type 'string' is not assignable to type '"DE\nF"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(6,5): error TS2322: Type 'string' is not assignable to type '"JK`L"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts (3 errors) ==== + + let ABC: "ABC" = `ABC`; + ~~~ +!!! error TS2322: Type 'string' is not assignable to type '"ABC"'. + let DE_NEWLINE_F: "DE\nF" = `DE + ~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"DE\nF"'. + F`; + let G_QUOTE_HI: 'G"HI'; + let JK_BACKTICK_L: "JK`L" = `JK\`L`; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"JK`L"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.js b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.js new file mode 100644 index 00000000000..8f548afc7bf --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings01.js @@ -0,0 +1,20 @@ +//// [stringLiteralTypesWithTemplateStrings01.ts] + +let ABC: "ABC" = `ABC`; +let DE_NEWLINE_F: "DE\nF" = `DE +F`; +let G_QUOTE_HI: 'G"HI'; +let JK_BACKTICK_L: "JK`L" = `JK\`L`; + +//// [stringLiteralTypesWithTemplateStrings01.js] +var ABC = "ABC"; +var DE_NEWLINE_F = "DE\nF"; +var G_QUOTE_HI; +var JK_BACKTICK_L = "JK`L"; + + +//// [stringLiteralTypesWithTemplateStrings01.d.ts] +declare let ABC: "ABC"; +declare let DE_NEWLINE_F: "DE\nF"; +declare let G_QUOTE_HI: 'G"HI'; +declare let JK_BACKTICK_L: "JK`L"; diff --git a/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.errors.txt new file mode 100644 index 00000000000..803e4f5cb24 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts(2,5): error TS2322: Type 'string' is not assignable to type '"AB\r\nC"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts(4,5): error TS2322: Type 'string' is not assignable to type '"DE\nF"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts (2 errors) ==== + + let abc: "AB\r\nC" = `AB + ~~~ +!!! error TS2322: Type 'string' is not assignable to type '"AB\r\nC"'. + C`; + let de_NEWLINE_f: "DE\nF" = `DE${"\n"}F`; + ~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"DE\nF"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.js b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.js new file mode 100644 index 00000000000..f5d9045921a --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesWithTemplateStrings02.js @@ -0,0 +1,14 @@ +//// [stringLiteralTypesWithTemplateStrings02.ts] + +let abc: "AB\r\nC" = `AB +C`; +let de_NEWLINE_f: "DE\nF" = `DE${"\n"}F`; + +//// [stringLiteralTypesWithTemplateStrings02.js] +var abc = "AB\nC"; +var de_NEWLINE_f = "DE" + "\n" + "F"; + + +//// [stringLiteralTypesWithTemplateStrings02.d.ts] +declare let abc: "AB\r\nC"; +declare let de_NEWLINE_f: "DE\nF"; From ea4e21d96914783c66563850eda52e0aafb7fb9b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 13:27:19 -0800 Subject: [PATCH 112/140] Fixed comments. --- src/compiler/checker.ts | 2 -- src/compiler/types.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e0e9a6e620f..c3792c85dd6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10401,8 +10401,6 @@ namespace ts { } function checkStringLiteralExpression(node: StringLiteral): Type { - // TODO (drosen): Do we want to apply the same approach to no-sub template literals? - const contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { return getStringLiteralType(node); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f536a1e4693..d3cf86fed12 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -701,7 +701,7 @@ namespace ts { } // Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is - // because string literals can appear in the type annotation of a parameter node. + // because string literals can appear in type annotations as well. export interface StringLiteral extends LiteralExpression, TypeNode { _stringLiteralBrand: any; } From 6f08e89455073b07f36f764ceaa21a9010d74f94 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 9 Nov 2015 13:34:30 -0800 Subject: [PATCH 113/140] use modulekind to check if initializer for shorthand property assignment should be emitted --- src/compiler/emitter.ts | 2 +- ...ndPropertyAssignmentInES6Module.errors.txt | 23 +++++++++++++++++++ .../shorthandPropertyAssignmentInES6Module.js | 23 +++++++++++++++++++ .../shorthandPropertyAssignmentInES6Module.ts | 14 +++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt create mode 100644 tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js create mode 100644 tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index cb4cd3b3803..0d57bd1a6a7 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2461,7 +2461,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (languageVersion < ScriptTarget.ES6 || isNamespaceExportReference(node.name)) { + if (modulekind !== ModuleKind.ES6 || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); diff --git a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt new file mode 100644 index 00000000000..6befffeee74 --- /dev/null +++ b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt @@ -0,0 +1,23 @@ +tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo2'. +tests/cases/compiler/test.ts(6,1): error TS2304: Cannot find name 'console'. +tests/cases/compiler/test.ts(7,1): error TS2304: Cannot find name 'console'. + + +==== tests/cases/compiler/foo1.ts (0 errors) ==== + + export var x = 1; + +==== tests/cases/compiler/test.ts (3 errors) ==== + import {x} from './foo1'; + import {foo} from './foo2'; + ~~~~~~~~ +!!! error TS2307: Cannot find module './foo2'. + + const test = { x, foo }; + + console.log(x); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + console.log(foo); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js new file mode 100644 index 00000000000..2865f244fc8 --- /dev/null +++ b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts] //// + +//// [foo1.ts] + +export var x = 1; + +//// [test.ts] +import {x} from './foo1'; +import {foo} from './foo2'; + +const test = { x, foo }; + +console.log(x); +console.log(foo); + +//// [foo1.js] +exports.x = 1; +//// [test.js] +var foo1_1 = require('./foo1'); +var foo2_1 = require('./foo2'); +const test = { x: foo1_1.x, foo: foo2_1.foo }; +console.log(foo1_1.x); +console.log(foo2_1.foo); diff --git a/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts b/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts new file mode 100644 index 00000000000..50e2d2cf99c --- /dev/null +++ b/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts @@ -0,0 +1,14 @@ +// @target: ES6 +// @module: commonjs + +// @filename: foo1.ts +export var x = 1; + +// @filename: test.ts +import {x} from './foo1'; +import {foo} from './foo2'; + +const test = { x, foo }; + +console.log(x); +console.log(foo); \ No newline at end of file From fe770bdd7591574ce092c7fb753a3c1ef74f5362 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 9 Nov 2015 13:56:18 -0800 Subject: [PATCH 114/140] addressed PR feedback --- ...ndPropertyAssignmentInES6Module.errors.txt | 26 ++++++++----------- .../shorthandPropertyAssignmentInES6Module.js | 24 +++++++++-------- .../shorthandPropertyAssignmentInES6Module.ts | 12 +++++---- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt index 6befffeee74..35fc45421c4 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt +++ b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.errors.txt @@ -1,23 +1,19 @@ -tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo2'. -tests/cases/compiler/test.ts(6,1): error TS2304: Cannot find name 'console'. -tests/cases/compiler/test.ts(7,1): error TS2304: Cannot find name 'console'. +tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './missingModule'. -==== tests/cases/compiler/foo1.ts (0 errors) ==== +==== tests/cases/compiler/existingModule.ts (0 errors) ==== export var x = 1; -==== tests/cases/compiler/test.ts (3 errors) ==== - import {x} from './foo1'; - import {foo} from './foo2'; - ~~~~~~~~ -!!! error TS2307: Cannot find module './foo2'. +==== tests/cases/compiler/test.ts (1 errors) ==== + import {x} from './existingModule'; + import {foo} from './missingModule'; + ~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './missingModule'. + + declare function use(a: any): void; const test = { x, foo }; - console.log(x); - ~~~~~~~ -!!! error TS2304: Cannot find name 'console'. - console.log(foo); - ~~~~~~~ -!!! error TS2304: Cannot find name 'console'. \ No newline at end of file + use(x); + use(foo); \ No newline at end of file diff --git a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js index 2865f244fc8..1cb7fc677cd 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js +++ b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js @@ -1,23 +1,25 @@ //// [tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts] //// -//// [foo1.ts] +//// [existingModule.ts] export var x = 1; //// [test.ts] -import {x} from './foo1'; -import {foo} from './foo2'; +import {x} from './existingModule'; +import {foo} from './missingModule'; + +declare function use(a: any): void; const test = { x, foo }; -console.log(x); -console.log(foo); +use(x); +use(foo); -//// [foo1.js] +//// [existingModule.js] exports.x = 1; //// [test.js] -var foo1_1 = require('./foo1'); -var foo2_1 = require('./foo2'); -const test = { x: foo1_1.x, foo: foo2_1.foo }; -console.log(foo1_1.x); -console.log(foo2_1.foo); +var existingModule_1 = require('./existingModule'); +var missingModule_1 = require('./missingModule'); +const test = { x: existingModule_1.x, foo: missingModule_1.foo }; +use(existingModule_1.x); +use(missingModule_1.foo); diff --git a/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts b/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts index 50e2d2cf99c..8b08fd64e3e 100644 --- a/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts +++ b/tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts @@ -1,14 +1,16 @@ // @target: ES6 // @module: commonjs -// @filename: foo1.ts +// @filename: existingModule.ts export var x = 1; // @filename: test.ts -import {x} from './foo1'; -import {foo} from './foo2'; +import {x} from './existingModule'; +import {foo} from './missingModule'; + +declare function use(a: any): void; const test = { x, foo }; -console.log(x); -console.log(foo); \ No newline at end of file +use(x); +use(foo); \ No newline at end of file From 8a959ead4cab5a943d25d5240d8489e695ddf67e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 14:34:07 -0800 Subject: [PATCH 115/140] Removed no-default-lib comment from test case. --- tests/cases/compiler/typeCheckTypeArgument.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cases/compiler/typeCheckTypeArgument.ts b/tests/cases/compiler/typeCheckTypeArgument.ts index ea125f62c07..1647f40dafb 100644 --- a/tests/cases/compiler/typeCheckTypeArgument.ts +++ b/tests/cases/compiler/typeCheckTypeArgument.ts @@ -1,4 +1,3 @@ -/// var f: () => void; From cece4411ca7169a1cbdbe63cb6ed747f69c03b2c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 14:40:57 -0800 Subject: [PATCH 116/140] Get rid of the concept of 'isDefaultLib'. --- src/compiler/checker.ts | 6 +----- src/compiler/program.ts | 1 - src/compiler/types.ts | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9b0c5d3468c..c302d71025c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14059,13 +14059,9 @@ namespace ts { // Check whether the file has declared it is the default lib, // and whether the user has specifically chosen to avoid checking it. if (compilerOptions.skipDefaultLibCheck) { - if (node.isDefaultLib) { - return; - } - // If the user specified '--noLib' and a file has a '/// ', // then we should treat that file as a default lib. - if (compilerOptions.noLib && node.hasNoDefaultLib) { + if (node.hasNoDefaultLib) { return; } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 4822a86b527..a4fce102c67 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -835,7 +835,6 @@ namespace ts { processImportedModules(file, basePath); if (isDefaultLib) { - file.isDefaultLib = true; files.unshift(file); } else { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f536a1e4693..d10010bc818 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1285,7 +1285,6 @@ namespace ts { // The first node that causes this file to be an external module /* @internal */ externalModuleIndicator: Node; - /* @internal */ isDefaultLib: boolean; /* @internal */ identifiers: Map; /* @internal */ nodeCount: number; /* @internal */ identifierCount: number; From fb192e2464681a73e1b2a33e07dd11622681fe94 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 9 Nov 2015 14:41:44 -0800 Subject: [PATCH 117/140] Accepted baselines. --- .../typeCheckTypeArgument.errors.txt | 29 ++++--------------- .../reference/typeCheckTypeArgument.js | 2 -- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/tests/baselines/reference/typeCheckTypeArgument.errors.txt b/tests/baselines/reference/typeCheckTypeArgument.errors.txt index bf3e8bfdb9b..1452a2d4deb 100644 --- a/tests/baselines/reference/typeCheckTypeArgument.errors.txt +++ b/tests/baselines/reference/typeCheckTypeArgument.errors.txt @@ -1,29 +1,12 @@ -error TS2318: Cannot find global type 'Array'. -error TS2318: Cannot find global type 'Boolean'. -error TS2318: Cannot find global type 'Function'. -error TS2318: Cannot find global type 'IArguments'. -error TS2318: Cannot find global type 'Number'. -error TS2318: Cannot find global type 'Object'. -error TS2318: Cannot find global type 'RegExp'. -error TS2318: Cannot find global type 'String'. -tests/cases/compiler/typeCheckTypeArgument.ts(3,19): error TS2304: Cannot find name 'UNKNOWN'. -tests/cases/compiler/typeCheckTypeArgument.ts(5,26): error TS2304: Cannot find name 'UNKNOWN'. -tests/cases/compiler/typeCheckTypeArgument.ts(7,21): error TS2304: Cannot find name 'UNKNOWN'. -tests/cases/compiler/typeCheckTypeArgument.ts(9,24): error TS2304: Cannot find name 'UNKNOWN'. -tests/cases/compiler/typeCheckTypeArgument.ts(12,22): error TS2304: Cannot find name 'UNKNOWN'. -tests/cases/compiler/typeCheckTypeArgument.ts(15,13): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(2,19): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(4,26): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(6,21): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(8,24): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(11,22): error TS2304: Cannot find name 'UNKNOWN'. +tests/cases/compiler/typeCheckTypeArgument.ts(14,13): error TS2304: Cannot find name 'UNKNOWN'. -!!! error TS2318: Cannot find global type 'Array'. -!!! error TS2318: Cannot find global type 'Boolean'. -!!! error TS2318: Cannot find global type 'Function'. -!!! error TS2318: Cannot find global type 'IArguments'. -!!! error TS2318: Cannot find global type 'Number'. -!!! error TS2318: Cannot find global type 'Object'. -!!! error TS2318: Cannot find global type 'RegExp'. -!!! error TS2318: Cannot find global type 'String'. ==== tests/cases/compiler/typeCheckTypeArgument.ts (6 errors) ==== - /// var f: () => void; ~~~~~~~ diff --git a/tests/baselines/reference/typeCheckTypeArgument.js b/tests/baselines/reference/typeCheckTypeArgument.js index bec33393f92..633eb75ed91 100644 --- a/tests/baselines/reference/typeCheckTypeArgument.js +++ b/tests/baselines/reference/typeCheckTypeArgument.js @@ -1,5 +1,4 @@ //// [typeCheckTypeArgument.ts] -/// var f: () => void; @@ -16,7 +15,6 @@ class Foo2 { ((a) => { }); //// [typeCheckTypeArgument.js] -/// var f; var Foo = (function () { function Foo() { From eba94b4e8540bcf2c21c37ec68804bec8b226551 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Nov 2015 14:53:21 -0800 Subject: [PATCH 118/140] Address comments --- src/compiler/checker.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2494009333b..adf23cc2ae7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2916,13 +2916,14 @@ namespace ts { } function baseTypeHasUnappliedOuterTypeParameters(type: Type): boolean { - const originalBaseType = type; - const originalTypeReference = type; - if (originalBaseType.outerTypeParameters) { - // an unapplied type type parameter is one + const outerTypeParameters = (type).outerTypeParameters; + const typeArguments = (type).typeArguments; + if (outerTypeParameters) { + // an unapplied type parameter is one // whose argument symbol is still the same as the parameter symbol - for (let i = 0; i < originalBaseType.outerTypeParameters.length; i++) { - if (originalBaseType.outerTypeParameters[i].symbol === originalTypeReference.typeArguments[i].symbol) { + const numParameters = outerTypeParameters.length; + for (let i = 0; i < numParameters; i++) { + if (outerTypeParameters[i].symbol === typeArguments[i].symbol) { return true; } } From cfc6ed2adb4bc51f0eac52060a2ccc0d57a3e951 Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Tue, 10 Nov 2015 18:33:19 +1100 Subject: [PATCH 119/140] tsx : support tags in language service semantic tokenizer --- src/services/services.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/services/services.ts b/src/services/services.ts index 113a52459e9..ad8481e82cb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1611,6 +1611,9 @@ namespace ts { public static typeAliasName = "type alias name"; public static parameterName = "parameter name"; public static docCommentTagName = "doc comment tag name"; + public static jsxOpenTagName = "jsx open tag name"; + public static jsxCloseTagName = "jsx close tag name"; + public static jsxSelfClosingTagName = "jsx self closing tag name"; } export const enum ClassificationType { @@ -1632,6 +1635,9 @@ namespace ts { typeAliasName = 16, parameterName = 17, docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, } /// Language Service @@ -6619,6 +6625,9 @@ namespace ts { case ClassificationType.typeAliasName: return ClassificationTypeNames.typeAliasName; case ClassificationType.parameterName: return ClassificationTypeNames.parameterName; case ClassificationType.docCommentTagName: return ClassificationTypeNames.docCommentTagName; + case ClassificationType.jsxOpenTagName: return ClassificationTypeNames.jsxOpenTagName; + case ClassificationType.jsxCloseTagName: return ClassificationTypeNames.jsxCloseTagName; + case ClassificationType.jsxSelfClosingTagName: return ClassificationTypeNames.jsxSelfClosingTagName; } } @@ -6931,6 +6940,23 @@ namespace ts { } return; + case SyntaxKind.JsxOpeningElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxOpenTagName; + } + return; + + case SyntaxKind.JsxClosingElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxCloseTagName; + } + return; + + case SyntaxKind.JsxSelfClosingElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxSelfClosingTagName; + } + return; } } From 64e4cc306cae1444a0bf545aa641c7ea5208cf32 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Nov 2015 08:55:24 -0800 Subject: [PATCH 120/140] Improve efficiency and naming The unapplied outer parameters check now checks only whether the last outer parameter is unapplied, and its name is now positive -- are-all-applied vs are-some-unapplied. --- src/compiler/checker.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index adf23cc2ae7..37c70731fca 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2878,7 +2878,7 @@ namespace ts { let baseType: Type; const originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class && - !baseTypeHasUnappliedOuterTypeParameters(originalBaseType)) { + areAllOuterTypeParametersApplied(originalBaseType)) { // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the // class and all return the instance type of the class. There is no need for further checks and we can apply the // type arguments in the same manner as a type reference to get the same error reporting experience. @@ -2915,20 +2915,16 @@ namespace ts { } } - function baseTypeHasUnappliedOuterTypeParameters(type: Type): boolean { + function areAllOuterTypeParametersApplied(type: Type): boolean { const outerTypeParameters = (type).outerTypeParameters; - const typeArguments = (type).typeArguments; if (outerTypeParameters) { // an unapplied type parameter is one // whose argument symbol is still the same as the parameter symbol - const numParameters = outerTypeParameters.length; - for (let i = 0; i < numParameters; i++) { - if (outerTypeParameters[i].symbol === typeArguments[i].symbol) { - return true; - } - } + const last = outerTypeParameters.length - 1; + const typeArguments = (type).typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; } - return false; + return true; } function resolveBaseTypesOfInterface(type: InterfaceType): void { From 48e985d72f12af17d39b47140491a8b52ccb29df Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Nov 2015 11:35:03 -0800 Subject: [PATCH 121/140] Prevent resolveName from ignoring default exports --- src/compiler/checker.ts | 42 ++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 706ed1c65a3..05ced970793 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -487,8 +487,9 @@ namespace ts { (location.kind === SyntaxKind.ModuleDeclaration && (location).name.kind === SyntaxKind.StringLiteral)) { // It's an external module. Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope. Therefore, - // if the name we find is purely an export specifier, it is not actually considered in scope. + // yet we never want to treat an export specifier as putting a member in scope, except 'default'. + // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope, + // unless it is 'default'. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol // on an export specifier is that it might find the export specifier itself, and try to @@ -497,15 +498,16 @@ namespace ts { // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. + const isLocalSymbolForExportDefault = doesNameResolveToLocalSymbolForExportDefault(moduleExports, meaning, name); if (hasProperty(moduleExports, name) && moduleExports[name].flags === SymbolFlags.Alias && + !isLocalSymbolForExportDefault && getDeclarationOfKind(moduleExports[name], SyntaxKind.ExportSpecifier)) { break; } - result = moduleExports["default"]; - const localSymbol = getLocalSymbolForExportDefault(result); - if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { + if (isLocalSymbolForExportDefault) { + result = moduleExports["default"]; break loop; } result = undefined; @@ -674,6 +676,12 @@ namespace ts { return result; } + function doesNameResolveToLocalSymbolForExportDefault(exports: SymbolTable, meaning: SymbolFlags, name: string): boolean { + const defaultExport = exports["default"]; + const localSymbol = getLocalSymbolForExportDefault(defaultExport); + return defaultExport && (defaultExport.flags & meaning) && localSymbol && localSymbol.name === name; + } + function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0); // Block-scoped variables cannot be used before their definition @@ -4124,12 +4132,12 @@ namespace ts { // We only support expressions that are simple qualified names. For other expressions this produces undefined. const typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (node).typeName : isSupportedExpressionWithTypeArguments(node) ? (node).expression : - undefined; + undefined; const symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol; const type = symbol === unknownSymbol ? unknownType : symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the // type reference in checkTypeReferenceOrExpressionWithTypeArguments. links.resolvedSymbol = symbol; @@ -11309,7 +11317,7 @@ namespace ts { // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract) ) { + !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract)) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } @@ -14221,8 +14229,8 @@ namespace ts { if (className) { copySymbol(location.symbol, meaning); } - // fall through; this fall-through is necessary because we would like to handle - // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration + // fall through; this fall-through is necessary because we would like to handle + // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: // If we didn't come from static member of class or interface, @@ -14378,8 +14386,8 @@ namespace ts { return resolveEntityName(entityName, meaning); } else if ((entityName.parent.kind === SyntaxKind.JsxOpeningElement) || - (entityName.parent.kind === SyntaxKind.JsxSelfClosingElement) || - (entityName.parent.kind === SyntaxKind.JsxClosingElement)) { + (entityName.parent.kind === SyntaxKind.JsxSelfClosingElement) || + (entityName.parent.kind === SyntaxKind.JsxClosingElement)) { return getJsxElementTagSymbol(entityName.parent); } else if (isExpression(entityName)) { @@ -14446,8 +14454,8 @@ namespace ts { : getSymbolOfPartOfRightHandSideOfImportEquals(node); } else if (node.parent.kind === SyntaxKind.BindingElement && - node.parent.parent.kind === SyntaxKind.ObjectBindingPattern && - node === (node.parent).propertyName) { + node.parent.parent.kind === SyntaxKind.ObjectBindingPattern && + node === (node.parent).propertyName) { const typeOfPattern = getTypeOfNode(node.parent.parent); const propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (node).text); @@ -14484,7 +14492,7 @@ namespace ts { (node.parent).moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } - // Fall through + // Fall through case SyntaxKind.NumericLiteral: // index access @@ -14680,7 +14688,7 @@ namespace ts { if (links.isNestedRedeclaration === undefined) { const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + !!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); } return links.isNestedRedeclaration; } From e30a01db0fb06dc93177f194cfd919ca4d4baec3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Nov 2015 11:44:56 -0800 Subject: [PATCH 122/140] Add test case and accept baseline --- .../reference/reExportDefaultExport.js | 27 +++++++++++++++++++ .../reference/reExportDefaultExport.symbols | 22 +++++++++++++++ .../reference/reExportDefaultExport.types | 24 +++++++++++++++++ .../es6/modules/reExportDefaultExport.ts | 15 +++++++++++ 4 files changed, 88 insertions(+) create mode 100644 tests/baselines/reference/reExportDefaultExport.js create mode 100644 tests/baselines/reference/reExportDefaultExport.symbols create mode 100644 tests/baselines/reference/reExportDefaultExport.types create mode 100644 tests/cases/conformance/es6/modules/reExportDefaultExport.ts diff --git a/tests/baselines/reference/reExportDefaultExport.js b/tests/baselines/reference/reExportDefaultExport.js new file mode 100644 index 00000000000..dbe3dfdbbae --- /dev/null +++ b/tests/baselines/reference/reExportDefaultExport.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/es6/modules/reExportDefaultExport.ts] //// + +//// [m1.ts] + +export default function f() { +} +export {f}; + + +//// [m2.ts] +import foo from "./m1"; +import {f} from "./m1"; + +f(); +foo(); + +//// [m1.js] +function f() { +} +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = f; +exports.f = f; +//// [m2.js] +var m1_1 = require("./m1"); +var m1_2 = require("./m1"); +m1_2.f(); +m1_1.default(); diff --git a/tests/baselines/reference/reExportDefaultExport.symbols b/tests/baselines/reference/reExportDefaultExport.symbols new file mode 100644 index 00000000000..cd0d6e493c9 --- /dev/null +++ b/tests/baselines/reference/reExportDefaultExport.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +export default function f() { +>f : Symbol(f, Decl(m1.ts, 0, 0)) +} +export {f}; +>f : Symbol(f, Decl(m1.ts, 3, 8)) + + +=== tests/cases/conformance/es6/modules/m2.ts === +import foo from "./m1"; +>foo : Symbol(foo, Decl(m2.ts, 0, 6)) + +import {f} from "./m1"; +>f : Symbol(f, Decl(m2.ts, 1, 8)) + +f(); +>f : Symbol(f, Decl(m2.ts, 1, 8)) + +foo(); +>foo : Symbol(foo, Decl(m2.ts, 0, 6)) + diff --git a/tests/baselines/reference/reExportDefaultExport.types b/tests/baselines/reference/reExportDefaultExport.types new file mode 100644 index 00000000000..f775571ac2c --- /dev/null +++ b/tests/baselines/reference/reExportDefaultExport.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +export default function f() { +>f : () => void +} +export {f}; +>f : () => void + + +=== tests/cases/conformance/es6/modules/m2.ts === +import foo from "./m1"; +>foo : () => void + +import {f} from "./m1"; +>f : () => void + +f(); +>f() : void +>f : () => void + +foo(); +>foo() : void +>foo : () => void + diff --git a/tests/cases/conformance/es6/modules/reExportDefaultExport.ts b/tests/cases/conformance/es6/modules/reExportDefaultExport.ts new file mode 100644 index 00000000000..730435fd4ee --- /dev/null +++ b/tests/cases/conformance/es6/modules/reExportDefaultExport.ts @@ -0,0 +1,15 @@ +// @module: commonjs +// @target: ES5 + +// @filename: m1.ts +export default function f() { +} +export {f}; + + +// @filename: m2.ts +import foo from "./m1"; +import {f} from "./m1"; + +f(); +foo(); \ No newline at end of file From 694c714cf594f714ca87069021a94d7d8dd75cb4 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 11:56:32 -0800 Subject: [PATCH 123/140] Added test for parenthesized string literals. --- .../stringLiteralTypesAndParenthesizedExpressions01.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts new file mode 100644 index 00000000000..7910c0e16b7 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts @@ -0,0 +1,8 @@ +// @declaration: true + +declare function myRandBool(): boolean; + +let a: "foo" = ("foo"); +let b: "foo" | "bar" = ("foo"); +let c: "foo" = (myRandBool ? "foo" : ("foo")); +let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); From abc230195c5d708015383967a27a4aaed2872872 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 12:12:14 -0800 Subject: [PATCH 124/140] Add handling for json parse errors --- src/compiler/tsc.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 79158cf4e9d..474d7212070 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -349,6 +349,11 @@ namespace ts { const result = parseConfigFileTextToJson(configFileName, cachedConfigFileText); const configObject = result.config; + if (!configObject) { + reportDiagnostics([result.error], /* compilerHost */ undefined); + sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + return; + } const configParseResult = parseJsonConfigFileContent(configObject, sys, getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors, /* compilerHost */ undefined); From 38127457372b917d49d8c5ee9955ac8e1d88db42 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 12:59:39 -0800 Subject: [PATCH 125/140] Added other tests for string literal types. --- .../stringLiteralTypesAndLogicalOrExpressions01.ts | 9 +++++++++ .../types/stringLiteral/stringLiteralTypesOverloads04.ts | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts new file mode 100644 index 00000000000..8a257ae1caf --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts @@ -0,0 +1,9 @@ +// @declaration: true + +declare function myRandBool(): boolean; + +let a: "foo" = "foo"; +let b = a || "foo"; +let c: "foo" = b; +let d = b || "bar"; +let e: "foo" | "bar" = d; diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts new file mode 100644 index 00000000000..8bc2a0c94b8 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts @@ -0,0 +1,8 @@ +// @declaration: true + +declare function f(x: (p: "foo" | "bar") => "foo"); + +f(y => { + let z = y = "foo"; + return z; +}) \ No newline at end of file From f80a6c6e869b9f84bee99bdfd20594423f56d263 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 11:56:50 -0800 Subject: [PATCH 126/140] Accepted baselines. --- ...ngLiteralTypesAndLogicalOrExpressions01.js | 26 +++++++++++++++++ ...eralTypesAndLogicalOrExpressions01.symbols | 24 +++++++++++++++ ...iteralTypesAndLogicalOrExpressions01.types | 29 +++++++++++++++++++ ...esAndParenthesizedExpressions01.errors.txt | 17 +++++++++++ ...teralTypesAndParenthesizedExpressions01.js | 23 +++++++++++++++ .../stringLiteralTypesOverloads04.js | 18 ++++++++++++ .../stringLiteralTypesOverloads04.symbols | 19 ++++++++++++ .../stringLiteralTypesOverloads04.types | 23 +++++++++++++++ 8 files changed, 179 insertions(+) create mode 100644 tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.js create mode 100644 tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.types create mode 100644 tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.js create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads04.js create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads04.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesOverloads04.types diff --git a/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.js b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.js new file mode 100644 index 00000000000..479256b18b7 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.js @@ -0,0 +1,26 @@ +//// [stringLiteralTypesAndLogicalOrExpressions01.ts] + +declare function myRandBool(): boolean; + +let a: "foo" = "foo"; +let b = a || "foo"; +let c: "foo" = b; +let d = b || "bar"; +let e: "foo" | "bar" = d; + + +//// [stringLiteralTypesAndLogicalOrExpressions01.js] +var a = "foo"; +var b = a || "foo"; +var c = b; +var d = b || "bar"; +var e = d; + + +//// [stringLiteralTypesAndLogicalOrExpressions01.d.ts] +declare function myRandBool(): boolean; +declare let a: "foo"; +declare let b: "foo"; +declare let c: "foo"; +declare let d: "foo" | "bar"; +declare let e: "foo" | "bar"; diff --git a/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.symbols b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.symbols new file mode 100644 index 00000000000..2a9f28e85a5 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts === + +declare function myRandBool(): boolean; +>myRandBool : Symbol(myRandBool, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 0, 0)) + +let a: "foo" = "foo"; +>a : Symbol(a, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 3, 3)) + +let b = a || "foo"; +>b : Symbol(b, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 4, 3)) +>a : Symbol(a, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 3, 3)) + +let c: "foo" = b; +>c : Symbol(c, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 5, 3)) +>b : Symbol(b, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 4, 3)) + +let d = b || "bar"; +>d : Symbol(d, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 6, 3)) +>b : Symbol(b, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 4, 3)) + +let e: "foo" | "bar" = d; +>e : Symbol(e, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 7, 3)) +>d : Symbol(d, Decl(stringLiteralTypesAndLogicalOrExpressions01.ts, 6, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.types b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.types new file mode 100644 index 00000000000..ddc79b81857 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndLogicalOrExpressions01.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts === + +declare function myRandBool(): boolean; +>myRandBool : () => boolean + +let a: "foo" = "foo"; +>a : "foo" +>"foo" : "foo" + +let b = a || "foo"; +>b : "foo" +>a || "foo" : "foo" +>a : "foo" +>"foo" : "foo" + +let c: "foo" = b; +>c : "foo" +>b : "foo" + +let d = b || "bar"; +>d : "foo" | "bar" +>b || "bar" : "foo" | "bar" +>b : "foo" +>"bar" : "bar" + +let e: "foo" | "bar" = d; +>e : "foo" | "bar" +>d : "foo" | "bar" + diff --git a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt new file mode 100644 index 00000000000..93d8a213d0f --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts(4,5): error TS2322: Type 'string' is not assignable to type '"foo"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts(6,5): error TS2322: Type 'string' is not assignable to type '"foo"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts (2 errors) ==== + + declare function myRandBool(): boolean; + + let a: "foo" = ("foo"); + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. + let b: "foo" | "bar" = ("foo"); + let c: "foo" = (myRandBool ? "foo" : ("foo")); + ~ +!!! error TS2322: Type 'string' is not assignable to type '"foo"'. + let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); + \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.js b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.js new file mode 100644 index 00000000000..1fe1225c6f4 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.js @@ -0,0 +1,23 @@ +//// [stringLiteralTypesAndParenthesizedExpressions01.ts] + +declare function myRandBool(): boolean; + +let a: "foo" = ("foo"); +let b: "foo" | "bar" = ("foo"); +let c: "foo" = (myRandBool ? "foo" : ("foo")); +let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); + + +//// [stringLiteralTypesAndParenthesizedExpressions01.js] +var a = ("foo"); +var b = ("foo"); +var c = (myRandBool ? "foo" : ("foo")); +var d = (myRandBool ? "foo" : ("bar")); + + +//// [stringLiteralTypesAndParenthesizedExpressions01.d.ts] +declare function myRandBool(): boolean; +declare let a: "foo"; +declare let b: "foo" | "bar"; +declare let c: "foo"; +declare let d: "foo" | "bar"; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads04.js b/tests/baselines/reference/stringLiteralTypesOverloads04.js new file mode 100644 index 00000000000..fd10ac986a9 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads04.js @@ -0,0 +1,18 @@ +//// [stringLiteralTypesOverloads04.ts] + +declare function f(x: (p: "foo" | "bar") => "foo"); + +f(y => { + let z = y = "foo"; + return z; +}) + +//// [stringLiteralTypesOverloads04.js] +f(function (y) { + var z = y = "foo"; + return z; +}); + + +//// [stringLiteralTypesOverloads04.d.ts] +declare function f(x: (p: "foo" | "bar") => "foo"): any; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads04.symbols b/tests/baselines/reference/stringLiteralTypesOverloads04.symbols new file mode 100644 index 00000000000..9f468b8bd95 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads04.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts === + +declare function f(x: (p: "foo" | "bar") => "foo"); +>f : Symbol(f, Decl(stringLiteralTypesOverloads04.ts, 0, 0)) +>x : Symbol(x, Decl(stringLiteralTypesOverloads04.ts, 1, 19)) +>p : Symbol(p, Decl(stringLiteralTypesOverloads04.ts, 1, 23)) + +f(y => { +>f : Symbol(f, Decl(stringLiteralTypesOverloads04.ts, 0, 0)) +>y : Symbol(y, Decl(stringLiteralTypesOverloads04.ts, 3, 2)) + + let z = y = "foo"; +>z : Symbol(z, Decl(stringLiteralTypesOverloads04.ts, 4, 7)) +>y : Symbol(y, Decl(stringLiteralTypesOverloads04.ts, 3, 2)) + + return z; +>z : Symbol(z, Decl(stringLiteralTypesOverloads04.ts, 4, 7)) + +}) diff --git a/tests/baselines/reference/stringLiteralTypesOverloads04.types b/tests/baselines/reference/stringLiteralTypesOverloads04.types new file mode 100644 index 00000000000..32d316494ca --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads04.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads04.ts === + +declare function f(x: (p: "foo" | "bar") => "foo"); +>f : (x: (p: "foo" | "bar") => "foo") => any +>x : (p: "foo" | "bar") => "foo" +>p : "foo" | "bar" + +f(y => { +>f(y => { let z = y = "foo"; return z;}) : any +>f : (x: (p: "foo" | "bar") => "foo") => any +>y => { let z = y = "foo"; return z;} : (y: "foo" | "bar") => "foo" +>y : "foo" | "bar" + + let z = y = "foo"; +>z : "foo" +>y = "foo" : "foo" +>y : "foo" | "bar" +>"foo" : "foo" + + return z; +>z : "foo" + +}) From 58b5d29c5299809605ac8a9c2cb1ac5217f7261f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Nov 2015 13:05:30 -0800 Subject: [PATCH 127/140] Improve comment --- src/compiler/checker.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 37c70731fca..97f274ab74d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2915,11 +2915,13 @@ namespace ts { } } + /** + * An unapplied type parameter has its symbol still the same as the matching argument symbol. + * Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked. + */ function areAllOuterTypeParametersApplied(type: Type): boolean { const outerTypeParameters = (type).outerTypeParameters; if (outerTypeParameters) { - // an unapplied type parameter is one - // whose argument symbol is still the same as the parameter symbol const last = outerTypeParameters.length - 1; const typeArguments = (type).typeArguments; return outerTypeParameters[last].symbol !== typeArguments[last].symbol; From f3d2963ff7a985c827aaf2a882427fe401fe5d29 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Nov 2015 13:13:58 -0800 Subject: [PATCH 128/140] Change back from jsdoc comment. --- src/compiler/checker.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 97f274ab74d..958dcf3e4b9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2915,11 +2915,9 @@ namespace ts { } } - /** - * An unapplied type parameter has its symbol still the same as the matching argument symbol. - * Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked. - */ function areAllOuterTypeParametersApplied(type: Type): boolean { + // An unapplied type parameter has its symbol still the same as the matching argument symbol. + // Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked. const outerTypeParameters = (type).outerTypeParameters; if (outerTypeParameters) { const last = outerTypeParameters.length - 1; From 00130f1a68011ae59fb61e2f70897d48ec100b47 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 13:20:28 -0800 Subject: [PATCH 129/140] Handle when using -p and config file not found --- src/compiler/tsc.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 474d7212070..f560a15dfb9 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -346,6 +346,12 @@ namespace ts { return; } } + if (!cachedConfigFileText) { + const error = createCompilerDiagnostic(Diagnostics.File_0_not_found, configFileName); + reportDiagnostics([error], /* compilerHost */ undefined); + sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + return; + } const result = parseConfigFileTextToJson(configFileName, cachedConfigFileText); const configObject = result.config; From 2a370c9aa7ad5d1d12fb83508f99cd1f08b42d2b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 14:40:19 -0800 Subject: [PATCH 130/140] Added tests for string literal types used as generic constraints. --- ...LiteralTypesAsTypeParameterConstraint01.ts | 19 +++++++++++++++++++ ...LiteralTypesAsTypeParameterConstraint02.ts | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts create mode 100644 tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts new file mode 100644 index 00000000000..53f516f4209 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts @@ -0,0 +1,19 @@ +// @declaration: true + +function foo(f: (x: T) => T) { + return f; +} + +function bar(f: (x: T) => T) { + return f; +} + +let f = foo(x => x); +let fResult = f("foo"); + +let g = foo((x => x)); +let gResult = g("foo"); + +let h = bar(x => x); +let hResult = h("foo"); +hResult = h("bar"); \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts new file mode 100644 index 00000000000..fb3a019402d --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts @@ -0,0 +1,8 @@ +// @declaration: true + +function foo(f: (x: T) => T) { + return f; +} + +let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); +let fResult = f("foo"); \ No newline at end of file From 9d3d49d636e69715c45bcd5d3632531a61874927 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 16:17:28 -0800 Subject: [PATCH 131/140] Only get the apparent type when necessary. --- src/compiler/checker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e0e9a6e620f..4fe04cae13a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6966,7 +6966,7 @@ namespace ts { else if (operator === SyntaxKind.BarBarToken) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. - let type = getApparentTypeOfContextualType(binaryExpression); + let type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); } @@ -7081,7 +7081,7 @@ namespace ts { // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. function getContextualTypeForConditionalOperand(node: Expression): Type { const conditional = node.parent; - return node === conditional.whenTrue || node === conditional.whenFalse ? getApparentTypeOfContextualType(conditional) : undefined; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr: JsxExpression | JsxSpreadAttribute): Type { @@ -7160,7 +7160,7 @@ namespace ts { Debug.assert(parent.parent.kind === SyntaxKind.TemplateExpression); return getContextualTypeForSubstitutionExpression(parent.parent, node); case SyntaxKind.ParenthesizedExpression: - return getApparentTypeOfContextualType(parent); + return getContextualType(parent); case SyntaxKind.JsxExpression: case SyntaxKind.JsxSpreadAttribute: return getContextualTypeForJsxExpression(parent); From ce455dac2b3ce3b0255be7441b2f84a24f9369b1 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 22:43:07 -0800 Subject: [PATCH 132/140] Accepted baselines. --- ...esAndParenthesizedExpressions01.errors.txt | 17 ----- ...TypesAndParenthesizedExpressions01.symbols | 19 +++++ ...alTypesAndParenthesizedExpressions01.types | 33 ++++++++ ...LiteralTypesAsTypeParameterConstraint01.js | 68 +++++++++++++++++ ...alTypesAsTypeParameterConstraint01.symbols | 60 +++++++++++++++ ...eralTypesAsTypeParameterConstraint01.types | 76 +++++++++++++++++++ ...ypesAsTypeParameterConstraint02.errors.txt | 15 ++++ ...LiteralTypesAsTypeParameterConstraint02.js | 21 +++++ 8 files changed, 292 insertions(+), 17 deletions(-) delete mode 100644 tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.types create mode 100644 tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js create mode 100644 tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.symbols create mode 100644 tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.types create mode 100644 tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt create mode 100644 tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js diff --git a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt deleted file mode 100644 index 93d8a213d0f..00000000000 --- a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts(4,5): error TS2322: Type 'string' is not assignable to type '"foo"'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts(6,5): error TS2322: Type 'string' is not assignable to type '"foo"'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts (2 errors) ==== - - declare function myRandBool(): boolean; - - let a: "foo" = ("foo"); - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. - let b: "foo" | "bar" = ("foo"); - let c: "foo" = (myRandBool ? "foo" : ("foo")); - ~ -!!! error TS2322: Type 'string' is not assignable to type '"foo"'. - let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); - \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.symbols b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.symbols new file mode 100644 index 00000000000..2206a5185c1 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts === + +declare function myRandBool(): boolean; +>myRandBool : Symbol(myRandBool, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 0, 0)) + +let a: "foo" = ("foo"); +>a : Symbol(a, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 3, 3)) + +let b: "foo" | "bar" = ("foo"); +>b : Symbol(b, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 4, 3)) + +let c: "foo" = (myRandBool ? "foo" : ("foo")); +>c : Symbol(c, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 5, 3)) +>myRandBool : Symbol(myRandBool, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 0, 0)) + +let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); +>d : Symbol(d, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 6, 3)) +>myRandBool : Symbol(myRandBool, Decl(stringLiteralTypesAndParenthesizedExpressions01.ts, 0, 0)) + diff --git a/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.types b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.types new file mode 100644 index 00000000000..0bb2e1dd3c7 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAndParenthesizedExpressions01.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndParenthesizedExpressions01.ts === + +declare function myRandBool(): boolean; +>myRandBool : () => boolean + +let a: "foo" = ("foo"); +>a : "foo" +>("foo") : "foo" +>"foo" : "foo" + +let b: "foo" | "bar" = ("foo"); +>b : "foo" | "bar" +>("foo") : "foo" +>"foo" : "foo" + +let c: "foo" = (myRandBool ? "foo" : ("foo")); +>c : "foo" +>(myRandBool ? "foo" : ("foo")) : "foo" +>myRandBool ? "foo" : ("foo") : "foo" +>myRandBool : () => boolean +>"foo" : "foo" +>("foo") : "foo" +>"foo" : "foo" + +let d: "foo" | "bar" = (myRandBool ? "foo" : ("bar")); +>d : "foo" | "bar" +>(myRandBool ? "foo" : ("bar")) : "foo" | "bar" +>myRandBool ? "foo" : ("bar") : "foo" | "bar" +>myRandBool : () => boolean +>"foo" : "foo" +>("bar") : "bar" +>"bar" : "bar" + diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js new file mode 100644 index 00000000000..558f6bdf4c2 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js @@ -0,0 +1,68 @@ +//// [stringLiteralTypesAsTypeParameterConstraint01.ts] + +function foo(f: (x: T) => T) { + return f; +} + +function bar(f: (x: T) => T) { + return f; +} + +let f = foo(x => x); +let fResult = f("foo"); + +let g = foo((x => x)); +let gResult = g("foo"); + +let h = bar(x => x); +let hResult = h("foo"); +hResult = h("bar"); + +//// [stringLiteralTypesAsTypeParameterConstraint01.js] +function foo(f) { + return f; +} +function bar(f) { + return f; +} +var f = foo(function (x) { return x; }); +var fResult = f("foo"); +var g = foo((function (x) { return x; })); +var gResult = g("foo"); +var h = bar(function (x) { return x; }); +var hResult = h("foo"); +hResult = h("bar"); + + +//// [stringLiteralTypesAsTypeParameterConstraint01.d.ts] +declare function foo(f: (x: T) => T): (x: T) => T; +declare function bar(f: (x: T) => T): (x: T) => T; +declare let f: (x: "foo") => "foo"; +declare let fResult: "foo"; +declare let g: (x: "foo") => "foo"; +declare let gResult: "foo"; +declare let h: (x: "foo" | "bar") => "foo" | "bar"; +declare let hResult: "foo" | "bar"; + + +//// [DtsFileErrors] + + +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(3,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(5,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts (2 errors) ==== + declare function foo(f: (x: T) => T): (x: T) => T; + declare function bar(f: (x: T) => T): (x: T) => T; + declare let f: (x: "foo") => "foo"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + declare let fResult: "foo"; + declare let g: (x: "foo") => "foo"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + declare let gResult: "foo"; + declare let h: (x: "foo" | "bar") => "foo" | "bar"; + declare let hResult: "foo" | "bar"; + \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.symbols b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.symbols new file mode 100644 index 00000000000..fd633b6e4d9 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.symbols @@ -0,0 +1,60 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts === + +function foo(f: (x: T) => T) { +>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 0, 0)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 13)) +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 30)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 34)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 13)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 13)) + + return f; +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 1, 30)) +} + +function bar(f: (x: T) => T) { +>bar : Symbol(bar, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 3, 1)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 13)) +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 38)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 42)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 13)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 13)) + + return f; +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 5, 38)) +} + +let f = foo(x => x); +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 9, 3)) +>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 0, 0)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 9, 12)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 9, 12)) + +let fResult = f("foo"); +>fResult : Symbol(fResult, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 10, 3)) +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 9, 3)) + +let g = foo((x => x)); +>g : Symbol(g, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 12, 3)) +>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 0, 0)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 12, 13)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 12, 13)) + +let gResult = g("foo"); +>gResult : Symbol(gResult, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 13, 3)) +>g : Symbol(g, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 12, 3)) + +let h = bar(x => x); +>h : Symbol(h, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 15, 3)) +>bar : Symbol(bar, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 3, 1)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 15, 12)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 15, 12)) + +let hResult = h("foo"); +>hResult : Symbol(hResult, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 16, 3)) +>h : Symbol(h, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 15, 3)) + +hResult = h("bar"); +>hResult : Symbol(hResult, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 16, 3)) +>h : Symbol(h, Decl(stringLiteralTypesAsTypeParameterConstraint01.ts, 15, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.types b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.types new file mode 100644 index 00000000000..fe9163fc819 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts === + +function foo(f: (x: T) => T) { +>foo : (f: (x: T) => T) => (x: T) => T +>T : T +>f : (x: T) => T +>x : T +>T : T +>T : T + + return f; +>f : (x: T) => T +} + +function bar(f: (x: T) => T) { +>bar : (f: (x: T) => T) => (x: T) => T +>T : T +>f : (x: T) => T +>x : T +>T : T +>T : T + + return f; +>f : (x: T) => T +} + +let f = foo(x => x); +>f : (x: "foo") => "foo" +>foo(x => x) : (x: "foo") => "foo" +>foo : (f: (x: T) => T) => (x: T) => T +>x => x : (x: "foo") => "foo" +>x : "foo" +>x : "foo" + +let fResult = f("foo"); +>fResult : "foo" +>f("foo") : "foo" +>f : (x: "foo") => "foo" +>"foo" : "foo" + +let g = foo((x => x)); +>g : (x: "foo") => "foo" +>foo((x => x)) : (x: "foo") => "foo" +>foo : (f: (x: T) => T) => (x: T) => T +>(x => x) : (x: "foo") => "foo" +>x => x : (x: "foo") => "foo" +>x : "foo" +>x : "foo" + +let gResult = g("foo"); +>gResult : "foo" +>g("foo") : "foo" +>g : (x: "foo") => "foo" +>"foo" : "foo" + +let h = bar(x => x); +>h : (x: "foo" | "bar") => "foo" | "bar" +>bar(x => x) : (x: "foo" | "bar") => "foo" | "bar" +>bar : (f: (x: T) => T) => (x: T) => T +>x => x : (x: "foo" | "bar") => "foo" | "bar" +>x : "foo" | "bar" +>x : "foo" | "bar" + +let hResult = h("foo"); +>hResult : "foo" | "bar" +>h("foo") : "foo" | "bar" +>h : (x: "foo" | "bar") => "foo" | "bar" +>"foo" : "foo" + +hResult = h("bar"); +>hResult = h("bar") : "foo" | "bar" +>hResult : "foo" | "bar" +>h("bar") : "foo" | "bar" +>h : (x: "foo" | "bar") => "foo" | "bar" +>"bar" : "bar" + diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt new file mode 100644 index 00000000000..ed6450ad329 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts(6,13): error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'. + Type 'string' is not assignable to type '"foo"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts (1 errors) ==== + + function foo(f: (x: T) => T) { + return f; + } + + let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'. +!!! error TS2345: Type 'string' is not assignable to type '"foo"'. + let fResult = f("foo"); \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js new file mode 100644 index 00000000000..c024ac6bc43 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js @@ -0,0 +1,21 @@ +//// [stringLiteralTypesAsTypeParameterConstraint02.ts] + +function foo(f: (x: T) => T) { + return f; +} + +let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); +let fResult = f("foo"); + +//// [stringLiteralTypesAsTypeParameterConstraint02.js] +function foo(f) { + return f; +} +var f = foo(function (y) { return y === "foo" ? y : "foo"; }); +var fResult = f("foo"); + + +//// [stringLiteralTypesAsTypeParameterConstraint02.d.ts] +declare function foo(f: (x: T) => T): (x: T) => T; +declare let f: any; +declare let fResult: any; From b93394a7acc9b56cd9e97dccd311c2419762b76d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 10 Nov 2015 23:15:48 -0800 Subject: [PATCH 133/140] Added to comment. --- src/compiler/checker.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4fe04cae13a..8f751f25523 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7114,9 +7114,16 @@ namespace ts { /** * Woah! Do you really want to use this function? * - * Unless you're trying to get the *non-apparent* type for a value-literal type, + * Unless you're trying to get the *non-apparent* type for a + * value-literal type or you're authoring relevant portions of this algorithm, * you probably meant to use 'getApparentTypeOfContextualType'. - * Otherwise this is slightly less useful. + * Otherwise this may not be very useful. + * + * In cases where you *are* working on this function, you should understand + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * + * - Use 'getContextualType' when you are simply going to propagate the result to the expression. + * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. * * @param node the expression whose contextual type will be returned. * @returns the contextual type of an expression. From e62603ba8522eca6529eccfd84480e8a1a4c7a6e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 11 Nov 2015 08:51:37 -0800 Subject: [PATCH 134/140] Move export default check before module merge one As suggested by Anders. --- src/compiler/checker.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05ced970793..2bbed26f23c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -486,10 +486,19 @@ namespace ts { if (location.kind === SyntaxKind.SourceFile || (location.kind === SyntaxKind.ModuleDeclaration && (location).name.kind === SyntaxKind.StringLiteral)) { - // It's an external module. Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope, except 'default'. - // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope, - // unless it is 'default'. + // It's an external module. First see if the module has an export default and if the local + // name of that export default matches. + if (result = moduleExports["default"]) { + const localSymbol = getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } + + // Because of module/namespace merging, a module's exports are in scope, + // yet we never want to treat an export specifier as putting a member in scope. + // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol // on an export specifier is that it might find the export specifier itself, and try to @@ -498,19 +507,11 @@ namespace ts { // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - const isLocalSymbolForExportDefault = doesNameResolveToLocalSymbolForExportDefault(moduleExports, meaning, name); if (hasProperty(moduleExports, name) && moduleExports[name].flags === SymbolFlags.Alias && - !isLocalSymbolForExportDefault && getDeclarationOfKind(moduleExports[name], SyntaxKind.ExportSpecifier)) { break; } - - if (isLocalSymbolForExportDefault) { - result = moduleExports["default"]; - break loop; - } - result = undefined; } if (result = getSymbol(moduleExports, name, meaning & SymbolFlags.ModuleMember)) { From 9472c0be9951bd2926d6e2200f8ce8c28da13dc4 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 11 Nov 2015 10:53:24 -0800 Subject: [PATCH 135/140] Remove now-unused function `doesNameResolveToLocalSymbolForExportDefault` is no longer used, so delete it. --- src/compiler/checker.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2bbed26f23c..175807ac686 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -677,12 +677,6 @@ namespace ts { return result; } - function doesNameResolveToLocalSymbolForExportDefault(exports: SymbolTable, meaning: SymbolFlags, name: string): boolean { - const defaultExport = exports["default"]; - const localSymbol = getLocalSymbolForExportDefault(defaultExport); - return defaultExport && (defaultExport.flags & meaning) && localSymbol && localSymbol.name === name; - } - function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0); // Block-scoped variables cannot be used before their definition From 87230bcc1bb166fef8f22363f1695beaf5999dec Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 11 Nov 2015 10:55:33 -0800 Subject: [PATCH 136/140] Use 'getContextualType' for 'getContextualType'. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e22bb18085c..37cbc632f20 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -81,7 +81,7 @@ namespace ts { symbolToString, getAugmentedPropertiesOfType, getRootSymbols, - getContextualType: getApparentTypeOfContextualType, + getContextualType, getFullyQualifiedName, getResolvedSignature, getConstantValue, From df1dd00f35542884a9fc85501c48d599b181ac82 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 11 Nov 2015 12:19:47 -0800 Subject: [PATCH 137/140] Added test. --- ...sPropertyContextuallyTypedByTypeParam01.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts diff --git a/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts new file mode 100644 index 00000000000..357b355971d --- /dev/null +++ b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts @@ -0,0 +1,28 @@ +/// + +////interface IFoo { +//// [|a|]: string; +////} +////class C { +//// method() { +//// var x: T = { +//// [|a|]: "" +//// }; +//// x.[|a|]; +//// } +////} +//// +//// +////var x: IFoo = { +//// [|a|]: "ss" +////}; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file From d3f338cb8b174ad43d5f1f8b32fb7fdbc843e5b9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 11 Nov 2015 12:24:40 -0800 Subject: [PATCH 138/140] Updated LKG. --- lib/tsc.js | 3282 ++++++++++++++----------- lib/tsserver.js | 1614 ++++++++----- lib/typescript.d.ts | 19 +- lib/typescript.js | 4504 ++++++++++++++++++++--------------- lib/typescriptServices.d.ts | 19 +- lib/typescriptServices.js | 4504 ++++++++++++++++++++--------------- 6 files changed, 8034 insertions(+), 5908 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index bbbcedf0f47..87a413af729 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -665,7 +665,7 @@ var ts; } ts.fileExtensionIs = fileExtensionIs; ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.moduleFileExtensions = ts.supportedExtensions; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); function isSupportedSourceFileName(fileName) { if (!fileName) { return false; @@ -716,17 +716,16 @@ var ts; } function Signature(checker) { } + function Node(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0; + this.parent = undefined; + } ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0; - this.parent = undefined; - } - Node.prototype = { kind: kind }; - return Node; - }, + getNodeConstructor: function () { return Node; }, + getSourceFileConstructor: function () { return Node; }, getSymbolConstructor: function () { return Symbol; }, getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } @@ -1003,7 +1002,16 @@ var ts; if (writeByteOrderMark) { data = "\uFEFF" + data; } - _fs.writeFileSync(fileName, data, "utf8"); + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync(fd, data, undefined, "utf8"); + } + finally { + if (fd !== undefined) { + _fs.closeSync(fd); + } + } } function getCanonicalPath(path) { return useCaseSensitiveFileNames ? path.toLowerCase() : path; @@ -1688,6 +1696,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, + Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2148,7 +2157,7 @@ var ts; function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; - while (true) { + while (pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13: @@ -2217,6 +2226,7 @@ var ts; } return result; } + return result; } function getLeadingCommentRanges(text, pos) { return getCommentRanges(text, pos, false); @@ -2312,7 +2322,7 @@ var ts; error(ts.Diagnostics.Digit_expected); } } - return +(text.substring(start, end)); + return "" + +(text.substring(start, end)); } function scanOctalDigits() { var start = pos; @@ -2704,7 +2714,7 @@ var ts; return pos++, token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8; } if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { @@ -2801,7 +2811,7 @@ var ts; case 55: case 56: case 57: - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8; case 58: return pos++, token = 54; @@ -3093,1034 +3103,6 @@ var ts; ts.createScanner = createScanner; })(ts || (ts = {})); var ts; -(function (ts) { - ts.bindTime = 0; - function or(state1, state2) { - return (state1 | state2) & 2 - ? 2 - : (state1 & state2) & 8 - ? 8 - : 4; - } - function getModuleInstanceState(node) { - if (node.kind === 215 || node.kind === 216) { - return 0; - } - else if (ts.isConstEnumDeclaration(node)) { - return 2; - } - else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { - return 0; - } - else if (node.kind === 219) { - var state = 0; - ts.forEachChild(node, function (n) { - switch (getModuleInstanceState(n)) { - case 0: - return false; - case 2: - state = 2; - return false; - case 1: - state = 1; - return true; - } - }); - return state; - } - else if (node.kind === 218) { - return getModuleInstanceState(node.body); - } - else { - return 1; - } - } - ts.getModuleInstanceState = getModuleInstanceState; - var binder = createBinder(); - function bindSourceFile(file, options) { - var start = new Date().getTime(); - binder(file, options); - ts.bindTime += new Date().getTime() - start; - } - ts.bindSourceFile = bindSourceFile; - function createBinder() { - var file; - var options; - var parent; - var container; - var blockScopeContainer; - var lastContainer; - var seenThisKeyword; - var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; - var inStrictMode; - var symbolCount = 0; - var Symbol; - var classifiableNames; - function bindSourceFile(f, opts) { - file = f; - options = opts; - inStrictMode = !!file.externalModuleIndicator; - classifiableNames = {}; - Symbol = ts.objectAllocator.getSymbolConstructor(); - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; - } - parent = undefined; - container = undefined; - blockScopeContainer = undefined; - lastContainer = undefined; - seenThisKeyword = false; - hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; - } - return bindSourceFile; - function createSymbol(flags, name) { - symbolCount++; - return new Symbol(flags, name); - } - function addDeclarationToSymbol(symbol, node, symbolFlags) { - symbol.flags |= symbolFlags; - node.symbol = symbol; - if (!symbol.declarations) { - symbol.declarations = []; - } - symbol.declarations.push(node); - if (symbolFlags & 1952 && !symbol.exports) { - symbol.exports = {}; - } - if (symbolFlags & 6240 && !symbol.members) { - symbol.members = {}; - } - if (symbolFlags & 107455 && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; - } - } - function getDeclarationName(node) { - if (node.name) { - if (node.kind === 218 && node.name.kind === 9) { - return "\"" + node.name.text + "\""; - } - if (node.name.kind === 136) { - var nameExpression = node.name.expression; - ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); - return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); - } - return node.name.text; - } - switch (node.kind) { - case 144: - return "__constructor"; - case 152: - case 147: - return "__call"; - case 153: - case 148: - return "__new"; - case 149: - return "__index"; - case 228: - return "__export"; - case 227: - return node.isExportEquals ? "export=" : "default"; - case 213: - case 214: - return node.flags & 512 ? "default" : undefined; - } - } - function getDisplayName(node) { - return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); - } - function declareSymbol(symbolTable, parent, node, includes, excludes) { - ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 512; - var name = isDefaultExport && parent ? "default" : getDeclarationName(node); - var symbol; - if (name !== undefined) { - symbol = ts.hasProperty(symbolTable, name) - ? symbolTable[name] - : (symbolTable[name] = createSymbol(0, name)); - if (name && (includes & 788448)) { - classifiableNames[name] = name; - } - if (symbol.flags & excludes) { - if (node.name) { - node.name.parent = node; - } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; - ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 512) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; - } - }); - ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); - }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, name); - } - } - else { - symbol = createSymbol(0, "__missing"); - } - addDeclarationToSymbol(symbol, node, includes); - symbol.parent = parent; - return symbol; - } - function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; - if (symbolFlags & 8388608) { - if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - else { - if (hasExportModifier || container.flags & 131072) { - var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | - (symbolFlags & 793056 ? 2097152 : 0) | - (symbolFlags & 1536 ? 4194304 : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); - local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - node.localSymbol = local; - return local; - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - } - function bindChildren(node) { - var saveParent = parent; - var saveContainer = container; - var savedBlockScopeContainer = blockScopeContainer; - parent = node; - var containerFlags = getContainerFlags(node); - if (containerFlags & 1) { - container = blockScopeContainer = node; - if (containerFlags & 4) { - container.locals = {}; - } - addToContainerChain(container); - } - else if (containerFlags & 2) { - blockScopeContainer = node; - blockScopeContainer.locals = undefined; - } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; - var savedHasExplicitReturn; - var kind = node.kind; - var flags = node.flags; - flags &= ~1572864; - if (kind === 215) { - seenThisKeyword = false; - } - var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); - if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; - savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2; - hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; - } - bindReachableStatement(node); - if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288; - if (hasExplicitReturn) { - flags |= 1048576; - } - } - if (kind === 215) { - flags = seenThisKeyword ? flags | 262144 : flags & ~262144; - } - node.flags = flags; - if (saveState) { - hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; - } - container = saveContainer; - parent = saveParent; - blockScopeContainer = savedBlockScopeContainer; - } - function bindReachableStatement(node) { - if (checkUnreachable(node)) { - ts.forEachChild(node, bind); - return; - } - switch (node.kind) { - case 198: - bindWhileStatement(node); - break; - case 197: - bindDoStatement(node); - break; - case 199: - bindForStatement(node); - break; - case 200: - case 201: - bindForInOrForOfStatement(node); - break; - case 196: - bindIfStatement(node); - break; - case 204: - case 208: - bindReturnOrThrow(node); - break; - case 203: - case 202: - bindBreakOrContinueStatement(node); - break; - case 209: - bindTryStatement(node); - break; - case 206: - bindSwitchStatement(node); - break; - case 220: - bindCaseBlock(node); - break; - case 207: - bindLabeledStatement(node); - break; - default: - ts.forEachChild(node, bind); - break; - } - } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); - } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 ? 4 : preDoState; - popImplicitLabel(postDoLabel, postDoState); - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - var isInfiniteLoop = (!n.condition || n.condition.kind === 99); - var postForState = isInfiniteLoop ? 4 : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; - currentReachabilityState = ifTrueState; - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); - } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); - } - } - function bindReturnOrThrow(n) { - bind(n.expression); - if (n.kind === 204) { - hasExplicitReturn = true; - } - currentReachabilityState = 4; - } - function bindBreakOrContinueStatement(n) { - bind(n.label); - var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); - if (isValidJump) { - currentReachabilityState = 4; - } - } - function bindTryStatement(n) { - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - currentReachabilityState = or(postTryState, postCatchState); - } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); - var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); - } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); - } - } - } - function bindLabeledStatement(n) { - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); - } - } - function getContainerFlags(node) { - switch (node.kind) { - case 186: - case 214: - case 215: - case 217: - case 155: - case 165: - return 1; - case 147: - case 148: - case 149: - case 143: - case 142: - case 213: - case 144: - case 145: - case 146: - case 152: - case 153: - case 173: - case 174: - case 218: - case 248: - case 216: - return 5; - case 244: - case 199: - case 200: - case 201: - case 220: - return 2; - case 192: - return ts.isFunctionLike(node.parent) ? 0 : 2; - } - return 0; - } - function addToContainerChain(next) { - if (lastContainer) { - lastContainer.nextContainer = next; - } - lastContainer = next; - } - function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { - declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); - } - function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { - switch (container.kind) { - case 218: - return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248: - return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186: - case 214: - return declareClassMember(node, symbolFlags, symbolExcludes); - case 217: - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155: - case 165: - case 215: - return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 152: - case 153: - case 147: - case 148: - case 149: - case 143: - case 142: - case 144: - case 145: - case 146: - case 213: - case 173: - case 174: - case 216: - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 - ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) - : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - } - function declareSourceFileMember(node, symbolFlags, symbolExcludes) { - return ts.isExternalModule(file) - ? declareModuleMember(node, symbolFlags, symbolExcludes) - : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); - } - function hasExportDeclarations(node) { - var body = node.kind === 248 ? node : node.body; - if (body.kind === 248 || body.kind === 219) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { - var stat = _a[_i]; - if (stat.kind === 228 || stat.kind === 227) { - return true; - } - } - } - return false; - } - function setExportContextFlag(node) { - if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072; - } - else { - node.flags &= ~131072; - } - } - function bindModuleDeclaration(node) { - setExportContextFlag(node); - if (node.name.kind === 9) { - declareSymbolAndAddToSymbolTable(node, 512, 106639); - } - else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); - if (node.symbol.flags & (16 | 32 | 256)) { - node.symbol.constEnumOnlyModule = false; - } - else { - var currentModuleIsConstEnumOnly = state === 2; - if (node.symbol.constEnumOnlyModule === undefined) { - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; - } - else { - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; - } - } - } - } - } - function bindFunctionOrConstructorType(node) { - var symbol = createSymbol(131072, getDeclarationName(node)); - addDeclarationToSymbol(symbol, node, 131072); - var typeLiteralSymbol = createSymbol(2048, "__type"); - addDeclarationToSymbol(typeLiteralSymbol, node, 2048); - typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); - var _a; - } - function bindObjectLiteralExpression(node) { - if (inStrictMode) { - var seen = {}; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - if (prop.name.kind !== 69) { - continue; - } - var identifier = prop.name; - var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 - ? 1 - : 2; - var existingKind = seen[identifier.text]; - if (!existingKind) { - seen[identifier.text] = currentKind; - continue; - } - if (currentKind === 1 && existingKind === 1) { - var span = ts.getErrorSpanForNode(file, identifier); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); - } - } - } - return bindAnonymousDeclaration(node, 4096, "__object"); - } - function bindAnonymousDeclaration(node, symbolFlags, name) { - var symbol = createSymbol(symbolFlags, name); - addDeclarationToSymbol(symbol, node, symbolFlags); - } - function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { - switch (blockScopeContainer.kind) { - case 218: - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - case 248: - if (ts.isExternalModule(container)) { - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - } - default: - if (!blockScopeContainer.locals) { - blockScopeContainer.locals = {}; - addToContainerChain(blockScopeContainer); - } - declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function bindBlockScopedVariableDeclaration(node) { - bindBlockScopedDeclaration(node, 2, 107455); - } - function checkStrictModeIdentifier(node) { - if (inStrictMode && - node.originalKeywordKind >= 106 && - node.originalKeywordKind <= 114 && - !ts.isIdentifierName(node)) { - if (!file.parseDiagnostics.length) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); - } - } - } - function getStrictModeIdentifierMessage(node) { - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; - } - function checkStrictModeBinaryExpression(node) { - if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { - checkStrictModeEvalOrArguments(node, node.left); - } - } - function checkStrictModeCatchClause(node) { - if (inStrictMode && node.variableDeclaration) { - checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); - } - } - function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 69) { - var span = ts.getErrorSpanForNode(file, node.expression); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); - } - } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 && - (node.text === "eval" || node.text === "arguments"); - } - function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 69) { - var identifier = name; - if (isEvalOrArgumentsIdentifier(identifier)) { - var span = ts.getErrorSpanForNode(file, name); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); - } - } - } - function getStrictModeEvalOrArgumentsMessage(node) { - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; - } - function checkStrictModeFunctionName(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.name); - } - } - function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); - } - } - function checkStrictModePostfixUnaryExpression(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - function checkStrictModePrefixUnaryExpression(node) { - if (inStrictMode) { - if (node.operator === 41 || node.operator === 42) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - } - function checkStrictModeWithStatement(node) { - if (inStrictMode) { - errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); - } - } - function errorOnFirstToken(node, message, arg0, arg1, arg2) { - var span = ts.getSpanOfTokenAtPosition(file, node.pos); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); - } - function getDestructuringParameterName(node) { - return "__" + ts.indexOf(node.parent.parameters, node); - } - function bind(node) { - if (!node) { - return; - } - node.parent = parent; - var savedInStrictMode = inStrictMode; - if (!savedInStrictMode) { - updateStrictMode(node); - } - bindWorker(node); - bindChildren(node); - inStrictMode = savedInStrictMode; - } - function updateStrictMode(node) { - switch (node.kind) { - case 248: - case 219: - updateStrictModeStatementList(node.statements); - return; - case 192: - if (ts.isFunctionLike(node.parent)) { - updateStrictModeStatementList(node.statements); - } - return; - case 214: - case 186: - inStrictMode = true; - return; - } - } - function updateStrictModeStatementList(statements) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; - if (!ts.isPrologueDirective(statement)) { - return; - } - if (isUseStrictPrologueDirective(statement)) { - inStrictMode = true; - return; - } - } - } - function isUseStrictPrologueDirective(node) { - var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; - } - function bindWorker(node) { - switch (node.kind) { - case 69: - return checkStrictModeIdentifier(node); - case 181: - return checkStrictModeBinaryExpression(node); - case 244: - return checkStrictModeCatchClause(node); - case 175: - return checkStrictModeDeleteExpression(node); - case 8: - return checkStrictModeNumericLiteral(node); - case 180: - return checkStrictModePostfixUnaryExpression(node); - case 179: - return checkStrictModePrefixUnaryExpression(node); - case 205: - return checkStrictModeWithStatement(node); - case 97: - seenThisKeyword = true; - return; - case 137: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 138: - return bindParameter(node); - case 211: - case 163: - return bindVariableDeclarationOrBindingElement(node); - case 141: - case 140: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 245: - case 246: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 247: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 147: - case 148: - case 149: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 143: - case 142: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 213: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 144: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 145: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); - case 146: - return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 152: - case 153: - return bindFunctionOrConstructorType(node); - case 155: - return bindAnonymousDeclaration(node, 2048, "__type"); - case 165: - return bindObjectLiteralExpression(node); - case 173: - case 174: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16, bindingName); - case 186: - case 214: - return bindClassLikeDeclaration(node); - case 215: - return bindBlockScopedDeclaration(node, 64, 792960); - case 216: - return bindBlockScopedDeclaration(node, 524288, 793056); - case 217: - return bindEnumDeclaration(node); - case 218: - return bindModuleDeclaration(node); - case 221: - case 224: - case 226: - case 230: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 223: - return bindImportClause(node); - case 228: - return bindExportDeclaration(node); - case 227: - return bindExportAssignment(node); - case 248: - return bindSourceFileIfExternalModule(); - } - } - function bindSourceFileIfExternalModule() { - setExportContextFlag(file); - if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); - } - } - function bindExportAssignment(node) { - if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); - } - else if (node.expression.kind === 69) { - declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); - } - else { - declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); - } - } - function bindExportDeclaration(node) { - if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); - } - else if (!node.exportClause) { - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); - } - } - function bindImportClause(node) { - if (node.name) { - declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - } - } - function bindClassLikeDeclaration(node) { - if (node.kind === 214) { - bindBlockScopedDeclaration(node, 32, 899519); - } - else { - var bindingName = node.name ? node.name.text : "__class"; - bindAnonymousDeclaration(node, 32, bindingName); - if (node.name) { - classifiableNames[node.name.text] = node.name.text; - } - } - var symbol = node.symbol; - var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { - if (node.name) { - node.name.parent = node; - } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); - } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; - prototypeSymbol.parent = symbol; - } - function bindEnumDeclaration(node) { - return ts.isConst(node) - ? bindBlockScopedDeclaration(node, 128, 899967) - : bindBlockScopedDeclaration(node, 256, 899327); - } - function bindVariableDeclarationOrBindingElement(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.name); - } - if (!ts.isBindingPattern(node.name)) { - if (ts.isBlockOrCatchScoped(node)) { - bindBlockScopedVariableDeclaration(node); - } - else if (ts.isParameterDeclaration(node)) { - declareSymbolAndAddToSymbolTable(node, 1, 107455); - } - else { - declareSymbolAndAddToSymbolTable(node, 1, 107454); - } - } - } - function bindParameter(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.name); - } - if (ts.isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node)); - } - else { - declareSymbolAndAddToSymbolTable(node, 1, 107455); - } - if (node.flags & 56 && - node.parent.kind === 144 && - ts.isClassLike(node.parent.parent)) { - var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); - } - } - function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { - return ts.hasDynamicName(node) - ? bindAnonymousDeclaration(node, symbolFlags, "__computed") - : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); - } - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); - return true; - } - function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4: - var reportError = ts.isStatement(node) || - node.kind === 214 || - (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8; - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 || - ts.getCombinedNodeFlags(node.declarationList) & 24576 || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } - } - case 8: - return true; - default: - return false; - } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; - } - } -})(ts || (ts = {})); -var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; @@ -4396,6 +3378,10 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 4096) !== 0; } @@ -4442,18 +3428,26 @@ var ts; return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 138 || node.kind === 137) ? - ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : - getLeadingCommentRangesOfNode(node, sourceFileOfNode); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; - } + return getJsDocCommentsFromText(node, sourceFileOfNode.text); } ts.getJsDocComments = getJsDocComments; + function getJsDocCommentsFromText(node, text) { + var commentRanges = (node.kind === 138 || node.kind === 137) ? + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); + return ts.filter(commentRanges, isJsDocComment); + function isJsDocComment(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 42 && + text.charCodeAt(comment.pos + 3) !== 47; + } + } + ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { @@ -4982,6 +3976,41 @@ var ts; return node.kind === 221 && node.moduleReference.kind !== 232; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(expression) { + return expression.kind === 168 && + expression.expression.kind === 69 && + expression.expression.text === "require" && + expression.arguments.length === 1 && + expression.arguments[0].kind === 9; + } + ts.isRequireCall = isRequireCall; + function isExportsPropertyAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + function isModuleExportsAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { if (node.kind === 222) { return node.moduleSpecifier; @@ -5293,8 +4322,8 @@ var ts; function getFileReferenceFromReferencePath(comment, commentRange) { var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.exec(comment)) { - if (isNoDefaultLibRegEx.exec(comment)) { + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; @@ -5336,12 +4365,20 @@ var ts; return isFunctionLike(node) && (node.flags & 256) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; + function isStringOrNumericLiteral(kind) { + return kind === 9 || kind === 8; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 136 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && isDynamicName(declaration.name); } ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 136 && + !isStringOrNumericLiteral(name.expression.kind) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; function isWellKnownSymbolSyntactically(node) { return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } @@ -5562,11 +4599,11 @@ var ts; } ts.getIndentSize = getIndentSize; function createTextWriter(newLine) { - var output = ""; - var indent = 0; - var lineStart = true; - var lineCount = 0; - var linePos = 0; + var output; + var indent; + var lineStart; + var lineCount; + var linePos; function write(s) { if (s && s.length) { if (lineStart) { @@ -5576,6 +4613,13 @@ var ts; output += s; } } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } function rawWrite(s) { if (s !== undefined) { if (lineStart) { @@ -5602,9 +4646,10 @@ var ts; lineStart = true; } } - function writeTextOfNode(sourceFile, node) { - write(getSourceTextOfNodeFromSourceFile(sourceFile, node)); + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); } + reset(); return { write: write, rawWrite: rawWrite, @@ -5617,10 +4662,17 @@ var ts; getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + getText: function () { return output; }, + reset: reset }; } ts.createTextWriter = createTextWriter; + function getExternalModuleNameFromPath(host, fileName) { + var dir = host.getCurrentDirectory(); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, false); + return ts.removeFileExtension(relativePath); + } + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); var emitOutputFilePathWithoutExtension; @@ -5649,6 +4701,10 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + } + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { if (member.kind === 144 && nodeIsPresent(member.body)) { @@ -5719,21 +4775,21 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { var emitLeadingSpace = !trailingSeparator; ts.forEach(comments, function (comment) { if (emitLeadingSpace) { writer.write(" "); emitLeadingSpace = false; } - writeComment(currentSourceFile, writer, comment, newLine); + writeComment(text, lineMap, writer, comment, newLine); if (comment.hasTrailingNewLine) { writer.writeLine(); } @@ -5746,16 +4802,16 @@ var ts; }); } ts.emitComments = emitComments; - function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { var leadingComments; var currentDetachedCommentInfo; if (removeComments) { if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); } } else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + leadingComments = ts.getLeadingCommentRanges(text, node.pos); } if (leadingComments) { var detachedComments = []; @@ -5763,8 +4819,8 @@ var ts; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) { break; } @@ -5773,37 +4829,37 @@ var ts; lastComment = comment; } if (detachedComments.length) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); if (nodeLine >= lastCommentLine + 2) { - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; } } } return currentDetachedCommentInfo; function isPinnedComment(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 33; } } ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(currentSourceFile, writer, comment, newLine) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { - var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lineCount = ts.getLineStarts(currentSourceFile).length; + function writeCommentRange(text, lineMap, writer, comment, newLine) { + if (text.charCodeAt(comment.pos + 1) === 42) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + var lineCount = lineMap.length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + ? text.length + 1 + : lineMap[currentLine + 1]; if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); @@ -5817,40 +4873,40 @@ var ts; writer.rawWrite(""); } } - writeTrimmedCurrentLine(pos, nextLineStart); + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { - writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); - } - function writeTrimmedCurrentLine(pos, nextLineStart) { - var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - writer.write(currentLineText); - if (end !== comment.end) { - writer.writeLine(); - } - } - else { - writer.writeLiteral(newLine); - } - } - function calculateIndent(pos, end) { - var currentLineIndent = 0; - for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === 9) { - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - currentLineIndent++; - } - } - return currentLineIndent; + writer.write(text.substring(comment.pos, comment.end)); } } ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; + } function modifierToFlag(token) { switch (token) { case 113: return 64; @@ -5944,14 +5000,14 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; - function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function allowsJsxExpressions(fileName) { + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isTsx = isTsx; + ts.allowsJsxExpressions = allowsJsxExpressions; function getExpandedCharCodes(input) { var output = []; var length = input.length; @@ -6161,14 +5217,16 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(272); ts.parseTime = 0; - function getNodeConstructor(kind) { - return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); - } - ts.getNodeConstructor = getNodeConstructor; + var NodeConstructor; + var SourceFileConstructor; function createNode(kind, pos, end) { - return new (getNodeConstructor(kind))(pos, end); + if (kind === 248) { + return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end); + } } ts.createNode = createNode; function visitNode(cbNode, node) { @@ -6567,6 +5625,8 @@ var ts; (function (Parser) { var scanner = ts.createScanner(2, true); var disallowInAndDecoratorContext = 1 | 4; + var NodeConstructor; + var SourceFileConstructor; var sourceFile; var parseDiagnostics; var syntaxCursor; @@ -6579,13 +5639,16 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + NodeConstructor = ts.objectAllocator.getNodeConstructor(); + SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -6593,12 +5656,12 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 : 0; + contextFlags = isJavaScriptFile ? 32 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.isTsx(fileName) ? 1 : 0); + scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 : 0); } function clearState() { scanner.setText(""); @@ -6611,6 +5674,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32) { + sourceFile.parserContextFlags = 32; + } token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -6624,7 +5690,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -6670,15 +5736,14 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(248, 0); - sourceFile.pos = 0; - sourceFile.end = sourceText.length; + var sourceFile = new SourceFileConstructor(248, 0, sourceText.length); + nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; - sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 : 0; + sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 : 0; return sourceFile; } function setContextFlag(val, flag) { @@ -6900,7 +5965,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos); + return new NodeConstructor(kind, pos, pos); } function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; @@ -7038,7 +6103,7 @@ var ts; case 12: return token === 19 || token === 37 || isLiteralPropertyName(); case 9: - return isLiteralPropertyName(); + return token === 19 || isLiteralPropertyName(); case 7: if (token === 15) { return lookAhead(isValidHeritageClauseObjectLiteral); @@ -7559,9 +6624,7 @@ var ts; } function parseParameterType() { if (parseOptional(54)) { - return token === 9 - ? parseLiteralNode(true) - : parseType(); + return parseType(); } return undefined; } @@ -7818,6 +6881,8 @@ var ts; case 131: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); + case 9: + return parseLiteralNode(true); case 103: case 97: return parseTokenNode(); @@ -7847,6 +6912,7 @@ var ts; case 19: case 25: case 92: + case 9: return true; case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -8360,7 +7426,6 @@ var ts; var unaryOperator = token; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { - var diagnostic; var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); if (simpleUnaryExpression.kind === 171) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); @@ -10024,7 +9089,7 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -10275,7 +9340,7 @@ var ts; } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocComment = parseJSDocComment(undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -10794,6 +9859,1075 @@ var ts; })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); var ts; +(function (ts) { + ts.bindTime = 0; + function or(state1, state2) { + return (state1 | state2) & 2 + ? 2 + : (state1 & state2) & 8 + ? 8 + : 4; + } + function getModuleInstanceState(node) { + if (node.kind === 215 || node.kind === 216) { + return 0; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2; + } + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { + return 0; + } + else if (node.kind === 219) { + var state = 0; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0: + return false; + case 2: + state = 2; + return false; + case 1: + state = 1; + return true; + } + }); + return state; + } + else if (node.kind === 218) { + return getModuleInstanceState(node.body); + } + else { + return 1; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + var binder = createBinder(); + function bindSourceFile(file, options) { + var start = new Date().getTime(); + binder(file, options); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function createBinder() { + var file; + var options; + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var seenThisKeyword; + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; + var inStrictMode; + var symbolCount = 0; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; + } + return bindSourceFile; + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolFlags) { + symbol.flags |= symbolFlags; + node.symbol = symbol; + if (!symbol.declarations) { + symbol.declarations = []; + } + symbol.declarations.push(node); + if (symbolFlags & 1952 && !symbol.exports) { + symbol.exports = {}; + } + if (symbolFlags & 6240 && !symbol.members) { + symbol.members = {}; + } + if (symbolFlags & 107455 && !symbol.valueDeclaration) { + symbol.valueDeclaration = node; + } + } + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 218 && node.name.kind === 9) { + return "\"" + node.name.text + "\""; + } + if (node.name.kind === 136) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } + return node.name.text; + } + switch (node.kind) { + case 144: + return "__constructor"; + case 152: + case 147: + return "__call"; + case 153: + case 148: + return "__new"; + case 149: + return "__index"; + case 228: + return "__export"; + case 227: + return node.isExportEquals ? "export=" : "default"; + case 181: + return "export="; + case 213: + case 214: + return node.flags & 512 ? "default" : undefined; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbolTable, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 512; + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); + var symbol; + if (name !== undefined) { + symbol = ts.hasProperty(symbolTable, name) + ? symbolTable[name] + : (symbolTable[name] = createSymbol(0, name)); + if (name && (includes & 788448)) { + classifiableNames[name] = name; + } + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + var message = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 512) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); + ts.forEach(symbol.declarations, function (declaration) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + return symbol; + } + function declareModuleMember(node, symbolFlags, symbolExcludes) { + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; + if (symbolFlags & 8388608) { + if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + else { + if (hasExportModifier || container.flags & 131072) { + var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | + (symbolFlags & 793056 ? 2097152 : 0) | + (symbolFlags & 1536 ? 4194304 : 0); + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + node.localSymbol = local; + return local; + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + } + function bindChildren(node) { + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + var containerFlags = getContainerFlags(node); + if (containerFlags & 1) { + container = blockScopeContainer = node; + if (containerFlags & 4) { + container.locals = {}; + } + addToContainerChain(container); + } + else if (containerFlags & 2) { + blockScopeContainer = node; + blockScopeContainer.locals = undefined; + } + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + flags &= ~1572864; + if (kind === 215) { + seenThisKeyword = false; + } + var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288; + if (hasExplicitReturn) { + flags |= 1048576; + } + } + if (kind === 215) { + flags = seenThisKeyword ? flags | 262144 : flags & ~262144; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; + } + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198: + bindWhileStatement(node); + break; + case 197: + bindDoStatement(node); + break; + case 199: + bindForStatement(node); + break; + case 200: + case 201: + bindForInOrForOfStatement(node); + break; + case 196: + bindIfStatement(node); + break; + case 204: + case 208: + bindReturnOrThrow(node); + break; + case 203: + case 202: + bindBreakOrContinueStatement(node); + break; + case 209: + bindTryStatement(node); + break; + case 206: + bindSwitchStatement(node); + break; + case 220: + bindCaseBlock(node); + break; + case 207: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 ? 4 : preDoState; + popImplicitLabel(postDoLabel, postDoState); + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + var isInfiniteLoop = (!n.condition || n.condition.kind === 99); + var postForState = isInfiniteLoop ? 4 : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; + currentReachabilityState = ifTrueState; + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + bind(n.expression); + if (n.kind === 204) { + hasExplicitReturn = true; + } + currentReachabilityState = 4; + } + function bindBreakOrContinueStatement(n) { + bind(n.label); + var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); + if (isValidJump) { + currentReachabilityState = 4; + } + } + function bindTryStatement(n) { + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); + var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } + function getContainerFlags(node) { + switch (node.kind) { + case 186: + case 214: + case 215: + case 217: + case 155: + case 165: + return 1; + case 147: + case 148: + case 149: + case 143: + case 142: + case 213: + case 144: + case 145: + case 146: + case 152: + case 153: + case 173: + case 174: + case 218: + case 248: + case 216: + return 5; + case 244: + case 199: + case 200: + case 201: + case 220: + return 2; + case 192: + return ts.isFunctionLike(node.parent) ? 0 : 2; + } + return 0; + } + function addToContainerChain(next) { + if (lastContainer) { + lastContainer.nextContainer = next; + } + lastContainer = next; + } + function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { + declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); + } + function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { + switch (container.kind) { + case 218: + return declareModuleMember(node, symbolFlags, symbolExcludes); + case 248: + return declareSourceFileMember(node, symbolFlags, symbolExcludes); + case 186: + case 214: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 217: + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + case 155: + case 165: + case 215: + return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 152: + case 153: + case 147: + case 148: + case 149: + case 143: + case 142: + case 144: + case 145: + case 146: + case 213: + case 173: + case 174: + case 216: + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function declareClassMember(node, symbolFlags, symbolExcludes) { + return node.flags & 64 + ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) + : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + } + function declareSourceFileMember(node, symbolFlags, symbolExcludes) { + return ts.isExternalModule(file) + ? declareModuleMember(node, symbolFlags, symbolExcludes) + : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + } + function hasExportDeclarations(node) { + var body = node.kind === 248 ? node : node.body; + if (body.kind === 248 || body.kind === 219) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var stat = _a[_i]; + if (stat.kind === 228 || stat.kind === 227) { + return true; + } + } + } + return false; + } + function setExportContextFlag(node) { + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072; + } + else { + node.flags &= ~131072; + } + } + function bindModuleDeclaration(node) { + setExportContextFlag(node); + if (node.name.kind === 9) { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } + else { + var state = getModuleInstanceState(node); + if (state === 0) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (node.symbol.flags & (16 | 32 | 256)) { + node.symbol.constEnumOnlyModule = false; + } + else { + var currentModuleIsConstEnumOnly = state === 2; + if (node.symbol.constEnumOnlyModule === undefined) { + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072); + var typeLiteralSymbol = createSymbol(2048, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048); + typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); + var _a; + } + function bindObjectLiteralExpression(node) { + if (inStrictMode) { + var seen = {}; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.name.kind !== 69) { + continue; + } + var identifier = prop.name; + var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 + ? 1 + : 2; + var existingKind = seen[identifier.text]; + if (!existingKind) { + seen[identifier.text] = currentKind; + continue; + } + if (currentKind === 1 && existingKind === 1) { + var span = ts.getErrorSpanForNode(file, identifier); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); + } + } + } + return bindAnonymousDeclaration(node, 4096, "__object"); + } + function bindAnonymousDeclaration(node, symbolFlags, name) { + var symbol = createSymbol(symbolFlags, name); + addDeclarationToSymbol(symbol, node, symbolFlags); + } + function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { + switch (blockScopeContainer.kind) { + case 218: + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + case 248: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + addToContainerChain(blockScopeContainer); + } + declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function bindBlockScopedVariableDeclaration(node) { + bindBlockScopedDeclaration(node, 2, 107455); + } + function checkStrictModeIdentifier(node) { + if (inStrictMode && + node.originalKeywordKind >= 106 && + node.originalKeywordKind <= 114 && + !ts.isIdentifierName(node)) { + if (!file.parseDiagnostics.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); + } + } + } + function getStrictModeIdentifierMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; + } + function checkStrictModeBinaryExpression(node) { + if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + checkStrictModeEvalOrArguments(node, node.left); + } + } + function checkStrictModeCatchClause(node) { + if (inStrictMode && node.variableDeclaration) { + checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); + } + } + function checkStrictModeDeleteExpression(node) { + if (inStrictMode && node.expression.kind === 69) { + var span = ts.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + } + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 69 && + (node.text === "eval" || node.text === "arguments"); + } + function checkStrictModeEvalOrArguments(contextNode, name) { + if (name && name.kind === 69) { + var identifier = name; + if (isEvalOrArgumentsIdentifier(identifier)) { + var span = ts.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + } + } + } + function getStrictModeEvalOrArgumentsMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; + } + function checkStrictModeFunctionName(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + } + function checkStrictModeNumericLiteral(node) { + if (inStrictMode && node.flags & 32768) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); + } + } + function checkStrictModePostfixUnaryExpression(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + function checkStrictModePrefixUnaryExpression(node) { + if (inStrictMode) { + if (node.operator === 41 || node.operator === 42) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + } + function checkStrictModeWithStatement(node) { + if (inStrictMode) { + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function errorOnFirstToken(node, message, arg0, arg1, arg2) { + var span = ts.getSpanOfTokenAtPosition(file, node.pos); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + if (!node) { + return; + } + node.parent = parent; + var savedInStrictMode = inStrictMode; + if (!savedInStrictMode) { + updateStrictMode(node); + } + bindWorker(node); + bindChildren(node); + inStrictMode = savedInStrictMode; + } + function updateStrictMode(node) { + switch (node.kind) { + case 248: + case 219: + updateStrictModeStatementList(node.statements); + return; + case 192: + if (ts.isFunctionLike(node.parent)) { + updateStrictModeStatementList(node.statements); + } + return; + case 214: + case 186: + inStrictMode = true; + return; + } + } + function updateStrictModeStatementList(statements) { + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; + if (!ts.isPrologueDirective(statement)) { + return; + } + if (isUseStrictPrologueDirective(statement)) { + inStrictMode = true; + return; + } + } + } + function isUseStrictPrologueDirective(node) { + var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + } + function bindWorker(node) { + switch (node.kind) { + case 69: + return checkStrictModeIdentifier(node); + case 181: + if (ts.isInJavaScriptFile(node)) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } + return checkStrictModeBinaryExpression(node); + case 244: + return checkStrictModeCatchClause(node); + case 175: + return checkStrictModeDeleteExpression(node); + case 8: + return checkStrictModeNumericLiteral(node); + case 180: + return checkStrictModePostfixUnaryExpression(node); + case 179: + return checkStrictModePrefixUnaryExpression(node); + case 205: + return checkStrictModeWithStatement(node); + case 97: + seenThisKeyword = true; + return; + case 137: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 138: + return bindParameter(node); + case 211: + case 163: + return bindVariableDeclarationOrBindingElement(node); + case 141: + case 140: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 245: + case 246: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 247: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 147: + case 148: + case 149: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 143: + case 142: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 213: + checkStrictModeFunctionName(node); + return declareSymbolAndAddToSymbolTable(node, 16, 106927); + case 144: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 146: + return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 152: + case 153: + return bindFunctionOrConstructorType(node); + case 155: + return bindAnonymousDeclaration(node, 2048, "__type"); + case 165: + return bindObjectLiteralExpression(node); + case 173: + case 174: + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16, bindingName); + case 168: + if (ts.isInJavaScriptFile(node)) { + bindCallExpression(node); + } + break; + case 186: + case 214: + return bindClassLikeDeclaration(node); + case 215: + return bindBlockScopedDeclaration(node, 64, 792960); + case 216: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 217: + return bindEnumDeclaration(node); + case 218: + return bindModuleDeclaration(node); + case 221: + case 224: + case 226: + case 230: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 223: + return bindImportClause(node); + case 228: + return bindExportDeclaration(node); + case 227: + return bindExportAssignment(node); + case 248: + return bindSourceFileIfExternalModule(); + } + } + function bindSourceFileIfExternalModule() { + setExportContextFlag(file); + if (ts.isExternalModule(file)) { + bindSourceFileAsExternalModule(); + } + } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } + function bindExportAssignment(node) { + var boundExpression = node.kind === 227 ? node.expression : node.right; + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); + } + else if (boundExpression.kind === 69) { + declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); + } + } + function bindExportDeclaration(node) { + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); + } + else if (!node.exportClause) { + declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); + } + } + function bindImportClause(node) { + if (node.name) { + declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + } + } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + } + function bindModuleExportsAssignment(node) { + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node) { + if (node.kind === 214) { + bindBlockScopedDeclaration(node, 32, 899519); + } + else { + var bindingName = node.name ? node.name.text : "__class"; + bindAnonymousDeclaration(node, 32, bindingName); + if (node.name) { + classifiableNames[node.name.text] = node.name.text; + } + } + var symbol = node.symbol; + var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + function bindEnumDeclaration(node) { + return ts.isConst(node) + ? bindBlockScopedDeclaration(node, 128, 899967) + : bindBlockScopedDeclaration(node, 256, 899327); + } + function bindVariableDeclarationOrBindingElement(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (!ts.isBindingPattern(node.name)) { + if (ts.isBlockOrCatchScoped(node)) { + bindBlockScopedVariableDeclaration(node); + } + else if (ts.isParameterDeclaration(node)) { + declareSymbolAndAddToSymbolTable(node, 1, 107455); + } + else { + declareSymbolAndAddToSymbolTable(node, 1, 107454); + } + } + } + function bindParameter(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node)); + } + else { + declareSymbolAndAddToSymbolTable(node, 1, 107455); + } + if (node.flags & 56 && + node.parent.kind === 144 && + ts.isClassLike(node.parent.parent)) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); + } + } + function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + return ts.hasDynamicName(node) + ? bindAnonymousDeclaration(node, symbolFlags, "__computed") + : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4: + var reportError = (ts.isStatement(node) && node.kind !== 194) || + node.kind === 214 || + (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 || + ts.getCombinedNodeFlags(node.declarationList) & 24576 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } + } +})(ts || (ts = {})); +var ts; (function (ts) { var nextSymbolId = 1; var nextNodeId = 1; @@ -10853,7 +10987,7 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: getApparentTypeOfContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -11109,7 +11243,7 @@ var ts; return ts.getAncestor(node, 248); } function isGlobalSourceFile(node) { - return node.kind === 248 && !ts.isExternalModule(node); + return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -11195,23 +11329,24 @@ var ts; } switch (location.kind) { case 248: - if (!ts.isExternalModule(location)) + if (!ts.isExternalOrCommonJsModule(location)) break; case 218: var moduleExports = getSymbolOfNode(location).exports; if (location.kind === 248 || (location.kind === 218 && location.name.kind === 9)) { + if (result = moduleExports["default"]) { + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && ts.getDeclarationOfKind(moduleExports[name], 230)) { break; } - result = moduleExports["default"]; - var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { - break loop; - } - result = undefined; } if (result = getSymbol(moduleExports, name, meaning & 8914931)) { break loop; @@ -11569,6 +11704,9 @@ var ts; if (moduleName === undefined) { return; } + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); @@ -11739,7 +11877,7 @@ var ts; } switch (location_1.kind) { case 248: - if (!ts.isExternalModule(location_1)) { + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } case 218: @@ -11866,7 +12004,7 @@ var ts; } function hasExternalModuleSymbol(declaration) { return (declaration.kind === 218 && declaration.name.kind === 9) || - (declaration.kind === 248 && ts.isExternalModule(declaration)); + (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -12064,7 +12202,7 @@ var ts; writeAnonymousType(type, flags); } else if (type.flags & 256) { - writer.writeStringLiteral(type.text); + writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); } else { writePunctuation(writer, 15); @@ -12428,7 +12566,7 @@ var ts; } } else if (node.kind === 248) { - return ts.isExternalModule(node) ? node : undefined; + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -12633,6 +12771,23 @@ var ts; var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); } + function getTextOfPropertyName(name) { + switch (name.kind) { + case 69: + return name.text; + case 9: + case 8: + return name.text; + case 136: + if (ts.isStringOrNumericLiteral(name.expression.kind)) { + return name.expression.text; + } + } + return undefined; + } + function isComputedNonLiteralName(name) { + return name.kind === 136 && !ts.isStringOrNumericLiteral(name.expression.kind); + } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -12648,8 +12803,12 @@ var ts; var type; if (pattern.kind === 161) { var name_10 = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, name_10.text) || - isNumericLiteralName(name_10.text) && getIndexTypeOfType(parentType, 1) || + if (isComputedNonLiteralName(name_10)) { + return anyType; + } + var text = getTextOfPropertyName(name_10); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { error(name_10, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_10)); @@ -12727,10 +12886,16 @@ var ts; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; + var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { - var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + if (isComputedNonLiteralName(name)) { + hasComputedProperties = true; + return; + } + var text = getTextOfPropertyName(name); + var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType); symbol.bindingElement = e; members[symbol.name] = symbol; @@ -12739,6 +12904,9 @@ var ts; if (includePatternInType) { result.pattern = pattern; } + if (hasComputedProperties) { + result.flags |= 67108864; + } return result; } function getTypeFromArrayBindingPattern(pattern, includePatternInType) { @@ -12789,6 +12957,12 @@ var ts; if (declaration.kind === 227) { return links.type = checkExpression(declaration.expression); } + if (declaration.kind === 181) { + return links.type = checkExpression(declaration.right); + } + if (declaration.kind === 166) { + return checkExpressionCached(declaration.parent.right); + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } @@ -13038,17 +13212,19 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseContructorType = getBaseConstructorTypeOfClass(type); - if (!(baseContructorType.flags & 80896)) { + var baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & 80896)) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); var baseType; - if (baseContructorType.symbol && baseContructorType.symbol.flags & 32) { - baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseContructorType.symbol); + var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 && + areAllOuterTypeParametersApplied(originalBaseType)) { + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } else { - var constructors = getInstantiatedConstructorsForTypeArguments(baseContructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -13073,6 +13249,15 @@ var ts; type.resolvedBaseTypes.push(baseType); } } + function areAllOuterTypeParametersApplied(type) { + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last = outerTypeParameters.length - 1; + var typeArguments = type.typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; + } + return true; + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { @@ -13144,7 +13329,7 @@ var ts; type.typeArguments = type.typeParameters; type.thisType = createType(512 | 33554432); type.thisType.symbol = symbol; - type.thisType.constraint = getTypeWithThisArgument(type); + type.thisType.constraint = type; } } return links.declaredType; @@ -13619,14 +13804,19 @@ var ts; type = getApparentType(type); return type.flags & 49152 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getApparentTypeOfTypeParameter(type) { + if (!type.resolvedApparentType) { + var constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & 512) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } function getApparentType(type) { if (type.flags & 512) { - do { - type = getConstraintOfTypeParameter(type); - } while (type && type.flags & 512); - if (!type) { - type = emptyObjectType; - } + type = getApparentTypeOfTypeParameter(type); } if (type.flags & 258) { type = globalStringType; @@ -13779,7 +13969,7 @@ var ts; if (node.initializer) { var signatureDeclaration = node.parent; var signature = getSignatureFromDeclaration(signatureDeclaration); - var parameterIndex = signatureDeclaration.parameters.indexOf(node); + var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } @@ -13874,6 +14064,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3)) { @@ -14335,11 +14535,12 @@ var ts; return links.resolvedType; } function getStringLiteralType(node) { - if (ts.hasProperty(stringLiteralTypes, node.text)) { - return stringLiteralTypes[node.text]; + var text = node.text; + if (ts.hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; } - var type = stringLiteralTypes[node.text] = createType(256); - type.text = ts.getTextOfNode(node); + var type = stringLiteralTypes[text] = createType(256); + type.text = text; return type; } function getTypeFromStringLiteral(node) { @@ -14808,7 +15009,7 @@ var ts; return false; } function hasExcessProperties(source, target, reportErrors) { - if (someConstituentTypeHasKind(target, 80896)) { + if (!(target.flags & 67108864) && someConstituentTypeHasKind(target, 80896)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -14898,9 +15099,6 @@ var ts; return result; } function typeParameterIdenticalTo(source, target) { - if (source.symbol.name !== target.symbol.name) { - return 0; - } if (source.constraint === target.constraint) { return -1; } @@ -15345,18 +15543,24 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } + function isMatchingSignature(source, target, partialMatch) { + if (source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter) { + return true; + } + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; + } function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { - if (!partialMatch || - source.parameters.length < target.parameters.length && !source.hasRestParameter || - source.minArgumentCount > target.minArgumentCount) { - return 0; - } + if (!(isMatchingSignature(source, target, partialMatch))) { + return 0; } var result = -1; if (source.typeParameters && target.typeParameters) { @@ -15441,6 +15645,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isStringLiteralType(type) { + return type.flags & 256; + } function isTupleType(type) { return !!(type.flags & 8192); } @@ -16032,7 +16239,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -16060,6 +16267,12 @@ var ts; } } if (targetType) { + if (!assumeTrue) { + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); + } + return type; + } return getNarrowedType(type, targetType); } return type; @@ -16471,6 +16684,9 @@ var ts; function getIndexTypeOfContextualType(type, kind) { return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } + function contextualTypeIsStringLiteralType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isStringLiteralType) : isStringLiteralType(type)); + } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } @@ -16486,7 +16702,7 @@ var ts; } function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; - var type = getContextualType(objectLiteral); + var type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!ts.hasDynamicName(element)) { var symbolName = getSymbolOfNode(element).name; @@ -16502,7 +16718,7 @@ var ts; } function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; - var type = getContextualType(arrayLiteral); + var type = getApparentTypeOfContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) @@ -16531,11 +16747,11 @@ var ts; } return undefined; } - function getContextualType(node) { - var type = getContextualTypeWorker(node); + function getApparentTypeOfContextualType(node) { + var type = getContextualType(node); return type && getApparentType(type); } - function getContextualTypeWorker(node) { + function getContextualType(node) { if (isInsideWithStatementBody(node)) { return undefined; } @@ -16601,7 +16817,7 @@ var ts; ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + : getApparentTypeOfContextualType(node); if (!type) { return undefined; } @@ -16684,7 +16900,7 @@ var ts; type.pattern = node; return type; } - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { @@ -16739,10 +16955,11 @@ var ts; checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); var typeFlags = 0; + var patternWithComputedProperties = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -16768,8 +16985,11 @@ var ts; if (isOptional) { prop.flags |= 536870912; } + if (ts.hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } } - else if (contextualTypeHasPattern) { + else if (contextualTypeHasPattern && !(contextualType.flags & 67108864)) { var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { prop.flags |= impliedProp.flags & 536870912; @@ -16812,7 +17032,7 @@ var ts; var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; - result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); + result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064) | (patternWithComputedProperties ? 67108864 : 0); if (inDestructuringPattern) { result.pattern = node; } @@ -18027,6 +18247,9 @@ var ts; return anyType; } } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -18037,7 +18260,9 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - if (!(isTypeAssignableTo(targetType, widenedType))) { + var bothAreStringLike = someConstituentTypeHasKind(targetType, 258) && + someConstituentTypeHasKind(widenedType, 258); + if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } } @@ -18476,17 +18701,24 @@ var ts; var p = properties_3[_i]; if (p.kind === 245 || p.kind === 246) { var name_13 = p.name; + if (name_13.kind === 136) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + continue; + } + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType - : getTypeOfPropertyOfType(sourceType, name_13.text) || - isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1) || + : getTypeOfPropertyOfType(sourceType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { if (p.kind === 246) { checkDestructuringAssignment(p, type); } else { - checkDestructuringAssignment(p.initializer || name_13, type); + checkDestructuringAssignment(p.initializer, type); } } else { @@ -18664,6 +18896,9 @@ var ts; case 31: case 32: case 33: + if (someConstituentTypeHasKind(leftType, 258) && someConstituentTypeHasKind(rightType, 258)) { + return booleanType; + } if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -18771,6 +19006,13 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkStringLiteralExpression(node) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralType(node); + } + return stringType; + } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { checkExpression(templateSpan.expression); @@ -18809,7 +19051,7 @@ var ts; if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { @@ -18861,6 +19103,7 @@ var ts; case 183: return checkTemplateExpression(node); case 9: + return checkStringLiteralExpression(node); case 11: return stringType; case 10: @@ -19922,7 +20165,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 248 && ts.isExternalModule(parent)) { + if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19993,6 +20236,11 @@ var ts; checkExpressionCached(node.initializer); } } + if (node.kind === 163) { + if (node.propertyName && node.propertyName.kind === 136) { + checkComputedPropertyName(node.propertyName); + } + } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } @@ -20351,6 +20599,7 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); + var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { if (clause.kind === 242 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { @@ -20367,6 +20616,9 @@ var ts; if (produceDiagnostics && clause.kind === 241) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); + if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258)) { + return; + } if (!isTypeAssignableTo(expressionType, caseType)) { checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); } @@ -20774,11 +21026,14 @@ var ts; var enumIsConst = ts.isConst(node); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.name.kind === 136) { + if (isComputedNonLiteralName(member.name)) { error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } - else if (isNumericLiteralName(member.name.text)) { - error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + else { + var text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } } var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; @@ -21476,8 +21731,10 @@ var ts; function checkSourceFileWorker(node) { var links = getNodeLinks(node); if (!(links.flags & 1)) { - if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) { - return; + if (compilerOptions.skipDefaultLibCheck) { + if (node.hasNoDefaultLib) { + return; + } } checkGrammarSourceFile(node); emitExtends = false; @@ -21486,7 +21743,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -21564,7 +21821,7 @@ var ts; } switch (location.kind) { case 248: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalOrCommonJsModule(location)) { break; } case 218: @@ -22123,15 +22380,24 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, - isArgumentsLocalBinding: isArgumentsLocalBinding + isArgumentsLocalBinding: isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration }; } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = ts.getExternalModuleName(declaration); + var moduleSymbol = getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return undefined; + } + return ts.getDeclarationOfKind(moduleSymbol, 248); + } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); @@ -22808,7 +23074,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 136 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); } } @@ -23122,11 +23388,15 @@ var ts; var writeTextOfNode; var writer = createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; - var currentSourceFile; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; var reportedDeclarationError = false; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare = !root; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; var referencePathsOutput = ""; @@ -23162,21 +23432,53 @@ var ts; } else { var emittedReferencedFiles = []; + var prevModuleElementDeclarationEmitInfo = []; ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + if (!ts.isDeclarationFile(sourceFile)) { if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && + if (referencedFile && (ts.isDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } }); } + } + if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; emitSourceFile(sourceFile); } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 222); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 1); + increaseIndent(); + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + decreaseIndent(); + } + }); + setWriter(oldWriter); + } + prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } }); + moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); } return { reportedDeclarationError: reportedDeclarationError, @@ -23185,13 +23487,12 @@ var ts; referencePathsOutput: referencePathsOutput }; function hasInternalAnnotation(range) { - var text = currentSourceFile.text; - var comment = text.substring(range.pos, range.end); + var comment = currentText.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node) { if (node) { - var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -23272,7 +23573,7 @@ var ts; var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } else { diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); @@ -23336,9 +23637,9 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); - ts.emitComments(currentSourceFile, writer, jsDocComments, true, newLine, ts.writeCommentRange); + var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); + ts.emitComments(currentText, currentLineMap, writer, jsDocComments, true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -23355,7 +23656,7 @@ var ts; case 103: case 97: case 9: - return writeTextOfNode(currentSourceFile, type); + return writeTextOfNode(currentText, type); case 188: return emitExpressionWithTypeArguments(type); case 151: @@ -23386,14 +23687,14 @@ var ts; } function writeEntityName(entityName) { if (entityName.kind === 69) { - writeTextOfNode(currentSourceFile, entityName); + writeTextOfNode(currentText, entityName); } else { var left = entityName.kind === 135 ? entityName.left : entityName.expression; var right = entityName.kind === 135 ? entityName.right : entityName.name; writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, right); + writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { @@ -23421,7 +23722,7 @@ var ts; } } function emitTypePredicate(type) { - writeTextOfNode(currentSourceFile, type.parameterName); + writeTextOfNode(currentText, type.parameterName); write(" is "); emitType(type.type); } @@ -23461,20 +23762,23 @@ var ts; } } function emitSourceFile(node) { - currentSourceFile = node; + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true); emitLines(node.statements); } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) { + if (!ts.hasProperty(currentIdentifiers, baseName)) { return baseName; } var count = 0; while (true) { var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentSourceFile.identifiers, name_18)) { + if (!ts.hasProperty(currentIdentifiers, name_18)) { return name_18; } } @@ -23482,7 +23786,7 @@ var ts; function emitExportAssignment(node) { if (node.expression.kind === 69) { write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentSourceFile, node.expression); + writeTextOfNode(currentText, node.expression); } else { var tempVarName = getExportDefaultTempVariableName(); @@ -23517,7 +23821,7 @@ var ts; writeModuleElement(node); } else if (node.kind === 221 || - (node.parent.kind === 248 && ts.isExternalModule(currentSourceFile))) { + (node.parent.kind === 248 && isCurrentFileExternalModule)) { var isVisible; if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { asynchronousSubModuleDeclarationEmitInfo.push({ @@ -23569,14 +23873,14 @@ var ts; } } function emitModuleElementDeclarationFlags(node) { - if (node.parent === currentSourceFile) { + if (node.parent.kind === 248) { if (node.flags & 2) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 215) { + else if (node.kind !== 215 && !noDeclare) { write("declare "); } } @@ -23601,7 +23905,7 @@ var ts; write("export "); } write("import "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" = "); if (ts.isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); @@ -23609,7 +23913,7 @@ var ts; } else { write("require("); - writeTextOfNode(currentSourceFile, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -23643,7 +23947,7 @@ var ts; if (node.importClause) { var currentWriterPos = writer.getTextPos(); if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentSourceFile, node.importClause.name); + writeTextOfNode(currentText, node.importClause.name); } if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { if (currentWriterPos !== writer.getTextPos()) { @@ -23651,7 +23955,7 @@ var ts; } if (node.importClause.namedBindings.kind === 224) { write("* as "); - writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); + writeTextOfNode(currentText, node.importClause.namedBindings.name); } else { write("{ "); @@ -23661,16 +23965,28 @@ var ts; } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); write(";"); writer.writeLine(); } + function emitExternalModuleSpecifier(moduleSpecifier) { + if (moduleSpecifier.kind === 9 && (!root) && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + if (moduleName) { + write("\""); + write(moduleName); + write("\""); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } function emitImportOrExportSpecifier(node) { if (node.propertyName) { - writeTextOfNode(currentSourceFile, node.propertyName); + writeTextOfNode(currentText, node.propertyName); write(" as "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } function emitExportSpecifier(node) { emitImportOrExportSpecifier(node); @@ -23690,7 +24006,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); } write(";"); writer.writeLine(); @@ -23704,11 +24020,11 @@ var ts; else { write("module "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); while (node.body.kind !== 219) { node = node.body; write("."); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; @@ -23727,7 +24043,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); @@ -23749,7 +24065,7 @@ var ts; write("const "); } write("enum "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" {"); writeLine(); increaseIndent(); @@ -23760,7 +24076,7 @@ var ts; } function emitEnumMemberDeclaration(node) { emitJsDocComments(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); @@ -23777,7 +24093,7 @@ var ts; increaseIndent(); emitJsDocComments(node); decreaseIndent(); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); if (node.parent.kind === 152 || @@ -23887,7 +24203,7 @@ var ts; write("abstract "); } write("class "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -23910,7 +24226,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("interface "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -23940,7 +24256,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { write("?"); } @@ -24014,7 +24330,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError); } } @@ -24055,7 +24371,7 @@ var ts; emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (!(node.flags & 16)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); @@ -24136,13 +24452,13 @@ var ts; } if (node.kind === 213) { write("function "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } else if (node.kind === 144) { write("constructor"); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (ts.hasQuestionToken(node)) { write("?"); } @@ -24255,7 +24571,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } if (resolver.isOptionalParameter(node)) { write("?"); @@ -24354,7 +24670,7 @@ var ts; } else if (bindingElement.kind === 163) { if (bindingElement.propertyName) { - writeTextOfNode(currentSourceFile, bindingElement.propertyName); + writeTextOfNode(currentText, bindingElement.propertyName); write(": "); } if (bindingElement.name) { @@ -24366,7 +24682,7 @@ var ts; if (bindingElement.dotDotDotToken) { write("..."); } - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); } } } @@ -24449,6 +24765,18 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || ts.isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -24718,15 +25046,19 @@ var ts; var newLine = host.getNewLine(); var jsxDesugaring = host.getCompilerOptions().jsx !== 1; var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; + var outFile = compilerOptions.outFile || compilerOptions.out; + var emitJavaScript = createFileEmitter(); if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); + if (outFile) { + emitFile(outFile); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); } } else { @@ -24734,8 +25066,8 @@ var ts; var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { + emitFile(outFile); } } diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); @@ -24785,20 +25117,26 @@ var ts; } } } - function emitJavaScript(jsFilePath, root) { + function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var currentText; + var currentLineMap; + var currentFileIdentifiers; + var renamedDependencies; + var isEs6Module; + var isCurrentFileExternalModule; var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; + var generatedNameSet; + var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; var convertedLoopState; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; + var extendsEmitted; + var decorateEmitted; + var paramEmitted; + var awaiterEmitted; + var tempFlags; var tempVariables; var tempParameters; var externalImports; @@ -24815,6 +25153,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; + var root; var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; var moduleEmitDelegates = (_a = {}, _a[5] = emitES6Module, @@ -24824,30 +25163,75 @@ var ts; _a[1] = emitCommonJSModule, _a ); - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); + var bundleEmitDelegates = (_b = {}, + _b[5] = function () { }, + _b[2] = emitAMDModule, + _b[4] = emitSystemModule, + _b[3] = function () { }, + _b[1] = function () { }, + _b + ); + return doEmit; + function doEmit(jsFilePath, rootFile) { + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + generatedNameSet = {}; + nodeToGeneratedName = []; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + root = rootFile; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(jsFilePath, root); + } + if (root) { + emitSourceFile(root); + } + else { + if (modulekind) { + ts.forEach(host.getSourceFiles(), emitEmitHelpers); } - }); + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), jsFilePath, compilerOptions.emitBOM); } - writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); - return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + currentText = sourceFile.text; + currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(sourceFile); emit(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(currentFileIdentifiers, name) && !ts.hasProperty(generatedNameSet, name); } function makeTempVariableName(flags) { @@ -24920,7 +25304,7 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps() { + function initializeEmitterWithSourceMaps(jsFilePath, root) { var sourceMapDir; var sourceMapSourceIndex = -1; var sourceMapNameIndexMap = {}; @@ -24989,7 +25373,7 @@ var ts; } } function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); sourceLinePos.line++; sourceLinePos.character++; var emittedLine = writer.getLine(); @@ -25017,13 +25401,13 @@ var ts; } } function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); } function recordEmitNodeEndSpan(node) { recordSourceMapSpan(node.end); } function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + var tokenStartPos = ts.skipTrivia(currentText, startPos); recordSourceMapSpan(tokenStartPos); var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); @@ -25093,9 +25477,9 @@ var ts; sourceMapNameIndices.pop(); } ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); recordSourceMapSpan(comment.end); } function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { @@ -25125,7 +25509,7 @@ var ts; return output; } } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); @@ -25138,7 +25522,7 @@ var ts; ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); } var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); sourceMapData = { @@ -25201,7 +25585,7 @@ var ts; scopeEmitEnd = recordScopeNameEnd; writeComment = writeCommentRangeWithMap; } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(flags) { @@ -25371,7 +25755,7 @@ var ts; return getQuotedEscapedLiteralText("\"", node.text, "\""); } if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: @@ -25393,7 +25777,7 @@ var ts; return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; } function emitDownlevelRawTemplateLiteral(node) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var text = ts.getTextOfNodeFromSourceText(currentText, node); var isLast = node.kind === 11 || node.kind === 14; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); @@ -25723,7 +26107,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } write("\""); } @@ -25819,7 +26203,7 @@ var ts; else if (declaration.kind === 226) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); if (languageVersion === 0 && identifier === "default") { write("[\"default\"]"); } @@ -25843,7 +26227,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function isNameOfNestedRedeclaration(node) { @@ -25880,7 +26264,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function emitThis(node) { @@ -26247,8 +26631,8 @@ var ts; return container && container.kind !== 248; } function emitShorthandPropertyAssignment(node) { - writeTextOfNode(currentSourceFile, node.name); - if (languageVersion < 2 || isNamespaceExportReference(node.name)) { + writeTextOfNode(currentText, node.name); + if (modulekind !== 5 || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -26298,10 +26682,10 @@ var ts; } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - var shouldEmitSpace; + var shouldEmitSpace = false; if (!indentedBeforeDot) { if (node.expression.kind === 8) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; } else { @@ -27307,16 +27691,16 @@ var ts; emitToken(16, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 241) { @@ -27421,7 +27805,7 @@ var ts; if (node.parent.kind === 248) { ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); if (modulekind === 1 || modulekind === 2 || modulekind === 3) { - if (!currentSourceFile.symbol.exports["___esModule"]) { + if (!isEs6Module) { if (languageVersion === 1) { write("Object.defineProperty(exports, \"__esModule\", { value: true });"); writeLine(); @@ -27584,12 +27968,18 @@ var ts; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 69) { - return createElementAccessExpression(object, syntheticName); + var index; + var nameIsComputed = propName.kind === 136; + if (nameIsComputed) { + index = ensureIdentifier(propName.expression, false); } - return createPropertyAccessExpression(object, syntheticName); + else { + index = ts.createSynthesizedNode(propName.kind); + index.text = propName.text; + } + return !nameIsComputed && index.kind === 69 + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { var call = ts.createSynthesizedNode(168); @@ -28003,7 +28393,6 @@ var ts; var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); var isArrowFunction = node.kind === 174; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; - var args; if (!isArrowFunction) { write(" {"); increaseIndent(); @@ -29177,8 +29566,8 @@ var ts; } } function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + if (renamedDependencies && ts.hasProperty(renamedDependencies, moduleName.text)) { + return "\"" + renamedDependencies[moduleName.text] + "\""; } return undefined; } @@ -29318,7 +29707,7 @@ var ts; return; } if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); var variableDeclarationIsHoisted = shouldHoistVariable(node, true); @@ -29530,7 +29919,7 @@ var ts; function getLocalNameForExternalImport(node) { var namespaceDeclaration = getNamespaceDeclarationNode(node); if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } if (node.kind === 222 && node.importClause) { return getGeneratedNameForNode(node); @@ -29803,7 +30192,7 @@ var ts; ts.getEnclosingBlockScopeContainer(node).kind === 248; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 && ts.isExternalModule(currentSourceFile); + return modulekind === 4 && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); @@ -29916,15 +30305,19 @@ var ts; writeLine(); write("}"); } - function emitSystemModule(node) { + function writeModuleName(node, emitRelativePathAsModuleName) { + var moduleName = node.moduleName; + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { + write("\"" + moduleName + "\", "); + } + } + function emitSystemModule(node, emitRelativePathAsModuleName) { collectExternalModuleInfo(node); ts.Debug.assert(!exportFunctionForFile); exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } + writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; @@ -29942,6 +30335,12 @@ var ts; if (i !== 0) { write(", "); } + if (emitRelativePathAsModuleName) { + var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); + if (name_29) { + text = "\"" + name_29 + "\""; + } + } write(text); } write("], function(" + exportFunctionForFile + ") {"); @@ -29955,7 +30354,7 @@ var ts; writeLine(); write("});"); } - function getAMDDependencyNames(node, includeNonAmdDependencies) { + function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { var aliasedModuleNames = []; var unaliasedModuleNames = []; var importAliasNames = []; @@ -29972,6 +30371,12 @@ var ts; for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; var externalModuleName = getExternalModuleNameText(importNode); + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + externalModuleName = "\"" + name_30 + "\""; + } + } var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); @@ -29983,8 +30388,8 @@ var ts; } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - function emitAMDDependencies(node, includeNonAmdDependencies) { - var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -30011,15 +30416,13 @@ var ts; } write(") {"); } - function emitAMDModule(node) { + function emitAMDModule(node, emitRelativePathAsModuleName) { emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, true); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, true, emitRelativePathAsModuleName); increaseIndent(); var startIndex = emitDirectivePrologues(node.statements, true); emitExportStarHelper(); @@ -30225,8 +30628,13 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; - emitModule(node); + if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + emitModule(node); + } + else { + bundleEmitDelegates[modulekind](node, true); + } } else { var startIndex = emitDirectivePrologues(node.statements, false); @@ -30470,7 +30878,7 @@ var ts; return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; } function getLeadingCommentsWithoutDetachedComments() { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -30480,10 +30888,10 @@ var ts; return leadingComments; } function isTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + if (currentText.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + currentText.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentText.substring(comment.pos, comment.end); return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? true : false; @@ -30497,7 +30905,7 @@ var ts; return getLeadingCommentsWithoutDetachedComments(); } else { - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); } } } @@ -30505,7 +30913,7 @@ var ts; function getTrailingCommentsToEmit(node) { if (node.parent) { if (node.parent.kind === 248 || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + return ts.getTrailingCommentRanges(currentText, node.end); } } } @@ -30528,22 +30936,22 @@ var ts; leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { return; } var trailingComments = getTrailingCommentsToEmit(node); - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, false, newLine, writeComment); } function emitTrailingCommentsOfPosition(pos) { if (compilerOptions.removeComments) { return; } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + var trailingComments = ts.getTrailingCommentRanges(currentText, pos); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, true, newLine, writeComment); } function emitLeadingCommentsOfPositionWorker(pos) { if (compilerOptions.removeComments) { @@ -30554,13 +30962,13 @@ var ts; leadingComments = getLeadingCommentsWithoutDetachedComments(); } else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + leadingComments = ts.getLeadingCommentRanges(currentText, pos); } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAndUpdateCommentsInfo(node) { - var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); if (currentDetachedCommentInfo) { if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -30571,12 +30979,12 @@ var ts; } } function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); + var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); } } - var _a; + var _a, _b; } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -30632,11 +31040,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -30646,8 +31054,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { - return ts.forEach(ts.moduleFileExtensions, tryLoad); + function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + return ts.forEach(extensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -30659,7 +31067,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -30671,7 +31079,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -30680,7 +31088,7 @@ var ts; else { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -30690,11 +31098,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -30719,9 +31127,10 @@ var ts; var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { return undefined; } @@ -30749,10 +31158,8 @@ var ts; ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { module: 1, - target: 0, + target: 1, noImplicitAny: false, - outDir: "built", - rootDir: ".", sourceMap: false }; function createCompilerHost(options, setParentNodes) { @@ -31110,35 +31517,47 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, true); + collect(node, true, false); } file.imports = imports || emptyArray; - function collect(node, allowRelativeModuleNames) { - switch (node.kind) { - case 222: - case 221: - case 228: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + return; + function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { + if (!collectOnlyRequireCalls) { + switch (node.kind) { + case 222: + case 221: + case 228: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - } - if (!moduleNameExpr.text) { + case 218: + if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + collect(node, false, collectOnlyRequireCalls); + }); + } break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case 218: - if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - collect(node, false); - }); - } - break; + } + } + if (isJavaScriptFile) { + if (ts.isRequireCall(node)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, true); }); + } } } } @@ -31225,7 +31644,6 @@ var ts; } processImportedModules(file, basePath); if (isDefaultLib) { - file.isDefaultLib = true; files.unshift(file); } else { @@ -31298,6 +31716,9 @@ var ts; commonPathComponents.length = sourcePathComponents.length; } }); + if (!commonPathComponents) { + return currentDirectory; + } return ts.getNormalizedPathFromPathComponents(commonPathComponents); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { @@ -31380,10 +31801,12 @@ var ts; if (options.module === 5 && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } + if (outFile && options.module && !(options.module === 2 || options.module === 4)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } if (options.outDir || options.sourceRoot || - (options.mapRoot && - (!outFile || firstExternalModuleSourceFile !== undefined))) { + options.mapRoot) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -31862,20 +32285,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_29 = sysFiles[i]; - if (ts.fileExtensionIs(name_29, ".d.ts")) { - var baseName = name_29.substr(0, name_29.length - ".d.ts".length); + var name_31 = sysFiles[i]; + if (ts.fileExtensionIs(name_31, ".d.ts")) { + var baseName = name_31.substr(0, name_31.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_29); + fileNames.push(name_31); } } - else if (ts.fileExtensionIs(name_29, ".ts")) { - if (!ts.contains(sysFiles, name_29 + "x")) { - fileNames.push(name_29); + else if (ts.fileExtensionIs(name_31, ".ts")) { + if (!ts.contains(sysFiles, name_31 + "x")) { + fileNames.push(name_31); } } else { - fileNames.push(name_29); + fileNames.push(name_31); } } } @@ -31994,14 +32417,15 @@ var ts; var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments); return diagnostic.messageText; } + function getRelativeFileName(fileName, host) { + return host ? ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : fileName; + } function reportDiagnosticSimply(diagnostic, host) { var output = ""; if (diagnostic.file) { var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; - var relativeFileName = host - ? ts.convertToRelativePath(diagnostic.file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) - : diagnostic.file.fileName; - output += diagnostic.file.fileName + "(" + (line + 1) + "," + (character + 1) + "): "; + var relativeFileName = getRelativeFileName(diagnostic.file.fileName, host); + output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): "; } var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; @@ -32030,6 +32454,7 @@ var ts; var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; var _b = ts.getLineAndCharacterOfPosition(file, start + length_3), lastLine = _b.line, lastLineChar = _b.character; var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line; + var relativeFileName = getRelativeFileName(file.fileName, host); var hasMoreThanFiveLines = (lastLine - firstLine) >= 4; var gutterWidth = (lastLine + 1 + "").length; if (hasMoreThanFiveLines) { @@ -32065,7 +32490,7 @@ var ts; output += ts.sys.newLine; } output += ts.sys.newLine; - output += file.fileName + "(" + (firstLine + 1) + "," + (firstLineChar + 1) + "): "; + output += relativeFileName + "(" + (firstLine + 1) + "," + (firstLineChar + 1) + "): "; } var categoryColor = categoryFormatMap[diagnostic.category]; var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); @@ -32191,8 +32616,19 @@ var ts; return; } } + if (!cachedConfigFileText) { + var error = ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, configFileName); + reportDiagnostics([error], undefined); + ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + return; + } var result = ts.parseConfigFileTextToJson(configFileName, cachedConfigFileText); var configObject = result.config; + if (!configObject) { + reportDiagnostics([result.error], undefined); + ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + return; + } var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors, undefined); @@ -32455,10 +32891,10 @@ var ts; function serializeCompilerOptions(options) { var result = {}; var optionsNameMap = ts.getOptionNameMap().optionNameMap; - for (var name_30 in options) { - if (ts.hasProperty(options, name_30)) { - var value = options[name_30]; - switch (name_30) { + for (var name_32 in options) { + if (ts.hasProperty(options, name_32)) { + var value = options[name_32]; + switch (name_32) { case "init": case "watch": case "version": @@ -32466,17 +32902,17 @@ var ts; case "project": break; default: - var optionDefinition = optionsNameMap[name_30.toLowerCase()]; + var optionDefinition = optionsNameMap[name_32.toLowerCase()]; if (optionDefinition) { if (typeof optionDefinition.type === "string") { - result[name_30] = value; + result[name_32] = value; } else { var typeMap = optionDefinition.type; for (var key in typeMap) { if (ts.hasProperty(typeMap, key)) { if (typeMap[key] === value) - result[name_30] = key; + result[name_32] = key; } } } diff --git a/lib/tsserver.js b/lib/tsserver.js index 2893dab82ef..9f0c1674080 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -665,7 +665,7 @@ var ts; } ts.fileExtensionIs = fileExtensionIs; ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.moduleFileExtensions = ts.supportedExtensions; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); function isSupportedSourceFileName(fileName) { if (!fileName) { return false; @@ -716,17 +716,16 @@ var ts; } function Signature(checker) { } + function Node(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0; + this.parent = undefined; + } ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0; - this.parent = undefined; - } - Node.prototype = { kind: kind }; - return Node; - }, + getNodeConstructor: function () { return Node; }, + getSourceFileConstructor: function () { return Node; }, getSymbolConstructor: function () { return Symbol; }, getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } @@ -1003,7 +1002,16 @@ var ts; if (writeByteOrderMark) { data = "\uFEFF" + data; } - _fs.writeFileSync(fileName, data, "utf8"); + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync(fd, data, undefined, "utf8"); + } + finally { + if (fd !== undefined) { + _fs.closeSync(fd); + } + } } function getCanonicalPath(path) { return useCaseSensitiveFileNames ? path.toLowerCase() : path; @@ -1688,6 +1696,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, + Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2148,7 +2157,7 @@ var ts; function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; - while (true) { + while (pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13: @@ -2217,6 +2226,7 @@ var ts; } return result; } + return result; } function getLeadingCommentRanges(text, pos) { return getCommentRanges(text, pos, false); @@ -2312,7 +2322,7 @@ var ts; error(ts.Diagnostics.Digit_expected); } } - return +(text.substring(start, end)); + return "" + +(text.substring(start, end)); } function scanOctalDigits() { var start = pos; @@ -2704,7 +2714,7 @@ var ts; return pos++, token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8; } if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { @@ -2801,7 +2811,7 @@ var ts; case 55: case 56: case 57: - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8; case 58: return pos++, token = 54; @@ -3879,6 +3889,10 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 4096) !== 0; } @@ -3925,18 +3939,26 @@ var ts; return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 138 || node.kind === 137) ? - ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : - getLeadingCommentRangesOfNode(node, sourceFileOfNode); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; - } + return getJsDocCommentsFromText(node, sourceFileOfNode.text); } ts.getJsDocComments = getJsDocComments; + function getJsDocCommentsFromText(node, text) { + var commentRanges = (node.kind === 138 || node.kind === 137) ? + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); + return ts.filter(commentRanges, isJsDocComment); + function isJsDocComment(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 42 && + text.charCodeAt(comment.pos + 3) !== 47; + } + } + ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { @@ -4465,6 +4487,41 @@ var ts; return node.kind === 221 && node.moduleReference.kind !== 232; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(expression) { + return expression.kind === 168 && + expression.expression.kind === 69 && + expression.expression.text === "require" && + expression.arguments.length === 1 && + expression.arguments[0].kind === 9; + } + ts.isRequireCall = isRequireCall; + function isExportsPropertyAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + function isModuleExportsAssignment(expression) { + return isInJavaScriptFile(expression) && + (expression.kind === 181) && + (expression.operatorToken.kind === 56) && + (expression.left.kind === 166) && + (expression.left.expression.kind === 69) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { if (node.kind === 222) { return node.moduleSpecifier; @@ -4776,8 +4833,8 @@ var ts; function getFileReferenceFromReferencePath(comment, commentRange) { var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.exec(comment)) { - if (isNoDefaultLibRegEx.exec(comment)) { + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; @@ -4819,12 +4876,20 @@ var ts; return isFunctionLike(node) && (node.flags & 256) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; + function isStringOrNumericLiteral(kind) { + return kind === 9 || kind === 8; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 136 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && isDynamicName(declaration.name); } ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 136 && + !isStringOrNumericLiteral(name.expression.kind) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; function isWellKnownSymbolSyntactically(node) { return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } @@ -5045,11 +5110,11 @@ var ts; } ts.getIndentSize = getIndentSize; function createTextWriter(newLine) { - var output = ""; - var indent = 0; - var lineStart = true; - var lineCount = 0; - var linePos = 0; + var output; + var indent; + var lineStart; + var lineCount; + var linePos; function write(s) { if (s && s.length) { if (lineStart) { @@ -5059,6 +5124,13 @@ var ts; output += s; } } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } function rawWrite(s) { if (s !== undefined) { if (lineStart) { @@ -5085,9 +5157,10 @@ var ts; lineStart = true; } } - function writeTextOfNode(sourceFile, node) { - write(getSourceTextOfNodeFromSourceFile(sourceFile, node)); + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); } + reset(); return { write: write, rawWrite: rawWrite, @@ -5100,10 +5173,17 @@ var ts; getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + getText: function () { return output; }, + reset: reset }; } ts.createTextWriter = createTextWriter; + function getExternalModuleNameFromPath(host, fileName) { + var dir = host.getCurrentDirectory(); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, false); + return ts.removeFileExtension(relativePath); + } + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); var emitOutputFilePathWithoutExtension; @@ -5132,6 +5212,10 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + } + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { if (member.kind === 144 && nodeIsPresent(member.body)) { @@ -5202,21 +5286,21 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { var emitLeadingSpace = !trailingSeparator; ts.forEach(comments, function (comment) { if (emitLeadingSpace) { writer.write(" "); emitLeadingSpace = false; } - writeComment(currentSourceFile, writer, comment, newLine); + writeComment(text, lineMap, writer, comment, newLine); if (comment.hasTrailingNewLine) { writer.writeLine(); } @@ -5229,16 +5313,16 @@ var ts; }); } ts.emitComments = emitComments; - function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { var leadingComments; var currentDetachedCommentInfo; if (removeComments) { if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); } } else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + leadingComments = ts.getLeadingCommentRanges(text, node.pos); } if (leadingComments) { var detachedComments = []; @@ -5246,8 +5330,8 @@ var ts; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) { break; } @@ -5256,37 +5340,37 @@ var ts; lastComment = comment; } if (detachedComments.length) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); if (nodeLine >= lastCommentLine + 2) { - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; } } } return currentDetachedCommentInfo; function isPinnedComment(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 33; } } ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(currentSourceFile, writer, comment, newLine) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { - var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lineCount = ts.getLineStarts(currentSourceFile).length; + function writeCommentRange(text, lineMap, writer, comment, newLine) { + if (text.charCodeAt(comment.pos + 1) === 42) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + var lineCount = lineMap.length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + ? text.length + 1 + : lineMap[currentLine + 1]; if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); @@ -5300,40 +5384,40 @@ var ts; writer.rawWrite(""); } } - writeTrimmedCurrentLine(pos, nextLineStart); + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { - writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); - } - function writeTrimmedCurrentLine(pos, nextLineStart) { - var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - writer.write(currentLineText); - if (end !== comment.end) { - writer.writeLine(); - } - } - else { - writer.writeLiteral(newLine); - } - } - function calculateIndent(pos, end) { - var currentLineIndent = 0; - for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === 9) { - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - currentLineIndent++; - } - } - return currentLineIndent; + writer.write(text.substring(comment.pos, comment.end)); } } ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; + } function modifierToFlag(token) { switch (token) { case 113: return 64; @@ -5427,14 +5511,14 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; - function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function allowsJsxExpressions(fileName) { + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isTsx = isTsx; + ts.allowsJsxExpressions = allowsJsxExpressions; function getExpandedCharCodes(input) { var output = []; var length = input.length; @@ -5644,14 +5728,16 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(272); ts.parseTime = 0; - function getNodeConstructor(kind) { - return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); - } - ts.getNodeConstructor = getNodeConstructor; + var NodeConstructor; + var SourceFileConstructor; function createNode(kind, pos, end) { - return new (getNodeConstructor(kind))(pos, end); + if (kind === 248) { + return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end); + } } ts.createNode = createNode; function visitNode(cbNode, node) { @@ -6050,6 +6136,8 @@ var ts; (function (Parser) { var scanner = ts.createScanner(2, true); var disallowInAndDecoratorContext = 1 | 4; + var NodeConstructor; + var SourceFileConstructor; var sourceFile; var parseDiagnostics; var syntaxCursor; @@ -6062,13 +6150,16 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + NodeConstructor = ts.objectAllocator.getNodeConstructor(); + SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -6076,12 +6167,12 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 : 0; + contextFlags = isJavaScriptFile ? 32 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.isTsx(fileName) ? 1 : 0); + scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 : 0); } function clearState() { scanner.setText(""); @@ -6094,6 +6185,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32) { + sourceFile.parserContextFlags = 32; + } token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -6107,7 +6201,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -6153,15 +6247,14 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(248, 0); - sourceFile.pos = 0; - sourceFile.end = sourceText.length; + var sourceFile = new SourceFileConstructor(248, 0, sourceText.length); + nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; - sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 : 0; + sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 : 0; return sourceFile; } function setContextFlag(val, flag) { @@ -6383,7 +6476,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos); + return new NodeConstructor(kind, pos, pos); } function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; @@ -6521,7 +6614,7 @@ var ts; case 12: return token === 19 || token === 37 || isLiteralPropertyName(); case 9: - return isLiteralPropertyName(); + return token === 19 || isLiteralPropertyName(); case 7: if (token === 15) { return lookAhead(isValidHeritageClauseObjectLiteral); @@ -7042,9 +7135,7 @@ var ts; } function parseParameterType() { if (parseOptional(54)) { - return token === 9 - ? parseLiteralNode(true) - : parseType(); + return parseType(); } return undefined; } @@ -7301,6 +7392,8 @@ var ts; case 131: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); + case 9: + return parseLiteralNode(true); case 103: case 97: return parseTokenNode(); @@ -7330,6 +7423,7 @@ var ts; case 19: case 25: case 92: + case 9: return true; case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -7843,7 +7937,6 @@ var ts; var unaryOperator = token; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { - var diagnostic; var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); if (simpleUnaryExpression.kind === 171) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); @@ -9507,7 +9600,7 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -9758,7 +9851,7 @@ var ts; } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, undefined); + initializeState("file.js", content, 2, true, undefined); var jsDocComment = parseJSDocComment(undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -10394,6 +10487,9 @@ var ts; } if (node.name.kind === 136) { var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); } @@ -10414,6 +10510,8 @@ var ts; return "__export"; case 227: return node.isExportEquals ? "export=" : "default"; + case 181: + return "export="; case 213: case 214: return node.flags & 512 ? "default" : undefined; @@ -11033,6 +11131,14 @@ var ts; case 69: return checkStrictModeIdentifier(node); case 181: + if (ts.isInJavaScriptFile(node)) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } return checkStrictModeBinaryExpression(node); case 244: return checkStrictModeCatchClause(node); @@ -11092,6 +11198,11 @@ var ts; checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); + case 168: + if (ts.isInJavaScriptFile(node)) { + bindCallExpression(node); + } + break; case 186: case 214: return bindClassLikeDeclaration(node); @@ -11121,14 +11232,18 @@ var ts; function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + bindSourceFileAsExternalModule(); } } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } function bindExportAssignment(node) { + var boundExpression = node.kind === 227 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 69) { + else if (boundExpression.kind === 69) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -11148,6 +11263,25 @@ var ts; declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); } } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + } + function bindModuleExportsAssignment(node) { + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } function bindClassLikeDeclaration(node) { if (node.kind === 214) { bindBlockScopedDeclaration(node, 32, 899519); @@ -11268,7 +11402,7 @@ var ts; function checkUnreachable(node) { switch (currentReachabilityState) { case 4: - var reportError = ts.isStatement(node) || + var reportError = (ts.isStatement(node) && node.kind !== 194) || node.kind === 214 || (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); @@ -11364,7 +11498,7 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: getApparentTypeOfContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -11620,7 +11754,7 @@ var ts; return ts.getAncestor(node, 248); } function isGlobalSourceFile(node) { - return node.kind === 248 && !ts.isExternalModule(node); + return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -11706,23 +11840,24 @@ var ts; } switch (location.kind) { case 248: - if (!ts.isExternalModule(location)) + if (!ts.isExternalOrCommonJsModule(location)) break; case 218: var moduleExports = getSymbolOfNode(location).exports; if (location.kind === 248 || (location.kind === 218 && location.name.kind === 9)) { + if (result = moduleExports["default"]) { + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && ts.getDeclarationOfKind(moduleExports[name], 230)) { break; } - result = moduleExports["default"]; - var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { - break loop; - } - result = undefined; } if (result = getSymbol(moduleExports, name, meaning & 8914931)) { break loop; @@ -12080,6 +12215,9 @@ var ts; if (moduleName === undefined) { return; } + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); @@ -12250,7 +12388,7 @@ var ts; } switch (location_1.kind) { case 248: - if (!ts.isExternalModule(location_1)) { + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } case 218: @@ -12377,7 +12515,7 @@ var ts; } function hasExternalModuleSymbol(declaration) { return (declaration.kind === 218 && declaration.name.kind === 9) || - (declaration.kind === 248 && ts.isExternalModule(declaration)); + (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -12575,7 +12713,7 @@ var ts; writeAnonymousType(type, flags); } else if (type.flags & 256) { - writer.writeStringLiteral(type.text); + writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); } else { writePunctuation(writer, 15); @@ -12939,7 +13077,7 @@ var ts; } } else if (node.kind === 248) { - return ts.isExternalModule(node) ? node : undefined; + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -13144,6 +13282,23 @@ var ts; var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); } + function getTextOfPropertyName(name) { + switch (name.kind) { + case 69: + return name.text; + case 9: + case 8: + return name.text; + case 136: + if (ts.isStringOrNumericLiteral(name.expression.kind)) { + return name.expression.text; + } + } + return undefined; + } + function isComputedNonLiteralName(name) { + return name.kind === 136 && !ts.isStringOrNumericLiteral(name.expression.kind); + } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -13159,8 +13314,12 @@ var ts; var type; if (pattern.kind === 161) { var name_11 = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, name_11.text) || - isNumericLiteralName(name_11.text) && getIndexTypeOfType(parentType, 1) || + if (isComputedNonLiteralName(name_11)) { + return anyType; + } + var text = getTextOfPropertyName(name_11); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { error(name_11, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_11)); @@ -13238,10 +13397,16 @@ var ts; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; + var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { - var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + if (isComputedNonLiteralName(name)) { + hasComputedProperties = true; + return; + } + var text = getTextOfPropertyName(name); + var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType); symbol.bindingElement = e; members[symbol.name] = symbol; @@ -13250,6 +13415,9 @@ var ts; if (includePatternInType) { result.pattern = pattern; } + if (hasComputedProperties) { + result.flags |= 67108864; + } return result; } function getTypeFromArrayBindingPattern(pattern, includePatternInType) { @@ -13300,6 +13468,12 @@ var ts; if (declaration.kind === 227) { return links.type = checkExpression(declaration.expression); } + if (declaration.kind === 181) { + return links.type = checkExpression(declaration.right); + } + if (declaration.kind === 166) { + return checkExpressionCached(declaration.parent.right); + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } @@ -13549,17 +13723,19 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseContructorType = getBaseConstructorTypeOfClass(type); - if (!(baseContructorType.flags & 80896)) { + var baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & 80896)) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); var baseType; - if (baseContructorType.symbol && baseContructorType.symbol.flags & 32) { - baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseContructorType.symbol); + var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 && + areAllOuterTypeParametersApplied(originalBaseType)) { + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } else { - var constructors = getInstantiatedConstructorsForTypeArguments(baseContructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -13584,6 +13760,15 @@ var ts; type.resolvedBaseTypes.push(baseType); } } + function areAllOuterTypeParametersApplied(type) { + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last = outerTypeParameters.length - 1; + var typeArguments = type.typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; + } + return true; + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { @@ -13655,7 +13840,7 @@ var ts; type.typeArguments = type.typeParameters; type.thisType = createType(512 | 33554432); type.thisType.symbol = symbol; - type.thisType.constraint = getTypeWithThisArgument(type); + type.thisType.constraint = type; } } return links.declaredType; @@ -14130,14 +14315,19 @@ var ts; type = getApparentType(type); return type.flags & 49152 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getApparentTypeOfTypeParameter(type) { + if (!type.resolvedApparentType) { + var constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & 512) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } function getApparentType(type) { if (type.flags & 512) { - do { - type = getConstraintOfTypeParameter(type); - } while (type && type.flags & 512); - if (!type) { - type = emptyObjectType; - } + type = getApparentTypeOfTypeParameter(type); } if (type.flags & 258) { type = globalStringType; @@ -14290,7 +14480,7 @@ var ts; if (node.initializer) { var signatureDeclaration = node.parent; var signature = getSignatureFromDeclaration(signatureDeclaration); - var parameterIndex = signatureDeclaration.parameters.indexOf(node); + var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } @@ -14385,6 +14575,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3)) { @@ -14846,11 +15046,12 @@ var ts; return links.resolvedType; } function getStringLiteralType(node) { - if (ts.hasProperty(stringLiteralTypes, node.text)) { - return stringLiteralTypes[node.text]; + var text = node.text; + if (ts.hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; } - var type = stringLiteralTypes[node.text] = createType(256); - type.text = ts.getTextOfNode(node); + var type = stringLiteralTypes[text] = createType(256); + type.text = text; return type; } function getTypeFromStringLiteral(node) { @@ -15319,7 +15520,7 @@ var ts; return false; } function hasExcessProperties(source, target, reportErrors) { - if (someConstituentTypeHasKind(target, 80896)) { + if (!(target.flags & 67108864) && someConstituentTypeHasKind(target, 80896)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -15409,9 +15610,6 @@ var ts; return result; } function typeParameterIdenticalTo(source, target) { - if (source.symbol.name !== target.symbol.name) { - return 0; - } if (source.constraint === target.constraint) { return -1; } @@ -15856,18 +16054,24 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } + function isMatchingSignature(source, target, partialMatch) { + if (source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter) { + return true; + } + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; + } function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { - if (!partialMatch || - source.parameters.length < target.parameters.length && !source.hasRestParameter || - source.minArgumentCount > target.minArgumentCount) { - return 0; - } + if (!(isMatchingSignature(source, target, partialMatch))) { + return 0; } var result = -1; if (source.typeParameters && target.typeParameters) { @@ -15952,6 +16156,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isStringLiteralType(type) { + return type.flags & 256; + } function isTupleType(type) { return !!(type.flags & 8192); } @@ -16543,7 +16750,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -16571,6 +16778,12 @@ var ts; } } if (targetType) { + if (!assumeTrue) { + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); + } + return type; + } return getNarrowedType(type, targetType); } return type; @@ -16982,6 +17195,9 @@ var ts; function getIndexTypeOfContextualType(type, kind) { return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } + function contextualTypeIsStringLiteralType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isStringLiteralType) : isStringLiteralType(type)); + } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } @@ -16997,7 +17213,7 @@ var ts; } function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; - var type = getContextualType(objectLiteral); + var type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!ts.hasDynamicName(element)) { var symbolName = getSymbolOfNode(element).name; @@ -17013,7 +17229,7 @@ var ts; } function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; - var type = getContextualType(arrayLiteral); + var type = getApparentTypeOfContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) @@ -17042,11 +17258,11 @@ var ts; } return undefined; } - function getContextualType(node) { - var type = getContextualTypeWorker(node); + function getApparentTypeOfContextualType(node) { + var type = getContextualType(node); return type && getApparentType(type); } - function getContextualTypeWorker(node) { + function getContextualType(node) { if (isInsideWithStatementBody(node)) { return undefined; } @@ -17112,7 +17328,7 @@ var ts; ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + : getApparentTypeOfContextualType(node); if (!type) { return undefined; } @@ -17195,7 +17411,7 @@ var ts; type.pattern = node; return type; } - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { @@ -17250,10 +17466,11 @@ var ts; checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); var typeFlags = 0; + var patternWithComputedProperties = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -17279,8 +17496,11 @@ var ts; if (isOptional) { prop.flags |= 536870912; } + if (ts.hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } } - else if (contextualTypeHasPattern) { + else if (contextualTypeHasPattern && !(contextualType.flags & 67108864)) { var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { prop.flags |= impliedProp.flags & 536870912; @@ -17323,7 +17543,7 @@ var ts; var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; - result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); + result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064) | (patternWithComputedProperties ? 67108864 : 0); if (inDestructuringPattern) { result.pattern = node; } @@ -18538,6 +18758,9 @@ var ts; return anyType; } } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -18548,7 +18771,9 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - if (!(isTypeAssignableTo(targetType, widenedType))) { + var bothAreStringLike = someConstituentTypeHasKind(targetType, 258) && + someConstituentTypeHasKind(widenedType, 258); + if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } } @@ -18987,17 +19212,24 @@ var ts; var p = properties_3[_i]; if (p.kind === 245 || p.kind === 246) { var name_14 = p.name; + if (name_14.kind === 136) { + checkComputedPropertyName(name_14); + } + if (isComputedNonLiteralName(name_14)) { + continue; + } + var text = getTextOfPropertyName(name_14); var type = isTypeAny(sourceType) ? sourceType - : getTypeOfPropertyOfType(sourceType, name_14.text) || - isNumericLiteralName(name_14.text) && getIndexTypeOfType(sourceType, 1) || + : getTypeOfPropertyOfType(sourceType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { if (p.kind === 246) { checkDestructuringAssignment(p, type); } else { - checkDestructuringAssignment(p.initializer || name_14, type); + checkDestructuringAssignment(p.initializer, type); } } else { @@ -19175,6 +19407,9 @@ var ts; case 31: case 32: case 33: + if (someConstituentTypeHasKind(leftType, 258) && someConstituentTypeHasKind(rightType, 258)) { + return booleanType; + } if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -19282,6 +19517,13 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkStringLiteralExpression(node) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralType(node); + } + return stringType; + } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { checkExpression(templateSpan.expression); @@ -19320,7 +19562,7 @@ var ts; if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { @@ -19372,6 +19614,7 @@ var ts; case 183: return checkTemplateExpression(node); case 9: + return checkStringLiteralExpression(node); case 11: return stringType; case 10: @@ -20433,7 +20676,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 248 && ts.isExternalModule(parent)) { + if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -20504,6 +20747,11 @@ var ts; checkExpressionCached(node.initializer); } } + if (node.kind === 163) { + if (node.propertyName && node.propertyName.kind === 136) { + checkComputedPropertyName(node.propertyName); + } + } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } @@ -20862,6 +21110,7 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); + var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { if (clause.kind === 242 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { @@ -20878,6 +21127,9 @@ var ts; if (produceDiagnostics && clause.kind === 241) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); + if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258)) { + return; + } if (!isTypeAssignableTo(expressionType, caseType)) { checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); } @@ -21285,11 +21537,14 @@ var ts; var enumIsConst = ts.isConst(node); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.name.kind === 136) { + if (isComputedNonLiteralName(member.name)) { error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } - else if (isNumericLiteralName(member.name.text)) { - error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + else { + var text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } } var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; @@ -21987,8 +22242,10 @@ var ts; function checkSourceFileWorker(node) { var links = getNodeLinks(node); if (!(links.flags & 1)) { - if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) { - return; + if (compilerOptions.skipDefaultLibCheck) { + if (node.hasNoDefaultLib) { + return; + } } checkGrammarSourceFile(node); emitExtends = false; @@ -21997,7 +22254,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -22075,7 +22332,7 @@ var ts; } switch (location.kind) { case 248: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalOrCommonJsModule(location)) { break; } case 218: @@ -22634,15 +22891,24 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, - isArgumentsLocalBinding: isArgumentsLocalBinding + isArgumentsLocalBinding: isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration }; } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = ts.getExternalModuleName(declaration); + var moduleSymbol = getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return undefined; + } + return ts.getDeclarationOfKind(moduleSymbol, 248); + } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); @@ -23319,7 +23585,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 136 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); } } @@ -23633,11 +23899,15 @@ var ts; var writeTextOfNode; var writer = createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; - var currentSourceFile; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; var reportedDeclarationError = false; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare = !root; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; var referencePathsOutput = ""; @@ -23673,21 +23943,53 @@ var ts; } else { var emittedReferencedFiles = []; + var prevModuleElementDeclarationEmitInfo = []; ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + if (!ts.isDeclarationFile(sourceFile)) { if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && + if (referencedFile && (ts.isDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } }); } + } + if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; emitSourceFile(sourceFile); } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 222); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 1); + increaseIndent(); + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + decreaseIndent(); + } + }); + setWriter(oldWriter); + } + prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } }); + moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); } return { reportedDeclarationError: reportedDeclarationError, @@ -23696,13 +23998,12 @@ var ts; referencePathsOutput: referencePathsOutput }; function hasInternalAnnotation(range) { - var text = currentSourceFile.text; - var comment = text.substring(range.pos, range.end); + var comment = currentText.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node) { if (node) { - var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -23783,7 +24084,7 @@ var ts; var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } else { diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); @@ -23847,9 +24148,9 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); - ts.emitComments(currentSourceFile, writer, jsDocComments, true, newLine, ts.writeCommentRange); + var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); + ts.emitComments(currentText, currentLineMap, writer, jsDocComments, true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -23866,7 +24167,7 @@ var ts; case 103: case 97: case 9: - return writeTextOfNode(currentSourceFile, type); + return writeTextOfNode(currentText, type); case 188: return emitExpressionWithTypeArguments(type); case 151: @@ -23897,14 +24198,14 @@ var ts; } function writeEntityName(entityName) { if (entityName.kind === 69) { - writeTextOfNode(currentSourceFile, entityName); + writeTextOfNode(currentText, entityName); } else { var left = entityName.kind === 135 ? entityName.left : entityName.expression; var right = entityName.kind === 135 ? entityName.right : entityName.name; writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, right); + writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { @@ -23932,7 +24233,7 @@ var ts; } } function emitTypePredicate(type) { - writeTextOfNode(currentSourceFile, type.parameterName); + writeTextOfNode(currentText, type.parameterName); write(" is "); emitType(type.type); } @@ -23972,20 +24273,23 @@ var ts; } } function emitSourceFile(node) { - currentSourceFile = node; + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true); emitLines(node.statements); } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) { + if (!ts.hasProperty(currentIdentifiers, baseName)) { return baseName; } var count = 0; while (true) { var name_19 = baseName + "_" + (++count); - if (!ts.hasProperty(currentSourceFile.identifiers, name_19)) { + if (!ts.hasProperty(currentIdentifiers, name_19)) { return name_19; } } @@ -23993,7 +24297,7 @@ var ts; function emitExportAssignment(node) { if (node.expression.kind === 69) { write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentSourceFile, node.expression); + writeTextOfNode(currentText, node.expression); } else { var tempVarName = getExportDefaultTempVariableName(); @@ -24028,7 +24332,7 @@ var ts; writeModuleElement(node); } else if (node.kind === 221 || - (node.parent.kind === 248 && ts.isExternalModule(currentSourceFile))) { + (node.parent.kind === 248 && isCurrentFileExternalModule)) { var isVisible; if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { asynchronousSubModuleDeclarationEmitInfo.push({ @@ -24080,14 +24384,14 @@ var ts; } } function emitModuleElementDeclarationFlags(node) { - if (node.parent === currentSourceFile) { + if (node.parent.kind === 248) { if (node.flags & 2) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 215) { + else if (node.kind !== 215 && !noDeclare) { write("declare "); } } @@ -24112,7 +24416,7 @@ var ts; write("export "); } write("import "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" = "); if (ts.isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); @@ -24120,7 +24424,7 @@ var ts; } else { write("require("); - writeTextOfNode(currentSourceFile, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -24154,7 +24458,7 @@ var ts; if (node.importClause) { var currentWriterPos = writer.getTextPos(); if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentSourceFile, node.importClause.name); + writeTextOfNode(currentText, node.importClause.name); } if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { if (currentWriterPos !== writer.getTextPos()) { @@ -24162,7 +24466,7 @@ var ts; } if (node.importClause.namedBindings.kind === 224) { write("* as "); - writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); + writeTextOfNode(currentText, node.importClause.namedBindings.name); } else { write("{ "); @@ -24172,16 +24476,28 @@ var ts; } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); write(";"); writer.writeLine(); } + function emitExternalModuleSpecifier(moduleSpecifier) { + if (moduleSpecifier.kind === 9 && (!root) && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + if (moduleName) { + write("\""); + write(moduleName); + write("\""); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } function emitImportOrExportSpecifier(node) { if (node.propertyName) { - writeTextOfNode(currentSourceFile, node.propertyName); + writeTextOfNode(currentText, node.propertyName); write(" as "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } function emitExportSpecifier(node) { emitImportOrExportSpecifier(node); @@ -24201,7 +24517,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); } write(";"); writer.writeLine(); @@ -24215,11 +24531,11 @@ var ts; else { write("module "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); while (node.body.kind !== 219) { node = node.body; write("."); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; @@ -24238,7 +24554,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); @@ -24260,7 +24576,7 @@ var ts; write("const "); } write("enum "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" {"); writeLine(); increaseIndent(); @@ -24271,7 +24587,7 @@ var ts; } function emitEnumMemberDeclaration(node) { emitJsDocComments(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); @@ -24288,7 +24604,7 @@ var ts; increaseIndent(); emitJsDocComments(node); decreaseIndent(); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); if (node.parent.kind === 152 || @@ -24398,7 +24714,7 @@ var ts; write("abstract "); } write("class "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -24421,7 +24737,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("interface "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -24451,7 +24767,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { write("?"); } @@ -24525,7 +24841,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError); } } @@ -24566,7 +24882,7 @@ var ts; emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (!(node.flags & 16)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); @@ -24647,13 +24963,13 @@ var ts; } if (node.kind === 213) { write("function "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } else if (node.kind === 144) { write("constructor"); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (ts.hasQuestionToken(node)) { write("?"); } @@ -24766,7 +25082,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } if (resolver.isOptionalParameter(node)) { write("?"); @@ -24865,7 +25181,7 @@ var ts; } else if (bindingElement.kind === 163) { if (bindingElement.propertyName) { - writeTextOfNode(currentSourceFile, bindingElement.propertyName); + writeTextOfNode(currentText, bindingElement.propertyName); write(": "); } if (bindingElement.name) { @@ -24877,7 +25193,7 @@ var ts; if (bindingElement.dotDotDotToken) { write("..."); } - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); } } } @@ -24960,6 +25276,18 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || ts.isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -25229,15 +25557,19 @@ var ts; var newLine = host.getNewLine(); var jsxDesugaring = host.getCompilerOptions().jsx !== 1; var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; + var outFile = compilerOptions.outFile || compilerOptions.out; + var emitJavaScript = createFileEmitter(); if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); + if (outFile) { + emitFile(outFile); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); } } else { @@ -25245,8 +25577,8 @@ var ts; var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { + emitFile(outFile); } } diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); @@ -25296,20 +25628,26 @@ var ts; } } } - function emitJavaScript(jsFilePath, root) { + function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var currentText; + var currentLineMap; + var currentFileIdentifiers; + var renamedDependencies; + var isEs6Module; + var isCurrentFileExternalModule; var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; + var generatedNameSet; + var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; var convertedLoopState; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; + var extendsEmitted; + var decorateEmitted; + var paramEmitted; + var awaiterEmitted; + var tempFlags; var tempVariables; var tempParameters; var externalImports; @@ -25326,6 +25664,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; + var root; var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; var moduleEmitDelegates = (_a = {}, _a[5] = emitES6Module, @@ -25335,30 +25674,75 @@ var ts; _a[1] = emitCommonJSModule, _a ); - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); + var bundleEmitDelegates = (_b = {}, + _b[5] = function () { }, + _b[2] = emitAMDModule, + _b[4] = emitSystemModule, + _b[3] = function () { }, + _b[1] = function () { }, + _b + ); + return doEmit; + function doEmit(jsFilePath, rootFile) { + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + generatedNameSet = {}; + nodeToGeneratedName = []; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + root = rootFile; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(jsFilePath, root); + } + if (root) { + emitSourceFile(root); + } + else { + if (modulekind) { + ts.forEach(host.getSourceFiles(), emitEmitHelpers); } - }); + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), jsFilePath, compilerOptions.emitBOM); } - writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); - return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + currentText = sourceFile.text; + currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(sourceFile); emit(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(currentFileIdentifiers, name) && !ts.hasProperty(generatedNameSet, name); } function makeTempVariableName(flags) { @@ -25431,7 +25815,7 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps() { + function initializeEmitterWithSourceMaps(jsFilePath, root) { var sourceMapDir; var sourceMapSourceIndex = -1; var sourceMapNameIndexMap = {}; @@ -25500,7 +25884,7 @@ var ts; } } function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); sourceLinePos.line++; sourceLinePos.character++; var emittedLine = writer.getLine(); @@ -25528,13 +25912,13 @@ var ts; } } function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); } function recordEmitNodeEndSpan(node) { recordSourceMapSpan(node.end); } function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + var tokenStartPos = ts.skipTrivia(currentText, startPos); recordSourceMapSpan(tokenStartPos); var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); @@ -25604,9 +25988,9 @@ var ts; sourceMapNameIndices.pop(); } ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); recordSourceMapSpan(comment.end); } function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { @@ -25636,7 +26020,7 @@ var ts; return output; } } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); @@ -25649,7 +26033,7 @@ var ts; ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); } var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); sourceMapData = { @@ -25712,7 +26096,7 @@ var ts; scopeEmitEnd = recordScopeNameEnd; writeComment = writeCommentRangeWithMap; } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(flags) { @@ -25882,7 +26266,7 @@ var ts; return getQuotedEscapedLiteralText("\"", node.text, "\""); } if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: @@ -25904,7 +26288,7 @@ var ts; return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; } function emitDownlevelRawTemplateLiteral(node) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var text = ts.getTextOfNodeFromSourceText(currentText, node); var isLast = node.kind === 11 || node.kind === 14; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); @@ -26234,7 +26618,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } write("\""); } @@ -26330,7 +26714,7 @@ var ts; else if (declaration.kind === 226) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); var name_24 = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_24); + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_24); if (languageVersion === 0 && identifier === "default") { write("[\"default\"]"); } @@ -26354,7 +26738,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function isNameOfNestedRedeclaration(node) { @@ -26391,7 +26775,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function emitThis(node) { @@ -26758,8 +27142,8 @@ var ts; return container && container.kind !== 248; } function emitShorthandPropertyAssignment(node) { - writeTextOfNode(currentSourceFile, node.name); - if (languageVersion < 2 || isNamespaceExportReference(node.name)) { + writeTextOfNode(currentText, node.name); + if (modulekind !== 5 || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -26809,10 +27193,10 @@ var ts; } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - var shouldEmitSpace; + var shouldEmitSpace = false; if (!indentedBeforeDot) { if (node.expression.kind === 8) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; } else { @@ -27818,16 +28202,16 @@ var ts; emitToken(16, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 241) { @@ -27932,7 +28316,7 @@ var ts; if (node.parent.kind === 248) { ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); if (modulekind === 1 || modulekind === 2 || modulekind === 3) { - if (!currentSourceFile.symbol.exports["___esModule"]) { + if (!isEs6Module) { if (languageVersion === 1) { write("Object.defineProperty(exports, \"__esModule\", { value: true });"); writeLine(); @@ -28095,12 +28479,18 @@ var ts; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 69) { - return createElementAccessExpression(object, syntheticName); + var index; + var nameIsComputed = propName.kind === 136; + if (nameIsComputed) { + index = ensureIdentifier(propName.expression, false); } - return createPropertyAccessExpression(object, syntheticName); + else { + index = ts.createSynthesizedNode(propName.kind); + index.text = propName.text; + } + return !nameIsComputed && index.kind === 69 + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { var call = ts.createSynthesizedNode(168); @@ -28514,7 +28904,6 @@ var ts; var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); var isArrowFunction = node.kind === 174; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; - var args; if (!isArrowFunction) { write(" {"); increaseIndent(); @@ -29688,8 +30077,8 @@ var ts; } } function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + if (renamedDependencies && ts.hasProperty(renamedDependencies, moduleName.text)) { + return "\"" + renamedDependencies[moduleName.text] + "\""; } return undefined; } @@ -29829,7 +30218,7 @@ var ts; return; } if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); var variableDeclarationIsHoisted = shouldHoistVariable(node, true); @@ -30041,7 +30430,7 @@ var ts; function getLocalNameForExternalImport(node) { var namespaceDeclaration = getNamespaceDeclarationNode(node); if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } if (node.kind === 222 && node.importClause) { return getGeneratedNameForNode(node); @@ -30314,7 +30703,7 @@ var ts; ts.getEnclosingBlockScopeContainer(node).kind === 248; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 && ts.isExternalModule(currentSourceFile); + return modulekind === 4 && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); @@ -30427,15 +30816,19 @@ var ts; writeLine(); write("}"); } - function emitSystemModule(node) { + function writeModuleName(node, emitRelativePathAsModuleName) { + var moduleName = node.moduleName; + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { + write("\"" + moduleName + "\", "); + } + } + function emitSystemModule(node, emitRelativePathAsModuleName) { collectExternalModuleInfo(node); ts.Debug.assert(!exportFunctionForFile); exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } + writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; @@ -30453,6 +30846,12 @@ var ts; if (i !== 0) { write(", "); } + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); + if (name_30) { + text = "\"" + name_30 + "\""; + } + } write(text); } write("], function(" + exportFunctionForFile + ") {"); @@ -30466,7 +30865,7 @@ var ts; writeLine(); write("});"); } - function getAMDDependencyNames(node, includeNonAmdDependencies) { + function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { var aliasedModuleNames = []; var unaliasedModuleNames = []; var importAliasNames = []; @@ -30483,6 +30882,12 @@ var ts; for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; var externalModuleName = getExternalModuleNameText(importNode); + if (emitRelativePathAsModuleName) { + var name_31 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_31) { + externalModuleName = "\"" + name_31 + "\""; + } + } var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); @@ -30494,8 +30899,8 @@ var ts; } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - function emitAMDDependencies(node, includeNonAmdDependencies) { - var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -30522,15 +30927,13 @@ var ts; } write(") {"); } - function emitAMDModule(node) { + function emitAMDModule(node, emitRelativePathAsModuleName) { emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, true); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, true, emitRelativePathAsModuleName); increaseIndent(); var startIndex = emitDirectivePrologues(node.statements, true); emitExportStarHelper(); @@ -30736,8 +31139,13 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; - emitModule(node); + if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + emitModule(node); + } + else { + bundleEmitDelegates[modulekind](node, true); + } } else { var startIndex = emitDirectivePrologues(node.statements, false); @@ -30981,7 +31389,7 @@ var ts; return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; } function getLeadingCommentsWithoutDetachedComments() { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -30991,10 +31399,10 @@ var ts; return leadingComments; } function isTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + if (currentText.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + currentText.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentText.substring(comment.pos, comment.end); return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? true : false; @@ -31008,7 +31416,7 @@ var ts; return getLeadingCommentsWithoutDetachedComments(); } else { - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); } } } @@ -31016,7 +31424,7 @@ var ts; function getTrailingCommentsToEmit(node) { if (node.parent) { if (node.parent.kind === 248 || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + return ts.getTrailingCommentRanges(currentText, node.end); } } } @@ -31039,22 +31447,22 @@ var ts; leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { return; } var trailingComments = getTrailingCommentsToEmit(node); - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, false, newLine, writeComment); } function emitTrailingCommentsOfPosition(pos) { if (compilerOptions.removeComments) { return; } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); - ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + var trailingComments = ts.getTrailingCommentRanges(currentText, pos); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, true, newLine, writeComment); } function emitLeadingCommentsOfPositionWorker(pos) { if (compilerOptions.removeComments) { @@ -31065,13 +31473,13 @@ var ts; leadingComments = getLeadingCommentsWithoutDetachedComments(); } else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + leadingComments = ts.getLeadingCommentRanges(currentText, pos); } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAndUpdateCommentsInfo(node) { - var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); if (currentDetachedCommentInfo) { if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -31082,12 +31490,12 @@ var ts; } } function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); + var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); } } - var _a; + var _a, _b; } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -31143,11 +31551,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -31157,8 +31565,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { - return ts.forEach(ts.moduleFileExtensions, tryLoad); + function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + return ts.forEach(extensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -31170,7 +31578,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -31182,7 +31590,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -31191,7 +31599,7 @@ var ts; else { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -31201,11 +31609,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -31230,9 +31638,10 @@ var ts; var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { return undefined; } @@ -31260,10 +31669,8 @@ var ts; ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { module: 1, - target: 0, + target: 1, noImplicitAny: false, - outDir: "built", - rootDir: ".", sourceMap: false }; function createCompilerHost(options, setParentNodes) { @@ -31621,35 +32028,47 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, true); + collect(node, true, false); } file.imports = imports || emptyArray; - function collect(node, allowRelativeModuleNames) { - switch (node.kind) { - case 222: - case 221: - case 228: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + return; + function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { + if (!collectOnlyRequireCalls) { + switch (node.kind) { + case 222: + case 221: + case 228: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - } - if (!moduleNameExpr.text) { + case 218: + if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + collect(node, false, collectOnlyRequireCalls); + }); + } break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case 218: - if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - collect(node, false); - }); - } - break; + } + } + if (isJavaScriptFile) { + if (ts.isRequireCall(node)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, true); }); + } } } } @@ -31736,7 +32155,6 @@ var ts; } processImportedModules(file, basePath); if (isDefaultLib) { - file.isDefaultLib = true; files.unshift(file); } else { @@ -31809,6 +32227,9 @@ var ts; commonPathComponents.length = sourcePathComponents.length; } }); + if (!commonPathComponents) { + return currentDirectory; + } return ts.getNormalizedPathFromPathComponents(commonPathComponents); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { @@ -31891,10 +32312,12 @@ var ts; if (options.module === 5 && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } + if (outFile && options.module && !(options.module === 2 || options.module === 4)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } if (options.outDir || options.sourceRoot || - (options.mapRoot && - (!outFile || firstExternalModuleSourceFile !== undefined))) { + options.mapRoot) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -32448,10 +32871,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_30 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_30); + for (var name_32 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_32); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_30); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); if (!matches) { continue; } @@ -32462,14 +32885,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_30); + matches = patternMatcher.getMatches(containers, name_32); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_30, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -32797,9 +33220,9 @@ var ts; case 211: case 163: var variableDeclarationNode; - var name_31; + var name_33; if (node.kind === 163) { - name_31 = node.name; + name_33 = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 211) { variableDeclarationNode = variableDeclarationNode.parent; @@ -32809,16 +33232,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_31 = node.name; + name_33 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); } case 144: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -33425,7 +33848,7 @@ var ts; var resolvedSignature = typeChecker.getResolvedSignature(call, candidates); cancellationToken.throwIfCancellationRequested(); if (!candidates.length) { - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; @@ -34941,9 +35364,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_32 in o) { - if (o[name_32] === rule) { - return name_32; + for (var name_34 in o) { + if (o[name_34] === rule) { + return name_34; } } throw new Error("Unknown rule"); @@ -35318,7 +35741,7 @@ var ts; function TokenRangeAccess(from, to, except) { this.tokens = []; for (var token = from; token <= to; token++) { - if (except.indexOf(token) < 0) { + if (ts.indexOf(except, token) < 0) { this.tokens.push(token); } } @@ -36706,13 +37129,18 @@ var ts; ]; var jsDocCompletionEntries; function createNode(kind, pos, end, flags, parent) { - var node = new (ts.getNodeConstructor(kind))(pos, end); + var node = new NodeObject(kind, pos, end); node.flags = flags; node.parent = parent; return node; } var NodeObject = (function () { - function NodeObject() { + function NodeObject(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0; + this.parent = undefined; } NodeObject.prototype.getSourceFile = function () { return ts.getSourceFileOfNode(this); @@ -37151,8 +37579,8 @@ var ts; })(); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); - function SourceFileObject() { - _super.apply(this, arguments); + function SourceFileObject(kind, pos, end) { + _super.call(this, kind, pos, end); } SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); @@ -37421,6 +37849,9 @@ var ts; ClassificationTypeNames.typeAliasName = "type alias name"; ClassificationTypeNames.parameterName = "parameter name"; ClassificationTypeNames.docCommentTagName = "doc comment tag name"; + ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; + ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; + ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; @@ -37740,8 +38171,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -37775,93 +38207,53 @@ var ts; end: pos + importPath.length }); } - function processImport() { - scanner.setText(sourceText); - var token = scanner.scan(); - while (token !== 1) { - if (token === 122) { - token = scanner.scan(); - if (token === 125) { - token = scanner.scan(); - if (token === 9) { - recordAmbientExternalModule(); - continue; - } - } - } - else if (token === 89) { + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122) { + token = scanner.scan(); + if (token === 125) { token = scanner.scan(); if (token === 9) { - recordModuleName(); - continue; - } - else { - if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - continue; - } - } - else if (token === 56) { - token = scanner.scan(); - if (token === 127) { - token = scanner.scan(); - if (token === 17) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - continue; - } - } - } - } - else if (token === 24) { - token = scanner.scan(); - } - else { - continue; - } - } - if (token === 15) { - token = scanner.scan(); - while (token !== 16) { - token = scanner.scan(); - } - if (token === 16) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } - } - else if (token === 37) { - token = scanner.scan(); - if (token === 116) { - token = scanner.scan(); - if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } - } - } + recordAmbientExternalModule(); } } - else if (token === 82) { - token = scanner.scan(); + return true; + } + return false; + } + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + return true; + } + else { + if (token === 69 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + return true; + } + } + else if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; + } + } + else if (token === 24) { + token = scanner.scan(); + } + else { + return true; + } + } if (token === 15) { token = scanner.scan(); - while (token !== 16) { + while (token !== 16 && token !== 1) { token = scanner.scan(); } if (token === 16) { @@ -37875,6 +38267,35 @@ var ts; } } else if (token === 37) { + token = scanner.scan(); + if (token === 116) { + token = scanner.scan(); + if (token === 69 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82) { + token = scanner.scan(); + if (token === 15) { + token = scanner.scan(); + while (token !== 16 && token !== 1) { + token = scanner.scan(); + } + if (token === 16) { token = scanner.scan(); if (token === 133) { token = scanner.scan(); @@ -37883,31 +38304,99 @@ var ts; } } } - else if (token === 89) { + } + else if (token === 37) { + token = scanner.scan(); + if (token === 133) { token = scanner.scan(); - if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 56) { - token = scanner.scan(); - if (token === 127) { - token = scanner.scan(); - if (token === 17) { - token = scanner.scan(); - if (token === 9) { - recordModuleName(); - } - } - } + if (token === 9) { + recordModuleName(); + } + } + } + else if (token === 89) { + token = scanner.scan(); + if (token === 69 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; } } } } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127) { token = scanner.scan(); + if (token === 17) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17) { + return true; + } + token = scanner.scan(); + if (token === 9) { + token = scanner.scan(); + if (token === 24) { + token = scanner.scan(); + } + else { + return true; + } + } + if (token !== 19) { + return true; + } + token = scanner.scan(); + var i = 0; + while (token !== 20 && token !== 1) { + if (token === 9) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { + scanner.setText(sourceText); + scanner.scan(); + while (true) { + if (scanner.getToken() === 1) { + break; + } + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) { + continue; + } + else { + scanner.scan(); + } } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -38250,7 +38739,7 @@ var ts; function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); @@ -38442,7 +38931,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -38953,8 +39442,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_33 = element.propertyName || element.name; - exisingImportsOrExports[name_33.text] = true; + var name_35 = element.propertyName || element.name; + exisingImportsOrExports[name_35.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -38978,7 +39467,9 @@ var ts; } var existingName = void 0; if (m.kind === 163 && m.propertyName) { - existingName = m.propertyName.text; + if (m.propertyName.kind === 69) { + existingName = m.propertyName.text; + } } else { existingName = m.name.text; @@ -39008,44 +39499,41 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_34 in nameTable) { - if (!allNames[name_34]) { - allNames[name_34] = name_34; - var displayName = getCompletionEntryDisplayName(name_34, target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_36 in nameTable) { + if (!uniqueNames[name_36]) { + uniqueNames[name_36] = name_36; + var displayName = getCompletionEntryDisplayName(name_36, target, true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -39073,25 +39561,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -39272,16 +39759,16 @@ var ts; case ScriptElementKind.letElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(ts.punctuationPart(54)); + displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(92)); + displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); displayParts.push(ts.spacePart()); } - if (!(type.flags & 65536)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1)); + if (!(type.flags & ts.TypeFlags.Anonymous)) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); } - addSignatureDisplayParts(signature, allSignatures, 8); + addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); break; default: addSignatureDisplayParts(signature, allSignatures); @@ -40728,17 +41215,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_35 = node.text; + var name_37 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_35); + var unionProperty = contextualType.getProperty(name_37); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_35); + var symbol = t.getProperty(name_37); if (symbol) { result_4.push(symbol); } @@ -40747,7 +41234,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_35); + var symbol_1 = contextualType.getProperty(name_37); if (symbol_1) { return [symbol_1]; } @@ -41105,6 +41592,9 @@ var ts; case 16: return ClassificationTypeNames.typeAliasName; case 17: return ClassificationTypeNames.parameterName; case 18: return ClassificationTypeNames.docCommentTagName; + case 19: return ClassificationTypeNames.jsxOpenTagName; + case 20: return ClassificationTypeNames.jsxCloseTagName; + case 21: return ClassificationTypeNames.jsxSelfClosingTagName; } } function convertClassifications(classifications) { @@ -41344,6 +41834,21 @@ var ts; return 17; } return; + case 235: + if (token.parent.tagName === token) { + return 19; + } + return; + case 237: + if (token.parent.tagName === token) { + return 20; + } + return; + case 234: + if (token.parent.tagName === token) { + return 21; + } + return; } } return 2; @@ -42053,18 +42558,8 @@ var ts; ts.getDefaultLibFilePath = getDefaultLibFilePath; function initializeServices() { ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0; - this.parent = undefined; - } - var proto = kind === 248 ? new SourceFileObject() : new NodeObject(); - proto.kind = kind; - Node.prototype = proto; - return Node; - }, + getNodeConstructor: function () { return NodeObject; }, + getSourceFileConstructor: function () { return SourceFileObject; }, getSymbolConstructor: function () { return SymbolObject; }, getTypeConstructor: function () { return TypeObject; }, getSignatureConstructor: function () { return SignatureObject; } @@ -42959,8 +43454,8 @@ var ts; }; Session.prototype.getDiagnosticsForProject = function (delay, fileName) { var _this = this; - var _a = this.getProjectInfo(fileName, true), configFileName = _a.configFileName, fileNamesInProject = _a.fileNames; - fileNamesInProject = fileNamesInProject.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; }); + var _a = this.getProjectInfo(fileName, true), configFileName = _a.configFileName, fileNames = _a.fileNames; + var fileNamesInProject = fileNames.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; }); var highPriorityFiles = []; var mediumPriorityFiles = []; var lowPriorityFiles = []; @@ -43329,6 +43824,9 @@ var ts; this.filenameToSourceFile = {}; this.updateGraphSeq = 0; this.openRefCount = 0; + if (projectOptions && projectOptions.files) { + projectOptions.compilerOptions.allowNonTsExtensions = true; + } this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions); } Project.prototype.addOpenRef = function () { @@ -43399,6 +43897,7 @@ var ts; Project.prototype.setProjectOptions = function (projectOptions) { this.projectOptions = projectOptions; if (projectOptions.compilerOptions) { + projectOptions.compilerOptions.allowNonTsExtensions = true; this.compilerService.setCompilerOptions(projectOptions.compilerOptions); } }; @@ -43824,7 +44323,6 @@ var ts; } } if (content !== undefined) { - var indentSize; info = new ScriptInfo(this.host, fileName, content, openedByClient); info.setFormatOptions(this.getFormatCodeOptions()); this.filenameToScriptInfo[fileName] = info; @@ -44081,7 +44579,9 @@ var ts; this.setCompilerOptions(opt); } else { - this.setCompilerOptions(ts.getDefaultCompilerOptions()); + var defaultOpts = ts.getDefaultCompilerOptions(); + defaultOpts.allowNonTsExtensions = true; + this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); this.classifier = ts.createClassifier(); @@ -45635,7 +46135,7 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); var convertResult = { referencedFiles: [], importedFiles: [], @@ -45696,7 +46196,7 @@ var ts; TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { try { if (this.documentRegistry === undefined) { - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var hostAdapter = new LanguageServiceShimHostAdapter(host); var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); @@ -45728,7 +46228,7 @@ var ts; }; TypeScriptServicesFactory.prototype.close = function () { this._shims = []; - this.documentRegistry = ts.createDocumentRegistry(); + this.documentRegistry = undefined; }; TypeScriptServicesFactory.prototype.registerShim = function (shim) { this._shims.push(shim); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 972ebfa472d..32a6dee4623 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -387,6 +387,7 @@ declare namespace ts { right: Identifier; } type EntityName = Identifier | QualifiedName; + type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; @@ -425,7 +426,7 @@ declare namespace ts { initializer?: Expression; } interface BindingElement extends Declaration { - propertyName?: Identifier; + propertyName?: PropertyName; dotDotDotToken?: Node; name: Identifier | BindingPattern; initializer?: Expression; @@ -452,7 +453,7 @@ declare namespace ts { objectAssignmentInitializer?: Expression; } interface VariableLikeDeclaration extends Declaration { - propertyName?: Identifier; + propertyName?: PropertyName; dotDotDotToken?: Node; name: DeclarationName; questionToken?: Node; @@ -581,7 +582,7 @@ declare namespace ts { asteriskToken?: Node; expression?: Expression; } - interface BinaryExpression extends Expression { + interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -625,7 +626,7 @@ declare namespace ts { interface ObjectLiteralExpression extends PrimaryExpression, Declaration { properties: NodeArray; } - interface PropertyAccessExpression extends MemberExpression { + interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; dotToken: Node; name: Identifier; @@ -1220,6 +1221,7 @@ declare namespace ts { ObjectLiteral = 524288, ESSymbol = 16777216, ThisType = 33554432, + ObjectLiteralPatternWithComputedProperties = 67108864, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1537,7 +1539,6 @@ declare namespace ts { function getTypeParameterOwner(d: Declaration): Declaration; } declare namespace ts { - function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node; function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; @@ -2126,6 +2127,9 @@ declare namespace ts { static typeAliasName: string; static parameterName: string; static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; } enum ClassificationType { comment = 1, @@ -2146,6 +2150,9 @@ declare namespace ts { typeAliasName = 16, parameterName = 17, docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; @@ -2171,7 +2178,7 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; /** diff --git a/lib/typescript.js b/lib/typescript.js index 8b0ef04f96e..498ddc37860 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -622,6 +622,7 @@ var ts; TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; + TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ @@ -1530,12 +1531,7 @@ var ts; * List of supported extensions in order of file resolution precedence. */ ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - /** - * List of extensions that will be used to look for external modules. - * This list is kept separate from supportedExtensions to for cases when we'll allow to include .js files in compilation, - * but still would like to load only TypeScript files as modules - */ - ts.moduleFileExtensions = ts.supportedExtensions; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); function isSupportedSourceFileName(fileName) { if (!fileName) { return false; @@ -1586,17 +1582,16 @@ var ts; } function Signature(checker) { } + function Node(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0 /* None */; + this.parent = undefined; + } ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0 /* None */; - this.parent = undefined; - } - Node.prototype = { kind: kind }; - return Node; - }, + getNodeConstructor: function () { return Node; }, + getSourceFileConstructor: function () { return Node; }, getSymbolConstructor: function () { return Symbol; }, getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } @@ -1913,7 +1908,16 @@ var ts; if (writeByteOrderMark) { data = "\uFEFF" + data; } - _fs.writeFileSync(fileName, data, "utf8"); + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync(fd, data, undefined, "utf8"); + } + finally { + if (fd !== undefined) { + _fs.closeSync(fd); + } + } } function getCanonicalPath(path) { return useCaseSensitiveFileNames ? path.toLowerCase() : path; @@ -2614,6 +2618,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, + Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3173,7 +3178,7 @@ var ts; function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; - while (true) { + while (pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: @@ -3242,6 +3247,7 @@ var ts; } return result; } + return result; } function getLeadingCommentRanges(text, pos) { return getCommentRanges(text, pos, /*trailing*/ false); @@ -3343,7 +3349,7 @@ var ts; error(ts.Diagnostics.Digit_expected); } } - return +(text.substring(start, end)); + return "" + +(text.substring(start, end)); } function scanOctalDigits() { var start = pos; @@ -3770,7 +3776,7 @@ var ts; return pos++, token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { @@ -3873,7 +3879,7 @@ var ts; case 55 /* _7 */: case 56 /* _8 */: case 57 /* _9 */: - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: return pos++, token = 54 /* ColonToken */; @@ -4177,1321 +4183,6 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); -/// -/* @internal */ -var ts; -(function (ts) { - ts.bindTime = 0; - (function (ModuleInstanceState) { - ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; - ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; - ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; - })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); - var ModuleInstanceState = ts.ModuleInstanceState; - var Reachability; - (function (Reachability) { - Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; - Reachability[Reachability["Reachable"] = 2] = "Reachable"; - Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; - Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; - })(Reachability || (Reachability = {})); - function or(state1, state2) { - return (state1 | state2) & 2 /* Reachable */ - ? 2 /* Reachable */ - : (state1 & state2) & 8 /* ReportedUnreachable */ - ? 8 /* ReportedUnreachable */ - : 4 /* Unreachable */; - } - function getModuleInstanceState(node) { - // A module is uninstantiated if it contains only - // 1. interface declarations, type alias declarations - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { - return 0 /* NonInstantiated */; - } - else if (ts.isConstEnumDeclaration(node)) { - return 2 /* ConstEnumOnly */; - } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { - return 0 /* NonInstantiated */; - } - else if (node.kind === 219 /* ModuleBlock */) { - var state = 0 /* NonInstantiated */; - ts.forEachChild(node, function (n) { - switch (getModuleInstanceState(n)) { - case 0 /* NonInstantiated */: - // child is non-instantiated - continue searching - return false; - case 2 /* ConstEnumOnly */: - // child is const enum only - record state and continue searching - state = 2 /* ConstEnumOnly */; - return false; - case 1 /* Instantiated */: - // child is instantiated - record state and stop - state = 1 /* Instantiated */; - return true; - } - }); - return state; - } - else if (node.kind === 218 /* ModuleDeclaration */) { - return getModuleInstanceState(node.body); - } - else { - return 1 /* Instantiated */; - } - } - ts.getModuleInstanceState = getModuleInstanceState; - var ContainerFlags; - (function (ContainerFlags) { - // The current node is not a container, and no container manipulation should happen before - // recursing into it. - ContainerFlags[ContainerFlags["None"] = 0] = "None"; - // The current node is a container. It should be set as the current container (and block- - // container) before recursing into it. The current node does not have locals. Examples: - // - // Classes, ObjectLiterals, TypeLiterals, Interfaces... - ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; - // The current node is a block-scoped-container. It should be set as the current block- - // container before recursing into it. Examples: - // - // Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements... - ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; - ContainerFlags[ContainerFlags["HasLocals"] = 4] = "HasLocals"; - // If the current node is a container that also container that also contains locals. Examples: - // - // Functions, Methods, Modules, Source-files. - ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; - })(ContainerFlags || (ContainerFlags = {})); - var binder = createBinder(); - function bindSourceFile(file, options) { - var start = new Date().getTime(); - binder(file, options); - ts.bindTime += new Date().getTime() - start; - } - ts.bindSourceFile = bindSourceFile; - function createBinder() { - var file; - var options; - var parent; - var container; - var blockScopeContainer; - var lastContainer; - var seenThisKeyword; - // state used by reachability checks - var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; - // If this file is an external module, then it is automatically in strict-mode according to - // ES6. If it is not an external module, then we'll determine if it is in strict mode or - // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). - var inStrictMode; - var symbolCount = 0; - var Symbol; - var classifiableNames; - function bindSourceFile(f, opts) { - file = f; - options = opts; - inStrictMode = !!file.externalModuleIndicator; - classifiableNames = {}; - Symbol = ts.objectAllocator.getSymbolConstructor(); - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; - } - parent = undefined; - container = undefined; - blockScopeContainer = undefined; - lastContainer = undefined; - seenThisKeyword = false; - hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; - } - return bindSourceFile; - function createSymbol(flags, name) { - symbolCount++; - return new Symbol(flags, name); - } - function addDeclarationToSymbol(symbol, node, symbolFlags) { - symbol.flags |= symbolFlags; - node.symbol = symbol; - if (!symbol.declarations) { - symbol.declarations = []; - } - symbol.declarations.push(node); - if (symbolFlags & 1952 /* HasExports */ && !symbol.exports) { - symbol.exports = {}; - } - if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { - symbol.members = {}; - } - if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; - } - } - // Should not be called on a declaration with a computed property name, - // unless it is a well known Symbol. - function getDeclarationName(node) { - if (node.name) { - if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { - return "\"" + node.name.text + "\""; - } - if (node.name.kind === 136 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); - return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); - } - return node.name.text; - } - switch (node.kind) { - case 144 /* Constructor */: - return "__constructor"; - case 152 /* FunctionType */: - case 147 /* CallSignature */: - return "__call"; - case 153 /* ConstructorType */: - case 148 /* ConstructSignature */: - return "__new"; - case 149 /* IndexSignature */: - return "__index"; - case 228 /* ExportDeclaration */: - return "__export"; - case 227 /* ExportAssignment */: - return node.isExportEquals ? "export=" : "default"; - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: - return node.flags & 512 /* Default */ ? "default" : undefined; - } - } - function getDisplayName(node) { - return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); - } - /** - * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. - * @param symbolTable - The symbol table which node will be added to. - * @param parent - node's parent declaration. - * @param node - The declaration to be added to the symbol table - * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) - * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. - */ - function declareSymbol(symbolTable, parent, node, includes, excludes) { - ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 512 /* Default */; - // The exported symbol for an export default function/class node is always named "default" - var name = isDefaultExport && parent ? "default" : getDeclarationName(node); - var symbol; - if (name !== undefined) { - // Check and see if the symbol table already has a symbol with this name. If not, - // create a new symbol with this name and add it to the table. Note that we don't - // give the new symbol any flags *yet*. This ensures that it will not conflict - // with the 'excludes' flags we pass in. - // - // If we do get an existing symbol, see if it conflicts with the new symbol we're - // creating. For example, a 'var' symbol and a 'class' symbol will conflict within - // the same symbol table. If we have a conflict, report the issue on each - // declaration we have for this symbol, and then create a new symbol for this - // declaration. - // - // If we created a new symbol, either because we didn't have a symbol with this name - // in the symbol table, or we conflicted with an existing symbol, then just add this - // node as the sole declaration of the new symbol. - // - // Otherwise, we'll be merging into a compatible existing symbol (for example when - // you have multiple 'vars' with the same name in the same container). In this case - // just add this node into the declarations list of the symbol. - symbol = ts.hasProperty(symbolTable, name) - ? symbolTable[name] - : (symbolTable[name] = createSymbol(0 /* None */, name)); - if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; - } - if (symbol.flags & excludes) { - if (node.name) { - node.name.parent = node; - } - // Report errors every position with duplicate declaration - // Report errors on previous encountered declarations - var message = symbol.flags & 2 /* BlockScopedVariable */ - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; - ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 512 /* Default */) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; - } - }); - ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); - }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0 /* None */, name); - } - } - else { - symbol = createSymbol(0 /* None */, "__missing"); - } - addDeclarationToSymbol(symbol, node, includes); - symbol.parent = parent; - return symbol; - } - function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; - if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - else { - // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, - // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set - // on it. There are 2 main reasons: - // - // 1. We treat locals and exports of the same name as mutually exclusive within a container. - // That means the binder will issue a Duplicate Identifier error if you mix locals and exports - // with the same name in the same container. - // TODO: Make this a more specific error and decouple it from the exclusion logic. - // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, - // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way - // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 131072 /* ExportContext */) { - var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | - (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | - (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); - local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - node.localSymbol = local; - return local; - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - } - // All container nodes are kept on a linked list in declaration order. This list is used by - // the getLocalNameOfContainer function in the type checker to validate that the local name - // used for a container is unique. - function bindChildren(node) { - // Before we recurse into a node's chilren, we first save the existing parent, container - // and block-container. Then after we pop out of processing the children, we restore - // these saved values. - var saveParent = parent; - var saveContainer = container; - var savedBlockScopeContainer = blockScopeContainer; - // This node will now be set as the parent of all of its children as we recurse into them. - parent = node; - // Depending on what kind of node this is, we may have to adjust the current container - // and block-container. If the current node is a container, then it is automatically - // considered the current block-container as well. Also, for containers that we know - // may contain locals, we proactively initialize the .locals field. We do this because - // it's highly likely that the .locals will be needed to place some child in (for example, - // a parameter, or variable declaration). - // - // However, we do not proactively create the .locals for block-containers because it's - // totally normal and common for block-containers to never actually have a block-scoped - // variable in them. We don't want to end up allocating an object for every 'block' we - // run into when most of them won't be necessary. - // - // Finally, if this is a block-container, then we clear out any existing .locals object - // it may contain within it. This happens in incremental scenarios. Because we can be - // reusing a node from a previous compilation, that node may have had 'locals' created - // for it. We must clear this so we don't accidently move any stale data forward from - // a previous compilation. - var containerFlags = getContainerFlags(node); - if (containerFlags & 1 /* IsContainer */) { - container = blockScopeContainer = node; - if (containerFlags & 4 /* HasLocals */) { - container.locals = {}; - } - addToContainerChain(container); - } - else if (containerFlags & 2 /* IsBlockScopedContainer */) { - blockScopeContainer = node; - blockScopeContainer.locals = undefined; - } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; - var savedHasExplicitReturn; - var kind = node.kind; - var flags = node.flags; - // reset all reachability check related flags on node (for incremental scenarios) - flags &= ~1572864 /* ReachabilityCheckFlags */; - if (kind === 215 /* InterfaceDeclaration */) { - seenThisKeyword = false; - } - var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); - if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; - savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2 /* Reachable */; - hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; - } - bindReachableStatement(node); - if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288 /* HasImplicitReturn */; - if (hasExplicitReturn) { - flags |= 1048576 /* HasExplicitReturn */; - } - } - if (kind === 215 /* InterfaceDeclaration */) { - flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; - } - node.flags = flags; - if (saveState) { - hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; - } - container = saveContainer; - parent = saveParent; - blockScopeContainer = savedBlockScopeContainer; - } - /** - * Returns true if node and its subnodes were successfully traversed. - * Returning false means that node was not examined and caller needs to dive into the node himself. - */ - function bindReachableStatement(node) { - if (checkUnreachable(node)) { - ts.forEachChild(node, bind); - return; - } - switch (node.kind) { - case 198 /* WhileStatement */: - bindWhileStatement(node); - break; - case 197 /* DoStatement */: - bindDoStatement(node); - break; - case 199 /* ForStatement */: - bindForStatement(node); - break; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - bindForInOrForOfStatement(node); - break; - case 196 /* IfStatement */: - bindIfStatement(node); - break; - case 204 /* ReturnStatement */: - case 208 /* ThrowStatement */: - bindReturnOrThrow(node); - break; - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - bindBreakOrContinueStatement(node); - break; - case 209 /* TryStatement */: - bindTryStatement(node); - break; - case 206 /* SwitchStatement */: - bindSwitchStatement(node); - break; - case 220 /* CaseBlock */: - bindCaseBlock(node); - break; - case 207 /* LabeledStatement */: - bindLabeledStatement(node); - break; - default: - ts.forEachChild(node, bind); - break; - } - } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // bind expressions (don't affect reachability) - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); - } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; - popImplicitLabel(postDoLabel, postDoState); - // bind expressions (don't affect reachability) - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - // for statement is considered infinite when it condition is either omitted or is true keyword - // - for(..;;..) - // - for(..;true;..) - var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); - var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - // denotes reachability state when entering 'thenStatement' part of the if statement: - // i.e. if condition is false then thenStatement is unreachable - var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // denotes reachability state when entering 'elseStatement': - // i.e. if condition is true then elseStatement is unreachable - var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - currentReachabilityState = ifTrueState; - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); - } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); - } - } - function bindReturnOrThrow(n) { - // bind expression (don't affect reachability) - bind(n.expression); - if (n.kind === 204 /* ReturnStatement */) { - hasExplicitReturn = true; - } - currentReachabilityState = 4 /* Unreachable */; - } - function bindBreakOrContinueStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); - if (isValidJump) { - currentReachabilityState = 4 /* Unreachable */; - } - } - function bindTryStatement(n) { - // catch\finally blocks has the same reachability as try block - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - // post catch/finally state is reachable if - // - post try state is reachable - control flow can fall out of try block - // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); - } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); - // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case - var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); - } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); - } - } - } - function bindLabeledStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); - } - } - function getContainerFlags(node) { - switch (node.kind) { - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - return 1 /* IsContainer */; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 218 /* ModuleDeclaration */: - case 248 /* SourceFile */: - case 216 /* TypeAliasDeclaration */: - return 5 /* IsContainerWithLocals */; - case 244 /* CatchClause */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 220 /* CaseBlock */: - return 2 /* IsBlockScopedContainer */; - case 192 /* Block */: - // do not treat blocks directly inside a function as a block-scoped-container. - // Locals that reside in this block should go to the function locals. Othewise 'x' - // would not appear to be a redeclaration of a block scoped local in the following - // example: - // - // function foo() { - // var x; - // let x; - // } - // - // If we placed 'var x' into the function locals and 'let x' into the locals of - // the block, then there would be no collision. - // - // By not creating a new block-scoped-container here, we ensure that both 'var x' - // and 'let x' go into the Function-container's locals, and we do get a collision - // conflict. - return ts.isFunctionLike(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */; - } - return 0 /* None */; - } - function addToContainerChain(next) { - if (lastContainer) { - lastContainer.nextContainer = next; - } - lastContainer = next; - } - function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { - // Just call this directly so that the return type of this function stays "void". - declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); - } - function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { - switch (container.kind) { - // Modules, source files, and classes need specialized handling for how their - // members are declared (for example, a member of a class will go into a specific - // symbol table depending on if it is static or not). We defer to specialized - // handlers to take care of declaring these child members. - case 218 /* ModuleDeclaration */: - return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248 /* SourceFile */: - return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - return declareClassMember(node, symbolFlags, symbolExcludes); - case 217 /* EnumDeclaration */: - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - case 215 /* InterfaceDeclaration */: - // Interface/Object-types always have their children added to the 'members' of - // their container. They are only accessible through an instance of their - // container, and are never in scope otherwise (even inside the body of the - // object / type / interface declaring them). An exception is type parameters, - // which are in scope without qualification (similar to 'locals'). - return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 216 /* TypeAliasDeclaration */: - // All the children of these container types are never visible through another - // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, - // they're only accessed 'lexically' (i.e. from code that exists underneath - // their container in the tree. To accomplish this, we simply add their declared - // symbol to the 'locals' of the container. These symbols can then be found as - // the type checker walks up the containers, checking them for matching names. - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 /* Static */ - ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) - : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - } - function declareSourceFileMember(node, symbolFlags, symbolExcludes) { - return ts.isExternalModule(file) - ? declareModuleMember(node, symbolFlags, symbolExcludes) - : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); - } - function hasExportDeclarations(node) { - var body = node.kind === 248 /* SourceFile */ ? node : node.body; - if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { - var stat = _a[_i]; - if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { - return true; - } - } - } - return false; - } - function setExportContextFlag(node) { - // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular - // declarations with export modifiers) is an export context in which declarations are implicitly exported. - if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072 /* ExportContext */; - } - else { - node.flags &= ~131072 /* ExportContext */; - } - } - function bindModuleDeclaration(node) { - setExportContextFlag(node); - if (node.name.kind === 9 /* StringLiteral */) { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - } - else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { - // if module was already merged with some function, class or non-const enum - // treat is a non-const-enum-only - node.symbol.constEnumOnlyModule = false; - } - else { - var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; - if (node.symbol.constEnumOnlyModule === undefined) { - // non-merged case - use the current state - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; - } - else { - // merged case: module is const enum only if all its pieces are non-instantiated or const enum - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; - } - } - } - } - } - function bindFunctionOrConstructorType(node) { - // For a given function symbol "<...>(...) => T" we want to generate a symbol identical - // to the one we would get for: { <...>(...): T } - // - // We do that by making an anonymous type literal symbol, and then setting the function - // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable - // from an actual type literal symbol you would have gotten had you used the long form. - var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node)); - addDeclarationToSymbol(symbol, node, 131072 /* Signature */); - var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); - addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); - typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); - var _a; - } - function bindObjectLiteralExpression(node) { - var ElementKind; - (function (ElementKind) { - ElementKind[ElementKind["Property"] = 1] = "Property"; - ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; - })(ElementKind || (ElementKind = {})); - if (inStrictMode) { - var seen = {}; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - if (prop.name.kind !== 69 /* Identifier */) { - continue; - } - var identifier = prop.name; - // ECMA-262 11.1.5 Object Initialiser - // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true - // a.This production is contained in strict code and IsDataDescriptor(previous) is true and - // IsDataDescriptor(propId.descriptor) is true. - // b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true. - // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. - // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true - // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ - ? 1 /* Property */ - : 2 /* Accessor */; - var existingKind = seen[identifier.text]; - if (!existingKind) { - seen[identifier.text] = currentKind; - continue; - } - if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { - var span = ts.getErrorSpanForNode(file, identifier); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); - } - } - } - return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); - } - function bindAnonymousDeclaration(node, symbolFlags, name) { - var symbol = createSymbol(symbolFlags, name); - addDeclarationToSymbol(symbol, node, symbolFlags); - } - function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { - switch (blockScopeContainer.kind) { - case 218 /* ModuleDeclaration */: - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - case 248 /* SourceFile */: - if (ts.isExternalModule(container)) { - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - } - // fall through. - default: - if (!blockScopeContainer.locals) { - blockScopeContainer.locals = {}; - addToContainerChain(blockScopeContainer); - } - declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function bindBlockScopedVariableDeclaration(node) { - bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); - } - // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized - // check for reserved words used as identifiers in strict mode code. - function checkStrictModeIdentifier(node) { - if (inStrictMode && - node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && - !ts.isIdentifierName(node)) { - // Report error only if there are no parse errors in file - if (!file.parseDiagnostics.length) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); - } - } - } - function getStrictModeIdentifierMessage(node) { - // Provide specialized messages to help the user understand why we think they're in - // strict mode. - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; - } - function checkStrictModeBinaryExpression(node) { - if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { - // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) - checkStrictModeEvalOrArguments(node, node.left); - } - } - function checkStrictModeCatchClause(node) { - // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the - // Catch production is eval or arguments - if (inStrictMode && node.variableDeclaration) { - checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); - } - } - function checkStrictModeDeleteExpression(node) { - // Grammar checking - if (inStrictMode && node.expression.kind === 69 /* Identifier */) { - // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its - // UnaryExpression is a direct reference to a variable, function argument, or function name - var span = ts.getErrorSpanForNode(file, node.expression); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); - } - } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 /* Identifier */ && - (node.text === "eval" || node.text === "arguments"); - } - function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 69 /* Identifier */) { - var identifier = name; - if (isEvalOrArgumentsIdentifier(identifier)) { - // We check first if the name is inside class declaration or class expression; if so give explicit message - // otherwise report generic error message. - var span = ts.getErrorSpanForNode(file, name); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); - } - } - } - function getStrictModeEvalOrArgumentsMessage(node) { - // Provide specialized messages to help the user understand why we think they're in - // strict mode. - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; - } - function checkStrictModeFunctionName(node) { - if (inStrictMode) { - // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) - checkStrictModeEvalOrArguments(node, node.name); - } - } - function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); - } - } - function checkStrictModePostfixUnaryExpression(node) { - // Grammar checking - // The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression - // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - function checkStrictModePrefixUnaryExpression(node) { - // Grammar checking - if (inStrictMode) { - if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - } - function checkStrictModeWithStatement(node) { - // Grammar checking for withStatement - if (inStrictMode) { - errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); - } - } - function errorOnFirstToken(node, message, arg0, arg1, arg2) { - var span = ts.getSpanOfTokenAtPosition(file, node.pos); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); - } - function getDestructuringParameterName(node) { - return "__" + ts.indexOf(node.parent.parameters, node); - } - function bind(node) { - if (!node) { - return; - } - node.parent = parent; - var savedInStrictMode = inStrictMode; - if (!savedInStrictMode) { - updateStrictMode(node); - } - // First we bind declaration nodes to a symbol if possible. We'll both create a symbol - // and then potentially add the symbol to an appropriate symbol table. Possible - // destination symbol tables are: - // - // 1) The 'exports' table of the current container's symbol. - // 2) The 'members' table of the current container's symbol. - // 3) The 'locals' table of the current container. - // - // However, not all symbols will end up in any of these tables. 'Anonymous' symbols - // (like TypeLiterals for example) will not be put in any table. - bindWorker(node); - // Then we recurse into the children of the node to bind them as well. For certain - // symbols we do specialized work when we recurse. For example, we'll keep track of - // the current 'container' node when it changes. This helps us know which symbol table - // a local should go into for example. - bindChildren(node); - inStrictMode = savedInStrictMode; - } - function updateStrictMode(node) { - switch (node.kind) { - case 248 /* SourceFile */: - case 219 /* ModuleBlock */: - updateStrictModeStatementList(node.statements); - return; - case 192 /* Block */: - if (ts.isFunctionLike(node.parent)) { - updateStrictModeStatementList(node.statements); - } - return; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - // All classes are automatically in strict mode in ES6. - inStrictMode = true; - return; - } - } - function updateStrictModeStatementList(statements) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; - if (!ts.isPrologueDirective(statement)) { - return; - } - if (isUseStrictPrologueDirective(statement)) { - inStrictMode = true; - return; - } - } - } - /// Should be called only on prologue directives (isPrologueDirective(node) should be true) - function isUseStrictPrologueDirective(node) { - var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the - // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; - } - function bindWorker(node) { - switch (node.kind) { - case 69 /* Identifier */: - return checkStrictModeIdentifier(node); - case 181 /* BinaryExpression */: - return checkStrictModeBinaryExpression(node); - case 244 /* CatchClause */: - return checkStrictModeCatchClause(node); - case 175 /* DeleteExpression */: - return checkStrictModeDeleteExpression(node); - case 8 /* NumericLiteral */: - return checkStrictModeNumericLiteral(node); - case 180 /* PostfixUnaryExpression */: - return checkStrictModePostfixUnaryExpression(node); - case 179 /* PrefixUnaryExpression */: - return checkStrictModePrefixUnaryExpression(node); - case 205 /* WithStatement */: - return checkStrictModeWithStatement(node); - case 97 /* ThisKeyword */: - seenThisKeyword = true; - return; - case 137 /* TypeParameter */: - return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 138 /* Parameter */: - return bindParameter(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - return bindVariableDeclarationOrBindingElement(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 247 /* EnumMember */: - return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - // If this is an ObjectLiteralExpression method, then it sits in the same space - // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes - // so that it will conflict with any other object literal members with the same - // name. - return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 213 /* FunctionDeclaration */: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 144 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 145 /* GetAccessor */: - return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 146 /* SetAccessor */: - return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - return bindFunctionOrConstructorType(node); - case 155 /* TypeLiteral */: - return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 165 /* ObjectLiteralExpression */: - return bindObjectLiteralExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - return bindClassLikeDeclaration(node); - case 215 /* InterfaceDeclaration */: - return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 216 /* TypeAliasDeclaration */: - return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 217 /* EnumDeclaration */: - return bindEnumDeclaration(node); - case 218 /* ModuleDeclaration */: - return bindModuleDeclaration(node); - case 221 /* ImportEqualsDeclaration */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: - return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 223 /* ImportClause */: - return bindImportClause(node); - case 228 /* ExportDeclaration */: - return bindExportDeclaration(node); - case 227 /* ExportAssignment */: - return bindExportAssignment(node); - case 248 /* SourceFile */: - return bindSourceFileIfExternalModule(); - } - } - function bindSourceFileIfExternalModule() { - setExportContextFlag(file); - if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); - } - } - function bindExportAssignment(node) { - if (!container.symbol || !container.symbol.exports) { - // Export assignment in some sort of block construct - bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); - } - else if (node.expression.kind === 69 /* Identifier */) { - // An export default clause with an identifier exports all meanings of that identifier - declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); - } - else { - // An export default clause with an expression exports a value - declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); - } - } - function bindExportDeclaration(node) { - if (!container.symbol || !container.symbol.exports) { - // Export * in some sort of block construct - bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); - } - else if (!node.exportClause) { - // All export * declarations are collected in an __export symbol - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); - } - } - function bindImportClause(node) { - if (node.name) { - declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - } - } - function bindClassLikeDeclaration(node) { - if (node.kind === 214 /* ClassDeclaration */) { - bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); - } - else { - var bindingName = node.name ? node.name.text : "__class"; - bindAnonymousDeclaration(node, 32 /* Class */, bindingName); - // Add name of class expression into the map for semantic classifier - if (node.name) { - classifiableNames[node.name.text] = node.name.text; - } - } - var symbol = node.symbol; - // TypeScript 1.0 spec (April 2014): 8.4 - // Every class automatically contains a static property member named 'prototype', the - // type of which is an instantiation of the class type with type Any supplied as a type - // argument for each type parameter. It is an error to explicitly declare a static - // property member with the name 'prototype'. - // - // Note: we check for this here because this class may be merging into a module. The - // module might have an exported variable called 'prototype'. We can't allow that as - // that would clash with the built-in 'prototype' for the class. - var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { - if (node.name) { - node.name.parent = node; - } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); - } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; - prototypeSymbol.parent = symbol; - } - function bindEnumDeclaration(node) { - return ts.isConst(node) - ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */) - : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */); - } - function bindVariableDeclarationOrBindingElement(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.name); - } - if (!ts.isBindingPattern(node.name)) { - if (ts.isBlockOrCatchScoped(node)) { - bindBlockScopedVariableDeclaration(node); - } - else if (ts.isParameterDeclaration(node)) { - // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration - // because its parent chain has already been set up, since parents are set before descending into children. - // - // If node is a binding element in parameter declaration, we need to use ParameterExcludes. - // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration - // For example: - // function foo([a,a]) {} // Duplicate Identifier error - // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter - // // which correctly set excluded symbols - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */); - } - } - } - function bindParameter(node) { - if (inStrictMode) { - // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a - // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - checkStrictModeEvalOrArguments(node, node.name); - } - if (ts.isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node)); - } - else { - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); - } - // If this is a property-parameter, then also declare the property symbol into the - // containing class. - if (node.flags & 56 /* AccessibilityModifier */ && - node.parent.kind === 144 /* Constructor */ && - ts.isClassLike(node.parent.parent)) { - var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); - } - } - function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { - return ts.hasDynamicName(node) - ? bindAnonymousDeclaration(node, symbolFlags, "__computed") - : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); - } - // reachability checks - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1 /* Unintialized */) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1 /* Unintialized */) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - // reference to unknown label or - // break/continue used outside of loops - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); - return true; - } - function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4 /* Unreachable */: - var reportError = - // report error on all statements - ts.isStatement(node) || - // report error on class declarations - node.kind === 214 /* ClassDeclaration */ || - // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || - // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8 /* ReportedUnreachable */; - // unreachable code is reported if - // - user has explicitly asked about it AND - // - statement is in not ambient context (statements in ambient context is already an error - // so we should not report extras) AND - // - node is not variable statement OR - // - node is block scoped variable statement OR - // - node is not block scoped variable statement and at least one variable declaration has initializer - // Rationale: we don't want to report errors on non-initialized var's since they are hoisted - // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 /* VariableStatement */ || - ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } - } - case 8 /* ReportedUnreachable */: - return true; - default: - return false; - } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2 /* Reachable */; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; - } - } -})(ts || (ts = {})); -/// /// /* @internal */ var ts; @@ -5812,6 +4503,10 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 4096 /* DeclarationFile */) !== 0; } @@ -5865,19 +4560,27 @@ var ts; return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJsDocComments(node, sourceFileOfNode) { + return getJsDocCommentsFromText(node, sourceFileOfNode.text); + } + ts.getJsDocComments = getJsDocComments; + function getJsDocCommentsFromText(node, text) { var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? - ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : - getLeadingCommentRangesOfNode(node, sourceFileOfNode); + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47 /* slash */; + return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 3) !== 47 /* slash */; } } - ts.getJsDocComments = getJsDocComments; + ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { @@ -6464,6 +5167,57 @@ var ts; return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + /** + * Returns true if the node is a CallExpression to the identifier 'require' with + * exactly one string literal argument. + * This function does not test if the node is in a JavaScript file or not. + */ + function isRequireCall(expression) { + // of the form 'require("name")' + return expression.kind === 168 /* CallExpression */ && + expression.expression.kind === 69 /* Identifier */ && + expression.expression.text === "require" && + expression.arguments.length === 1 && + expression.arguments[0].kind === 9 /* StringLiteral */; + } + ts.isRequireCall = isRequireCall; + /** + * Returns true if the node is an assignment to a property on the identifier 'exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isExportsPropertyAssignment(expression) { + // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + /** + * Returns true if the node is an assignment to the property access expression 'module.exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isModuleExportsAssignment(expression) { + // of the form 'module.exports = expr' where 'expr' is arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { if (node.kind === 222 /* ImportDeclaration */) { return node.moduleSpecifier; @@ -6791,8 +5545,8 @@ var ts; function getFileReferenceFromReferencePath(comment, commentRange) { var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.exec(comment)) { - if (isNoDefaultLibRegEx.exec(comment)) { + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; @@ -6834,6 +5588,10 @@ var ts; return isFunctionLike(node) && (node.flags & 256 /* Async */) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; + function isStringOrNumericLiteral(kind) { + return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; /** * A declaration has a dynamic name if both of the following are true: * 1. The declaration has a computed property name @@ -6842,11 +5600,15 @@ var ts; * Symbol. */ function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 136 /* ComputedPropertyName */ && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && isDynamicName(declaration.name); } ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 136 /* ComputedPropertyName */ && + !isStringOrNumericLiteral(name.expression.kind) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; /** * Checks if the expression is of the form: * Symbol.name @@ -7087,11 +5849,11 @@ var ts; } ts.getIndentSize = getIndentSize; function createTextWriter(newLine) { - var output = ""; - var indent = 0; - var lineStart = true; - var lineCount = 0; - var linePos = 0; + var output; + var indent; + var lineStart; + var lineCount; + var linePos; function write(s) { if (s && s.length) { if (lineStart) { @@ -7101,6 +5863,13 @@ var ts; output += s; } } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } function rawWrite(s) { if (s !== undefined) { if (lineStart) { @@ -7127,9 +5896,10 @@ var ts; lineStart = true; } } - function writeTextOfNode(sourceFile, node) { - write(getSourceTextOfNodeFromSourceFile(sourceFile, node)); + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); } + reset(); return { write: write, rawWrite: rawWrite, @@ -7142,10 +5912,20 @@ var ts; getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + getText: function () { return output; }, + reset: reset }; } ts.createTextWriter = createTextWriter; + /** + * Resolves a local path to a path which is absolute to the base of the emit + */ + function getExternalModuleNameFromPath(host, fileName) { + var dir = host.getCurrentDirectory(); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, /*isAbsolutePathAnUrl*/ false); + return ts.removeFileExtension(relativePath); + } + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); var emitOutputFilePathWithoutExtension; @@ -7174,6 +5954,10 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + } + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { @@ -7246,22 +6030,22 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { var emitLeadingSpace = !trailingSeparator; ts.forEach(comments, function (comment) { if (emitLeadingSpace) { writer.write(" "); emitLeadingSpace = false; } - writeComment(currentSourceFile, writer, comment, newLine); + writeComment(text, lineMap, writer, comment, newLine); if (comment.hasTrailingNewLine) { writer.writeLine(); } @@ -7279,7 +6063,7 @@ var ts; * Detached comment is a comment at the top of file or function body that is separated from * the next statement by space. */ - function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { var leadingComments; var currentDetachedCommentInfo; if (removeComments) { @@ -7289,12 +6073,12 @@ var ts; // // var x = 10; if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); } } else { // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + leadingComments = ts.getLeadingCommentRanges(text, node.pos); } if (leadingComments) { var detachedComments = []; @@ -7302,8 +6086,8 @@ var ts; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This // comment is not part of the copyright comments. Return what we have so @@ -7318,36 +6102,36 @@ var ts; // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; } } } return currentDetachedCommentInfo; function isPinnedComment(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; } } ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(currentSourceFile, writer, comment, newLine) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lineCount = ts.getLineStarts(currentSourceFile).length; + function writeCommentRange(text, lineMap, writer, comment, newLine) { + if (text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + var lineCount = lineMap.length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + ? text.length + 1 + : lineMap[currentLine + 1]; if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); } // These are number of spaces writer is going to write at current indent var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); @@ -7365,7 +6149,7 @@ var ts; // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); @@ -7383,45 +6167,45 @@ var ts; } } // Write the comment line text - writeTrimmedCurrentLine(pos, nextLineStart); + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { // Single line comment of style //.... - writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); - } - function writeTrimmedCurrentLine(pos, nextLineStart) { - var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - // trimmed forward and ending spaces text - writer.write(currentLineText); - if (end !== comment.end) { - writer.writeLine(); - } - } - else { - // Empty string - make sure we write empty line - writer.writeLiteral(newLine); - } - } - function calculateIndent(pos, end) { - var currentLineIndent = 0; - for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === 9 /* tab */) { - // Tabs = TabSize = indent size and go to next tabStop - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - // Single space - currentLineIndent++; - } - } - return currentLineIndent; + writer.write(text.substring(comment.pos, comment.end)); } } ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + // trimmed forward and ending spaces text + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + // Empty string - make sure we write empty line + writer.writeLiteral(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9 /* tab */) { + // Tabs = TabSize = indent size and go to next tabStop + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + // Single space + currentLineIndent++; + } + } + return currentLineIndent; + } function modifierToFlag(token) { switch (token) { case 113 /* StaticKeyword */: return 64 /* Static */; @@ -7517,14 +6301,14 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; - function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function allowsJsxExpressions(fileName) { + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isTsx = isTsx; + ts.allowsJsxExpressions = allowsJsxExpressions; /** * Replace each instance of non-ascii characters by one, two, three, or four escape sequences * representing the UTF-8 encoding of the character, and return the expanded char code list. @@ -7835,18 +6619,20 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; })(ts || (ts = {})); -/// /// +/// var ts; (function (ts) { - var nodeConstructors = new Array(272 /* Count */); /* @internal */ ts.parseTime = 0; - function getNodeConstructor(kind) { - return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); - } - ts.getNodeConstructor = getNodeConstructor; + var NodeConstructor; + var SourceFileConstructor; function createNode(kind, pos, end) { - return new (getNodeConstructor(kind))(pos, end); + if (kind === 248 /* SourceFile */) { + return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end); + } } ts.createNode = createNode; function visitNode(cbNode, node) { @@ -8269,6 +7055,9 @@ var ts; // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; + // capture constructors in 'initializeState' to avoid null checks + var NodeConstructor; + var SourceFileConstructor; var sourceFile; var parseDiagnostics; var syntaxCursor; @@ -8354,13 +7143,16 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + NodeConstructor = ts.objectAllocator.getNodeConstructor(); + SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -8368,13 +7160,13 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.isTsx(fileName) ? 1 /* JSX */ : 0 /* Standard */); + scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 /* JSX */ : 0 /* Standard */); } function clearState() { // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily. @@ -8389,6 +7181,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32 /* JavaScriptFile */) { + sourceFile.parserContextFlags = 32 /* JavaScriptFile */; + } // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -8406,7 +7201,7 @@ var ts; // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -8461,15 +7256,16 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(248 /* SourceFile */, /*pos*/ 0); - sourceFile.pos = 0; - sourceFile.end = sourceText.length; + // code from createNode is inlined here so createNode won't have to deal with special case of creating source files + // this is quite rare comparing to other nodes and createNode should be as fast as possible + var sourceFile = new SourceFileConstructor(248 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; - sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; + sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; return sourceFile; } function setContextFlag(val, flag) { @@ -8734,12 +7530,13 @@ var ts; return parseExpected(23 /* SemicolonToken */); } } + // note: this function creates only node function createNode(kind, pos) { nodeCount++; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos); + return new NodeConstructor(kind, pos, pos); } function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; @@ -8904,7 +7701,7 @@ var ts; case 12 /* ObjectLiteralMembers */: return token === 19 /* OpenBracketToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); case 9 /* ObjectBindingElements */: - return isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. @@ -9584,9 +8381,7 @@ var ts; } function parseParameterType() { if (parseOptional(54 /* ColonToken */)) { - return token === 9 /* StringLiteral */ - ? parseLiteralNode(/*internName*/ true) - : parseType(); + return parseType(); } return undefined; } @@ -9917,6 +8712,8 @@ var ts; // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); + case 9 /* StringLiteral */: + return parseLiteralNode(/*internName*/ true); case 103 /* VoidKeyword */: case 97 /* ThisKeyword */: return parseTokenNode(); @@ -9946,6 +8743,7 @@ var ts; case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: case 92 /* NewKeyword */: + case 9 /* StringLiteral */: return true; case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, @@ -10362,7 +9160,7 @@ var ts; return 1 /* True */; } // This *could* be a parenthesized arrow function. - // Return Unknown to let the caller know. + // Return Unknown to const the caller know. return 2 /* Unknown */; } else { @@ -10448,7 +9246,7 @@ var ts; // user meant to supply a block. For example, if the user wrote: // // a => - // let v = 0; + // const v = 0; // } // // they may be missing an open brace. Check to see if that's the case so we can @@ -10664,7 +9462,6 @@ var ts; var unaryOperator = token; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { - var diagnostic; var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); @@ -11868,7 +10665,6 @@ var ts; } function parseObjectBindingElement() { var node = createNode(163 /* BindingElement */); - // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -12691,7 +11487,7 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -12786,6 +11582,7 @@ var ts; case 103 /* VoidKeyword */: return parseTokenNode(); } + // TODO (drosen): Parse string literal types in JSDoc as well. return parseJSDocTypeReference(); } function parseJSDocThisType() { @@ -12957,7 +11754,7 @@ var ts; } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -13682,6 +12479,1372 @@ var ts; })(InvalidPosition || (InvalidPosition = {})); })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); +/// +/// +/* @internal */ +var ts; +(function (ts) { + ts.bindTime = 0; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + var Reachability; + (function (Reachability) { + Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; + Reachability[Reachability["Reachable"] = 2] = "Reachable"; + Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; + Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; + })(Reachability || (Reachability = {})); + function or(state1, state2) { + return (state1 | state2) & 2 /* Reachable */ + ? 2 /* Reachable */ + : (state1 & state2) & 8 /* ReportedUnreachable */ + ? 8 /* ReportedUnreachable */ + : 4 /* Unreachable */; + } + function getModuleInstanceState(node) { + // A module is uninstantiated if it contains only + // 1. interface declarations, type alias declarations + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { + return 0 /* NonInstantiated */; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; + } + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { + return 0 /* NonInstantiated */; + } + else if (node.kind === 219 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + // child is non-instantiated - continue searching + return false; + case 2 /* ConstEnumOnly */: + // child is const enum only - record state and continue searching + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + // child is instantiated - record state and stop + state = 1 /* Instantiated */; + return true; + } + }); + return state; + } + else if (node.kind === 218 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); + } + else { + return 1 /* Instantiated */; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + var ContainerFlags; + (function (ContainerFlags) { + // The current node is not a container, and no container manipulation should happen before + // recursing into it. + ContainerFlags[ContainerFlags["None"] = 0] = "None"; + // The current node is a container. It should be set as the current container (and block- + // container) before recursing into it. The current node does not have locals. Examples: + // + // Classes, ObjectLiterals, TypeLiterals, Interfaces... + ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; + // The current node is a block-scoped-container. It should be set as the current block- + // container before recursing into it. Examples: + // + // Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements... + ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags[ContainerFlags["HasLocals"] = 4] = "HasLocals"; + // If the current node is a container that also container that also contains locals. Examples: + // + // Functions, Methods, Modules, Source-files. + ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; + })(ContainerFlags || (ContainerFlags = {})); + var binder = createBinder(); + function bindSourceFile(file, options) { + var start = new Date().getTime(); + binder(file, options); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function createBinder() { + var file; + var options; + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var seenThisKeyword; + // state used by reachability checks + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; + // If this file is an external module, then it is automatically in strict-mode according to + // ES6. If it is not an external module, then we'll determine if it is in strict mode or + // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). + var inStrictMode; + var symbolCount = 0; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; + } + return bindSourceFile; + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolFlags) { + symbol.flags |= symbolFlags; + node.symbol = symbol; + if (!symbol.declarations) { + symbol.declarations = []; + } + symbol.declarations.push(node); + if (symbolFlags & 1952 /* HasExports */ && !symbol.exports) { + symbol.exports = {}; + } + if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { + symbol.members = {}; + } + if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { + symbol.valueDeclaration = node; + } + } + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return "\"" + node.name.text + "\""; + } + if (node.name.kind === 136 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } + return node.name.text; + } + switch (node.kind) { + case 144 /* Constructor */: + return "__constructor"; + case 152 /* FunctionType */: + case 147 /* CallSignature */: + return "__call"; + case 153 /* ConstructorType */: + case 148 /* ConstructSignature */: + return "__new"; + case 149 /* IndexSignature */: + return "__index"; + case 228 /* ExportDeclaration */: + return "__export"; + case 227 /* ExportAssignment */: + return node.isExportEquals ? "export=" : "default"; + case 181 /* BinaryExpression */: + // Binary expression case is for JS module 'module.exports = expr' + return "export="; + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + return node.flags & 512 /* Default */ ? "default" : undefined; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + /** + * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. + * @param symbolTable - The symbol table which node will be added to. + * @param parent - node's parent declaration. + * @param node - The declaration to be added to the symbol table + * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) + * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. + */ + function declareSymbol(symbolTable, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 512 /* Default */; + // The exported symbol for an export default function/class node is always named "default" + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); + var symbol; + if (name !== undefined) { + // Check and see if the symbol table already has a symbol with this name. If not, + // create a new symbol with this name and add it to the table. Note that we don't + // give the new symbol any flags *yet*. This ensures that it will not conflict + // with the 'excludes' flags we pass in. + // + // If we do get an existing symbol, see if it conflicts with the new symbol we're + // creating. For example, a 'var' symbol and a 'class' symbol will conflict within + // the same symbol table. If we have a conflict, report the issue on each + // declaration we have for this symbol, and then create a new symbol for this + // declaration. + // + // If we created a new symbol, either because we didn't have a symbol with this name + // in the symbol table, or we conflicted with an existing symbol, then just add this + // node as the sole declaration of the new symbol. + // + // Otherwise, we'll be merging into a compatible existing symbol (for example when + // you have multiple 'vars' with the same name in the same container). In this case + // just add this node into the declarations list of the symbol. + symbol = ts.hasProperty(symbolTable, name) + ? symbolTable[name] + : (symbolTable[name] = createSymbol(0 /* None */, name)); + if (name && (includes & 788448 /* Classifiable */)) { + classifiableNames[name] = name; + } + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + // Report errors every position with duplicate declaration + // Report errors on previous encountered declarations + var message = symbol.flags & 2 /* BlockScopedVariable */ + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 512 /* Default */) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); + ts.forEach(symbol.declarations, function (declaration) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + symbol = createSymbol(0 /* None */, name); + } + } + else { + symbol = createSymbol(0 /* None */, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + return symbol; + } + function declareModuleMember(node, symbolFlags, symbolExcludes) { + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; + if (symbolFlags & 8388608 /* Alias */) { + if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + else { + // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, + // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set + // on it. There are 2 main reasons: + // + // 1. We treat locals and exports of the same name as mutually exclusive within a container. + // That means the binder will issue a Duplicate Identifier error if you mix locals and exports + // with the same name in the same container. + // TODO: Make this a more specific error and decouple it from the exclusion logic. + // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, + // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way + // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. + if (hasExportModifier || container.flags & 131072 /* ExportContext */) { + var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | + (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | + (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + node.localSymbol = local; + return local; + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + } + // All container nodes are kept on a linked list in declaration order. This list is used by + // the getLocalNameOfContainer function in the type checker to validate that the local name + // used for a container is unique. + function bindChildren(node) { + // Before we recurse into a node's chilren, we first save the existing parent, container + // and block-container. Then after we pop out of processing the children, we restore + // these saved values. + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + // This node will now be set as the parent of all of its children as we recurse into them. + parent = node; + // Depending on what kind of node this is, we may have to adjust the current container + // and block-container. If the current node is a container, then it is automatically + // considered the current block-container as well. Also, for containers that we know + // may contain locals, we proactively initialize the .locals field. We do this because + // it's highly likely that the .locals will be needed to place some child in (for example, + // a parameter, or variable declaration). + // + // However, we do not proactively create the .locals for block-containers because it's + // totally normal and common for block-containers to never actually have a block-scoped + // variable in them. We don't want to end up allocating an object for every 'block' we + // run into when most of them won't be necessary. + // + // Finally, if this is a block-container, then we clear out any existing .locals object + // it may contain within it. This happens in incremental scenarios. Because we can be + // reusing a node from a previous compilation, that node may have had 'locals' created + // for it. We must clear this so we don't accidently move any stale data forward from + // a previous compilation. + var containerFlags = getContainerFlags(node); + if (containerFlags & 1 /* IsContainer */) { + container = blockScopeContainer = node; + if (containerFlags & 4 /* HasLocals */) { + container.locals = {}; + } + addToContainerChain(container); + } + else if (containerFlags & 2 /* IsBlockScopedContainer */) { + blockScopeContainer = node; + blockScopeContainer.locals = undefined; + } + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + // reset all reachability check related flags on node (for incremental scenarios) + flags &= ~1572864 /* ReachabilityCheckFlags */; + if (kind === 215 /* InterfaceDeclaration */) { + seenThisKeyword = false; + } + var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2 /* Reachable */; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288 /* HasImplicitReturn */; + if (hasExplicitReturn) { + flags |= 1048576 /* HasExplicitReturn */; + } + } + if (kind === 215 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; + } + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + /** + * Returns true if node and its subnodes were successfully traversed. + * Returning false means that node was not examined and caller needs to dive into the node himself. + */ + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198 /* WhileStatement */: + bindWhileStatement(node); + break; + case 197 /* DoStatement */: + bindDoStatement(node); + break; + case 199 /* ForStatement */: + bindForStatement(node); + break; + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + bindForInOrForOfStatement(node); + break; + case 196 /* IfStatement */: + bindIfStatement(node); + break; + case 204 /* ReturnStatement */: + case 208 /* ThrowStatement */: + bindReturnOrThrow(node); + break; + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + bindBreakOrContinueStatement(node); + break; + case 209 /* TryStatement */: + bindTryStatement(node); + break; + case 206 /* SwitchStatement */: + bindSwitchStatement(node); + break; + case 220 /* CaseBlock */: + bindCaseBlock(node); + break; + case 207 /* LabeledStatement */: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // bind expressions (don't affect reachability) + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; + popImplicitLabel(postDoLabel, postDoState); + // bind expressions (don't affect reachability) + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + // for statement is considered infinite when it condition is either omitted or is true keyword + // - for(..;;..) + // - for(..;true;..) + var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); + var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + // denotes reachability state when entering 'thenStatement' part of the if statement: + // i.e. if condition is false then thenStatement is unreachable + var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // denotes reachability state when entering 'elseStatement': + // i.e. if condition is true then elseStatement is unreachable + var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + currentReachabilityState = ifTrueState; + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + // bind expression (don't affect reachability) + bind(n.expression); + if (n.kind === 204 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentReachabilityState = 4 /* Unreachable */; + } + function bindBreakOrContinueStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + // for continue case touch label so it will be marked a used + var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + if (isValidJump) { + currentReachabilityState = 4 /* Unreachable */; + } + } + function bindTryStatement(n) { + // catch\finally blocks has the same reachability as try block + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + // post catch/finally state is reachable if + // - post try state is reachable - control flow can fall out of try block + // - post catch state is reachable - control flow can fall out of catch block + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); + // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case + var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } + function getContainerFlags(node) { + switch (node.kind) { + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + return 1 /* IsContainer */; + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 218 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 216 /* TypeAliasDeclaration */: + return 5 /* IsContainerWithLocals */; + case 244 /* CatchClause */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 220 /* CaseBlock */: + return 2 /* IsBlockScopedContainer */; + case 192 /* Block */: + // do not treat blocks directly inside a function as a block-scoped-container. + // Locals that reside in this block should go to the function locals. Othewise 'x' + // would not appear to be a redeclaration of a block scoped local in the following + // example: + // + // function foo() { + // var x; + // let x; + // } + // + // If we placed 'var x' into the function locals and 'let x' into the locals of + // the block, then there would be no collision. + // + // By not creating a new block-scoped-container here, we ensure that both 'var x' + // and 'let x' go into the Function-container's locals, and we do get a collision + // conflict. + return ts.isFunctionLike(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */; + } + return 0 /* None */; + } + function addToContainerChain(next) { + if (lastContainer) { + lastContainer.nextContainer = next; + } + lastContainer = next; + } + function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { + // Just call this directly so that the return type of this function stays "void". + declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); + } + function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { + switch (container.kind) { + // Modules, source files, and classes need specialized handling for how their + // members are declared (for example, a member of a class will go into a specific + // symbol table depending on if it is static or not). We defer to specialized + // handlers to take care of declaring these child members. + case 218 /* ModuleDeclaration */: + return declareModuleMember(node, symbolFlags, symbolExcludes); + case 248 /* SourceFile */: + return declareSourceFileMember(node, symbolFlags, symbolExcludes); + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 217 /* EnumDeclaration */: + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + case 215 /* InterfaceDeclaration */: + // Interface/Object-types always have their children added to the 'members' of + // their container. They are only accessible through an instance of their + // container, and are never in scope otherwise (even inside the body of the + // object / type / interface declaring them). An exception is type parameters, + // which are in scope without qualification (similar to 'locals'). + return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 216 /* TypeAliasDeclaration */: + // All the children of these container types are never visible through another + // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, + // they're only accessed 'lexically' (i.e. from code that exists underneath + // their container in the tree. To accomplish this, we simply add their declared + // symbol to the 'locals' of the container. These symbols can then be found as + // the type checker walks up the containers, checking them for matching names. + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function declareClassMember(node, symbolFlags, symbolExcludes) { + return node.flags & 64 /* Static */ + ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) + : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + } + function declareSourceFileMember(node, symbolFlags, symbolExcludes) { + return ts.isExternalModule(file) + ? declareModuleMember(node, symbolFlags, symbolExcludes) + : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + } + function hasExportDeclarations(node) { + var body = node.kind === 248 /* SourceFile */ ? node : node.body; + if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var stat = _a[_i]; + if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { + return true; + } + } + } + return false; + } + function setExportContextFlag(node) { + // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular + // declarations with export modifiers) is an export context in which declarations are implicitly exported. + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072 /* ExportContext */; + } + else { + node.flags &= ~131072 /* ExportContext */; + } + } + function bindModuleDeclaration(node) { + setExportContextFlag(node); + if (node.name.kind === 9 /* StringLiteral */) { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } + else { + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { + // if module was already merged with some function, class or non-const enum + // treat is a non-const-enum-only + node.symbol.constEnumOnlyModule = false; + } + else { + var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; + if (node.symbol.constEnumOnlyModule === undefined) { + // non-merged case - use the current state + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + // merged case: module is const enum only if all its pieces are non-instantiated or const enum + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } + } + } + } + } + function bindFunctionOrConstructorType(node) { + // For a given function symbol "<...>(...) => T" we want to generate a symbol identical + // to the one we would get for: { <...>(...): T } + // + // We do that by making an anonymous type literal symbol, and then setting the function + // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable + // from an actual type literal symbol you would have gotten had you used the long form. + var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072 /* Signature */); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); + var _a; + } + function bindObjectLiteralExpression(node) { + var ElementKind; + (function (ElementKind) { + ElementKind[ElementKind["Property"] = 1] = "Property"; + ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; + })(ElementKind || (ElementKind = {})); + if (inStrictMode) { + var seen = {}; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.name.kind !== 69 /* Identifier */) { + continue; + } + var identifier = prop.name; + // ECMA-262 11.1.5 Object Initialiser + // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true + // a.This production is contained in strict code and IsDataDescriptor(previous) is true and + // IsDataDescriptor(propId.descriptor) is true. + // b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true. + // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. + // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true + // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields + var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ + ? 1 /* Property */ + : 2 /* Accessor */; + var existingKind = seen[identifier.text]; + if (!existingKind) { + seen[identifier.text] = currentKind; + continue; + } + if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { + var span = ts.getErrorSpanForNode(file, identifier); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); + } + } + } + return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); + } + function bindAnonymousDeclaration(node, symbolFlags, name) { + var symbol = createSymbol(symbolFlags, name); + addDeclarationToSymbol(symbol, node, symbolFlags); + } + function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { + switch (blockScopeContainer.kind) { + case 218 /* ModuleDeclaration */: + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + case 248 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + } + // fall through. + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + addToContainerChain(blockScopeContainer); + } + declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function bindBlockScopedVariableDeclaration(node) { + bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + } + // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized + // check for reserved words used as identifiers in strict mode code. + function checkStrictModeIdentifier(node) { + if (inStrictMode && + node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && + !ts.isIdentifierName(node)) { + // Report error only if there are no parse errors in file + if (!file.parseDiagnostics.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); + } + } + } + function getStrictModeIdentifierMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; + } + function checkStrictModeBinaryExpression(node) { + if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + checkStrictModeEvalOrArguments(node, node.left); + } + } + function checkStrictModeCatchClause(node) { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + if (inStrictMode && node.variableDeclaration) { + checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); + } + } + function checkStrictModeDeleteExpression(node) { + // Grammar checking + if (inStrictMode && node.expression.kind === 69 /* Identifier */) { + // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its + // UnaryExpression is a direct reference to a variable, function argument, or function name + var span = ts.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + } + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 69 /* Identifier */ && + (node.text === "eval" || node.text === "arguments"); + } + function checkStrictModeEvalOrArguments(contextNode, name) { + if (name && name.kind === 69 /* Identifier */) { + var identifier = name; + if (isEvalOrArgumentsIdentifier(identifier)) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + var span = ts.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + } + } + } + function getStrictModeEvalOrArgumentsMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; + } + function checkStrictModeFunctionName(node) { + if (inStrictMode) { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) + checkStrictModeEvalOrArguments(node, node.name); + } + } + function checkStrictModeNumericLiteral(node) { + if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); + } + } + function checkStrictModePostfixUnaryExpression(node) { + // Grammar checking + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + function checkStrictModePrefixUnaryExpression(node) { + // Grammar checking + if (inStrictMode) { + if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + } + function checkStrictModeWithStatement(node) { + // Grammar checking for withStatement + if (inStrictMode) { + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function errorOnFirstToken(node, message, arg0, arg1, arg2) { + var span = ts.getSpanOfTokenAtPosition(file, node.pos); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + if (!node) { + return; + } + node.parent = parent; + var savedInStrictMode = inStrictMode; + if (!savedInStrictMode) { + updateStrictMode(node); + } + // First we bind declaration nodes to a symbol if possible. We'll both create a symbol + // and then potentially add the symbol to an appropriate symbol table. Possible + // destination symbol tables are: + // + // 1) The 'exports' table of the current container's symbol. + // 2) The 'members' table of the current container's symbol. + // 3) The 'locals' table of the current container. + // + // However, not all symbols will end up in any of these tables. 'Anonymous' symbols + // (like TypeLiterals for example) will not be put in any table. + bindWorker(node); + // Then we recurse into the children of the node to bind them as well. For certain + // symbols we do specialized work when we recurse. For example, we'll keep track of + // the current 'container' node when it changes. This helps us know which symbol table + // a local should go into for example. + bindChildren(node); + inStrictMode = savedInStrictMode; + } + function updateStrictMode(node) { + switch (node.kind) { + case 248 /* SourceFile */: + case 219 /* ModuleBlock */: + updateStrictModeStatementList(node.statements); + return; + case 192 /* Block */: + if (ts.isFunctionLike(node.parent)) { + updateStrictModeStatementList(node.statements); + } + return; + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + // All classes are automatically in strict mode in ES6. + inStrictMode = true; + return; + } + } + function updateStrictModeStatementList(statements) { + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; + if (!ts.isPrologueDirective(statement)) { + return; + } + if (isUseStrictPrologueDirective(statement)) { + inStrictMode = true; + return; + } + } + } + /// Should be called only on prologue directives (isPrologueDirective(node) should be true) + function isUseStrictPrologueDirective(node) { + var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); + // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the + // string to contain unicode escapes (as per ES5). + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + } + function bindWorker(node) { + switch (node.kind) { + /* Strict mode checks */ + case 69 /* Identifier */: + return checkStrictModeIdentifier(node); + case 181 /* BinaryExpression */: + if (ts.isInJavaScriptFile(node)) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } + return checkStrictModeBinaryExpression(node); + case 244 /* CatchClause */: + return checkStrictModeCatchClause(node); + case 175 /* DeleteExpression */: + return checkStrictModeDeleteExpression(node); + case 8 /* NumericLiteral */: + return checkStrictModeNumericLiteral(node); + case 180 /* PostfixUnaryExpression */: + return checkStrictModePostfixUnaryExpression(node); + case 179 /* PrefixUnaryExpression */: + return checkStrictModePrefixUnaryExpression(node); + case 205 /* WithStatement */: + return checkStrictModeWithStatement(node); + case 97 /* ThisKeyword */: + seenThisKeyword = true; + return; + case 137 /* TypeParameter */: + return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); + case 138 /* Parameter */: + return bindParameter(node); + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + return bindVariableDeclarationOrBindingElement(node); + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); + case 247 /* EnumMember */: + return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + // If this is an ObjectLiteralExpression method, then it sits in the same space + // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes + // so that it will conflict with any other object literal members with the same + // name. + return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); + case 213 /* FunctionDeclaration */: + checkStrictModeFunctionName(node); + return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); + case 144 /* Constructor */: + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); + case 145 /* GetAccessor */: + return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); + case 146 /* SetAccessor */: + return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + return bindFunctionOrConstructorType(node); + case 155 /* TypeLiteral */: + return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); + case 165 /* ObjectLiteralExpression */: + return bindObjectLiteralExpression(node); + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); + case 168 /* CallExpression */: + if (ts.isInJavaScriptFile(node)) { + bindCallExpression(node); + } + break; + // Members of classes, interfaces, and modules + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + return bindClassLikeDeclaration(node); + case 215 /* InterfaceDeclaration */: + return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); + case 216 /* TypeAliasDeclaration */: + return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); + case 217 /* EnumDeclaration */: + return bindEnumDeclaration(node); + case 218 /* ModuleDeclaration */: + return bindModuleDeclaration(node); + // Imports and exports + case 221 /* ImportEqualsDeclaration */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: + return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + case 223 /* ImportClause */: + return bindImportClause(node); + case 228 /* ExportDeclaration */: + return bindExportDeclaration(node); + case 227 /* ExportAssignment */: + return bindExportAssignment(node); + case 248 /* SourceFile */: + return bindSourceFileIfExternalModule(); + } + } + function bindSourceFileIfExternalModule() { + setExportContextFlag(file); + if (ts.isExternalModule(file)) { + bindSourceFileAsExternalModule(); + } + } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } + function bindExportAssignment(node) { + var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; + if (!container.symbol || !container.symbol.exports) { + // Export assignment in some sort of block construct + bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); + } + else if (boundExpression.kind === 69 /* Identifier */) { + // An export default clause with an identifier exports all meanings of that identifier + declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); + } + else { + // An export default clause with an expression exports a value + declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); + } + } + function bindExportDeclaration(node) { + if (!container.symbol || !container.symbol.exports) { + // Export * in some sort of block construct + bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); + } + else if (!node.exportClause) { + // All export * declarations are collected in an __export symbol + declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); + } + } + function bindImportClause(node) { + if (node.name) { + declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } + } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + // When we create a property via 'exports.foo = bar', the 'exports.foo' property access + // expression is the declaration + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); + } + function bindModuleExportsAssignment(node) { + // 'module.exports = expr' assignment + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node) { + if (node.kind === 214 /* ClassDeclaration */) { + bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); + } + else { + var bindingName = node.name ? node.name.text : "__class"; + bindAnonymousDeclaration(node, 32 /* Class */, bindingName); + // Add name of class expression into the map for semantic classifier + if (node.name) { + classifiableNames[node.name.text] = node.name.text; + } + } + var symbol = node.symbol; + // TypeScript 1.0 spec (April 2014): 8.4 + // Every class automatically contains a static property member named 'prototype', the + // type of which is an instantiation of the class type with type Any supplied as a type + // argument for each type parameter. It is an error to explicitly declare a static + // property member with the name 'prototype'. + // + // Note: we check for this here because this class may be merging into a module. The + // module might have an exported variable called 'prototype'. We can't allow that as + // that would clash with the built-in 'prototype' for the class. + var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + function bindEnumDeclaration(node) { + return ts.isConst(node) + ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */) + : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */); + } + function bindVariableDeclarationOrBindingElement(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (!ts.isBindingPattern(node.name)) { + if (ts.isBlockOrCatchScoped(node)) { + bindBlockScopedVariableDeclaration(node); + } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */); + } + } + } + function bindParameter(node) { + if (inStrictMode) { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) + checkStrictModeEvalOrArguments(node, node.name); + } + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node)); + } + else { + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); + } + // If this is a property-parameter, then also declare the property symbol into the + // containing class. + if (node.flags & 56 /* AccessibilityModifier */ && + node.parent.kind === 144 /* Constructor */ && + ts.isClassLike(node.parent.parent)) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); + } + } + function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + return ts.hasDynamicName(node) + ? bindAnonymousDeclaration(node, symbolFlags, "__computed") + : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + // reachability checks + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1 /* Unintialized */) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1 /* Unintialized */) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + // reference to unknown label or + // break/continue used outside of loops + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4 /* Unreachable */: + var reportError = + // report error on all statements except empty ones + (ts.isStatement(node) && node.kind !== 194 /* EmptyStatement */) || + // report error on class declarations + node.kind === 214 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8 /* ReportedUnreachable */; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8 /* ReportedUnreachable */: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2 /* Reachable */; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } + } +})(ts || (ts = {})); /// /* @internal */ var ts; @@ -13755,7 +13918,7 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: getApparentTypeOfContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -14025,7 +14188,7 @@ var ts; return ts.getAncestor(node, 248 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 248 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -14127,15 +14290,24 @@ var ts; } switch (location.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location)) + if (!ts.isExternalOrCommonJsModule(location)) break; case 218 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; if (location.kind === 248 /* SourceFile */ || (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { - // It's an external module. Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope. Therefore, - // if the name we find is purely an export specifier, it is not actually considered in scope. + // It's an external module. First see if the module has an export default and if the local + // name of that export default matches. + if (result = moduleExports["default"]) { + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } + // Because of module/namespace merging, a module's exports are in scope, + // yet we never want to treat an export specifier as putting a member in scope. + // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol // on an export specifier is that it might find the export specifier itself, and try to @@ -14149,12 +14321,6 @@ var ts; ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { break; } - result = moduleExports["default"]; - var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { - break loop; - } - result = undefined; } if (result = getSymbol(moduleExports, name, meaning & 8914931 /* ModuleMember */)) { break loop; @@ -14297,7 +14463,7 @@ var ts; // declare module foo { // interface bar {} // } - // let foo/*1*/: foo/*2*/.bar; + // const foo/*1*/: foo/*2*/.bar; // The foo at /*1*/ and /*2*/ will share same symbol with two meaning // block - scope variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, @@ -14601,6 +14767,9 @@ var ts; if (moduleName === undefined) { return; } + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); @@ -14788,7 +14957,7 @@ var ts; } switch (location_1.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location_1)) { + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } case 218 /* ModuleDeclaration */: @@ -14910,7 +15079,7 @@ var ts; // export class c { // } // } - // let x: typeof m.c + // const x: typeof m.c // In the above example when we start with checking if typeof m.c symbol is accessible, // we are going to see if c can be accessed in scope directly. // But it can't, hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible @@ -14949,7 +15118,7 @@ var ts; } function hasExternalModuleSymbol(declaration) { return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 248 /* SourceFile */ && ts.isExternalModule(declaration)); + (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -15100,7 +15269,7 @@ var ts; parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); } - // Let the writer know we just wrote out a symbol. The declaration emitter writer uses + // const the writer know we just wrote out a symbol. The declaration emitter writer uses // this to determine if an import it has previously seen (and not written out) needs // to be written to the file once the walk of the tree is complete. // @@ -15181,7 +15350,7 @@ var ts; writeAnonymousType(type, flags); } else if (type.flags & 256 /* StringLiteral */) { - writer.writeStringLiteral(type.text); + writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); } else { // Should never get here @@ -15568,7 +15737,7 @@ var ts; } } else if (node.kind === 248 /* SourceFile */) { - return ts.isExternalModule(node) ? node : undefined; + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -15650,7 +15819,7 @@ var ts; // Private/protected properties/methods are not visible return false; } - // Public properties/methods are visible if its parents are visible, so let it fall into next case statement + // Public properties/methods are visible if its parents are visible, so const it fall into next case statement case 144 /* Constructor */: case 148 /* ConstructSignature */: case 147 /* CallSignature */: @@ -15678,7 +15847,7 @@ var ts; // Source file is always visible case 248 /* SourceFile */: return true; - // Export assignements do not create name bindings outside the module + // Export assignments do not create name bindings outside the module case 227 /* ExportAssignment */: return false; default: @@ -15814,6 +15983,23 @@ var ts; var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); } + function getTextOfPropertyName(name) { + switch (name.kind) { + case 69 /* Identifier */: + return name.text; + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + return name.text; + case 136 /* ComputedPropertyName */: + if (ts.isStringOrNumericLiteral(name.expression.kind)) { + return name.expression.text; + } + } + return undefined; + } + function isComputedNonLiteralName(name) { + return name.kind === 136 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + } // Return the inferred type for a binding element function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -15835,10 +16021,15 @@ var ts; if (pattern.kind === 161 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_10)) { + // computed properties with non-literal names are treated as 'any' + return anyType; + } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - type = getTypeOfPropertyOfType(parentType, name_10.text) || - isNumericLiteralName(name_10.text) && getIndexTypeOfType(parentType, 1 /* Number */) || + var text = getTextOfPropertyName(name_10); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { error(name_10, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_10)); @@ -15938,10 +16129,17 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; + var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { - var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type + hasComputedProperties = true; + return; + } + var text = getTextOfPropertyName(name); + var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); + var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType); symbol.bindingElement = e; members[symbol.name] = symbol; @@ -15950,6 +16148,9 @@ var ts; if (includePatternInType) { result.pattern = pattern; } + if (hasComputedProperties) { + result.flags |= 67108864 /* ObjectLiteralPatternWithComputedProperties */; + } return result; } // Return the type implied by an array binding pattern @@ -16026,6 +16227,14 @@ var ts; if (declaration.kind === 227 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } + // Handle module.exports = expr + if (declaration.kind === 181 /* BinaryExpression */) { + return links.type = checkExpression(declaration.right); + } + // Handle exports.p = expr + if (declaration.kind === 166 /* PropertyAccessExpression */) { + return checkExpressionCached(declaration.parent.right); + } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; @@ -16304,23 +16513,25 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseContructorType = getBaseConstructorTypeOfClass(type); - if (!(baseContructorType.flags & 80896 /* ObjectType */)) { + var baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & 80896 /* ObjectType */)) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); var baseType; - if (baseContructorType.symbol && baseContructorType.symbol.flags & 32 /* Class */) { - // When base constructor type is a class we know that the constructors all have the same type parameters as the + var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 /* Class */ && + areAllOuterTypeParametersApplied(originalBaseType)) { + // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the // class and all return the instance type of the class. There is no need for further checks and we can apply the // type arguments in the same manner as a type reference to get the same error reporting experience. - baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseContructorType.symbol); + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } else { // The class derives from a "class-like" constructor function, check that we have at least one construct signature // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere // we check that all instantiated signatures return the same type. - var constructors = getInstantiatedConstructorsForTypeArguments(baseContructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -16345,6 +16556,17 @@ var ts; type.resolvedBaseTypes.push(baseType); } } + function areAllOuterTypeParametersApplied(type) { + // An unapplied type parameter has its symbol still the same as the matching argument symbol. + // Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked. + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last = outerTypeParameters.length - 1; + var typeArguments = type.typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; + } + return true; + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { @@ -16424,7 +16646,7 @@ var ts; type.typeArguments = type.typeParameters; type.thisType = createType(512 /* TypeParameter */ | 33554432 /* ThisType */); type.thisType.symbol = symbol; - type.thisType.constraint = getTypeWithThisArgument(type); + type.thisType.constraint = type; } } return links.declaredType; @@ -16939,6 +17161,20 @@ var ts; type = getApparentType(type); return type.flags & 49152 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + /** + * The apparent type of a type parameter is the base constraint instantiated with the type parameter + * as the type argument for the 'this' type. + */ + function getApparentTypeOfTypeParameter(type) { + if (!type.resolvedApparentType) { + var constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & 512 /* TypeParameter */) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the @@ -16946,12 +17182,7 @@ var ts; */ function getApparentType(type) { if (type.flags & 512 /* TypeParameter */) { - do { - type = getConstraintOfTypeParameter(type); - } while (type && type.flags & 512 /* TypeParameter */); - if (!type) { - type = emptyObjectType; - } + type = getApparentTypeOfTypeParameter(type); } if (type.flags & 258 /* StringLike */) { type = globalStringType; @@ -17116,7 +17347,7 @@ var ts; if (node.initializer) { var signatureDeclaration = node.parent; var signature = getSignatureFromDeclaration(signatureDeclaration); - var parameterIndex = signatureDeclaration.parameters.indexOf(node); + var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } @@ -17217,6 +17448,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { @@ -17740,11 +17981,12 @@ var ts; return links.resolvedType; } function getStringLiteralType(node) { - if (ts.hasProperty(stringLiteralTypes, node.text)) { - return stringLiteralTypes[node.text]; + var text = node.text; + if (ts.hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; } - var type = stringLiteralTypes[node.text] = createType(256 /* StringLiteral */); - type.text = ts.getTextOfNode(node); + var type = stringLiteralTypes[text] = createType(256 /* StringLiteral */); + type.text = text; return type; } function getTypeFromStringLiteral(node) { @@ -18265,7 +18507,7 @@ var ts; return false; } function hasExcessProperties(source, target, reportErrors) { - if (someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { + if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -18358,9 +18600,6 @@ var ts; return result; } function typeParameterIdenticalTo(source, target) { - if (source.symbol.name !== target.symbol.name) { - return 0 /* False */; - } // covers case when both type parameters does not have constraint (both equal to noConstraintType) if (source.constraint === target.constraint) { return -1 /* True */; @@ -18852,18 +19091,29 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } + function isMatchingSignature(source, target, partialMatch) { + // A source signature matches a target signature if the two signatures have the same number of required, + // optional, and rest parameters. + if (source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter) { + return true; + } + // A source signature partially matches a target signature if the target signature has no fewer required + // parameters and no more overall parameters than the source signature (where a signature with a rest + // parameter is always considered to have more overall parameters than one without). + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; + } function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1 /* True */; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { - if (!partialMatch || - source.parameters.length < target.parameters.length && !source.hasRestParameter || - source.minArgumentCount > target.minArgumentCount) { - return 0 /* False */; - } + if (!(isMatchingSignature(source, target, partialMatch))) { + return 0 /* False */; } var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { @@ -18957,6 +19207,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isStringLiteralType(type) { + return type.flags & 256 /* StringLiteral */; + } /** * Check if a Type was written as a tuple type literal. * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. @@ -19629,7 +19882,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -19660,6 +19913,12 @@ var ts; } } if (targetType) { + if (!assumeTrue) { + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); + } + return type; + } return getNarrowedType(type, targetType); } return type; @@ -20129,6 +20388,9 @@ var ts; function getIndexTypeOfContextualType(type, kind) { return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } + function contextualTypeIsStringLiteralType(type) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isStringLiteralType) : isStringLiteralType(type)); + } // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); @@ -20150,7 +20412,7 @@ var ts; } function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; - var type = getContextualType(objectLiteral); + var type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!ts.hasDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name @@ -20173,7 +20435,7 @@ var ts; // type of T. function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; - var type = getContextualType(arrayLiteral); + var type = getApparentTypeOfContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) @@ -20206,11 +20468,28 @@ var ts; } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. - function getContextualType(node) { - var type = getContextualTypeWorker(node); + function getApparentTypeOfContextualType(node) { + var type = getContextualType(node); return type && getApparentType(type); } - function getContextualTypeWorker(node) { + /** + * Woah! Do you really want to use this function? + * + * Unless you're trying to get the *non-apparent* type for a + * value-literal type or you're authoring relevant portions of this algorithm, + * you probably meant to use 'getApparentTypeOfContextualType'. + * Otherwise this may not be very useful. + * + * In cases where you *are* working on this function, you should understand + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * + * - Use 'getContextualType' when you are simply going to propagate the result to the expression. + * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. + * + * @param node the expression whose contextual type will be returned. + * @returns the contextual type of an expression. + */ + function getContextualType(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -20285,7 +20564,7 @@ var ts; ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + : getApparentTypeOfContextualType(node); if (!type) { return undefined; } @@ -20411,7 +20690,7 @@ var ts; type.pattern = node; return type; } - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting @@ -20494,10 +20773,11 @@ var ts; checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); var typeFlags = 0; + var patternWithComputedProperties = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -20525,8 +20805,11 @@ var ts; if (isOptional) { prop.flags |= 536870912 /* Optional */; } + if (ts.hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } } - else if (contextualTypeHasPattern) { + else if (contextualTypeHasPattern && !(contextualType.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */)) { // If object literal is contextually typed by the implied type of a binding pattern, and if the // binding pattern specifies a default value for the property, make the property optional. var impliedProp = getPropertyOfType(contextualType, member.name); @@ -20578,7 +20861,7 @@ var ts; var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; - result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); + result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */) | (patternWithComputedProperties ? 67108864 /* ObjectLiteralPatternWithComputedProperties */ : 0); if (inDestructuringPattern) { result.pattern = node; } @@ -21289,7 +21572,7 @@ var ts; // so order how inherited signatures are processed is still preserved. // interface A { (x: string): void } // interface B extends A { (x: 'foo'): string } - // let b: B; + // const b: B; // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void] function reorderCandidates(signatures, result) { var lastParent; @@ -22247,6 +22530,10 @@ var ts; return anyType; } } + // In JavaScript files, calls to any identifier 'require' are treated as external module imports + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -22257,7 +22544,10 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - if (!(isTypeAssignableTo(targetType, widenedType))) { + // Permit 'number[] | "foo"' to be asserted to 'string'. + var bothAreStringLike = someConstituentTypeHasKind(targetType, 258 /* StringLike */) && + someConstituentTypeHasKind(widenedType, 258 /* StringLike */); + if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } } @@ -22801,19 +23091,26 @@ var ts; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { - // TODO(andersh): Computed property support var name_13 = p.name; + if (name_13.kind === 136 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + continue; + } + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType - : getTypeOfPropertyOfType(sourceType, name_13.text) || - isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || + : getTypeOfPropertyOfType(sourceType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { if (p.kind === 246 /* ShorthandPropertyAssignment */) { checkDestructuringAssignment(p, type); } else { - checkDestructuringAssignment(p.initializer || name_13, type); + // non-shorthand property assignments should always have initializers + checkDestructuringAssignment(p.initializer, type); } } else { @@ -23014,6 +23311,10 @@ var ts; case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (someConstituentTypeHasKind(leftType, 258 /* StringLike */) && someConstituentTypeHasKind(rightType, 258 /* StringLike */)) { + return booleanType; + } if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -23137,6 +23438,13 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkStringLiteralExpression(node) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralType(node); + } + return stringType; + } function checkTemplateExpression(node) { // We just want to check each expressions, but we are unconcerned with // the type of each expression, as any value may be coerced into a string. @@ -23187,7 +23495,7 @@ var ts; if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { @@ -23251,6 +23559,7 @@ var ts; case 183 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: + return checkStringLiteralExpression(node); case 11 /* NoSubstitutionTemplateLiteral */: return stringType; case 10 /* RegularExpressionLiteral */: @@ -24580,7 +24889,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 248 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -24598,15 +24907,15 @@ var ts; // A non-initialized declaration is a no-op as the block declaration will resolve before the var // declaration. the problem is if the declaration has an initializer. this will act as a write to the // block declared value. this is fine for let, but not const. - // Only consider declarations with initializers, uninitialized let declarations will not + // Only consider declarations with initializers, uninitialized const declarations will not // step on a let/const variable. - // Do not consider let and const declarations, as duplicate block-scoped declarations + // Do not consider const and const declarations, as duplicate block-scoped declarations // are handled by the binder. - // We are only looking for let declarations that step on let\const declarations from a + // We are only looking for const declarations that step on let\const declarations from a // different scope. e.g.: // { // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration - // let x = 0; // symbol for this declaration will be 'symbol' + // const x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { @@ -24693,6 +25002,12 @@ var ts; checkExpressionCached(node.initializer); } } + if (node.kind === 163 /* BindingElement */) { + // check computed properties inside property names of binding elements + if (node.propertyName && node.propertyName.kind === 136 /* ComputedPropertyName */) { + checkComputedPropertyName(node.propertyName); + } + } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); @@ -25176,6 +25491,7 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); + var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { @@ -25195,6 +25511,10 @@ var ts; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258 /* StringLike */)) { + return; + } if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); @@ -25659,11 +25979,14 @@ var ts; var enumIsConst = ts.isConst(node); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.name.kind === 136 /* ComputedPropertyName */) { + if (isComputedNonLiteralName(member.name)) { error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } - else if (isNumericLiteralName(member.name.text)) { - error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + else { + var text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } } var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; @@ -26305,8 +26628,8 @@ var ts; } // Function and class expression bodies are checked after all statements in the enclosing body. This is // to ensure constructs like the following are permitted: - // let foo = function () { - // let s = foo(); + // const foo = function () { + // const s = foo(); // return "hello"; // } // Here, performing a full type check of the body of the function expression whilst in the process of @@ -26421,8 +26744,12 @@ var ts; if (!(links.flags & 1 /* TypeChecked */)) { // Check whether the file has declared it is the default lib, // and whether the user has specifically chosen to avoid checking it. - if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) { - return; + if (compilerOptions.skipDefaultLibCheck) { + // If the user specified '--noLib' and a file has a '/// ', + // then we should treat that file as a default lib. + if (node.hasNoDefaultLib) { + return; + } } // Grammar checking checkGrammarSourceFile(node); @@ -26432,7 +26759,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -26515,7 +26842,7 @@ var ts; } switch (location.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalOrCommonJsModule(location)) { break; } case 218 /* ModuleDeclaration */: @@ -27153,9 +27480,18 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, - isArgumentsLocalBinding: isArgumentsLocalBinding + isArgumentsLocalBinding: isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration }; } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = ts.getExternalModuleName(declaration); + var moduleSymbol = getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return undefined; + } + return ts.getDeclarationOfKind(moduleSymbol, 248 /* SourceFile */); + } function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { @@ -27163,11 +27499,10 @@ var ts; }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); - // Initialize special symbols getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; @@ -27866,7 +28201,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 136 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); } } @@ -28225,11 +28560,15 @@ var ts; var writeTextOfNode; var writer = createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; - var currentSourceFile; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; var reportedDeclarationError = false; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare = !root; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; // Contains the reference paths that needs to go in the declaration file. @@ -28272,23 +28611,56 @@ var ts; else { // Emit references corresponding to this file var emittedReferencedFiles = []; + var prevModuleElementDeclarationEmitInfo = []; ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + if (!ts.isDeclarationFile(sourceFile)) { // Check what references need to be added if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - // If the reference file is a declaration file or an external module, emit that reference - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && + // If the reference file is a declaration file, emit that reference + if (referencedFile && (ts.isDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } }); } + } + if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; emitSourceFile(sourceFile); } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + // create asynchronous output for the importDeclarations + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 1); + increaseIndent(); + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + decreaseIndent(); + } + }); + setWriter(oldWriter); + } + prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } }); + moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); } return { reportedDeclarationError: reportedDeclarationError, @@ -28297,13 +28669,12 @@ var ts; referencePathsOutput: referencePathsOutput }; function hasInternalAnnotation(range) { - var text = currentSourceFile.text; - var comment = text.substring(range.pos, range.end); + var comment = currentText.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node) { if (node) { - var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -28395,7 +28766,7 @@ var ts; var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } else { diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); @@ -28461,10 +28832,10 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); + ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -28481,7 +28852,7 @@ var ts; case 103 /* VoidKeyword */: case 97 /* ThisKeyword */: case 9 /* StringLiteral */: - return writeTextOfNode(currentSourceFile, type); + return writeTextOfNode(currentText, type); case 188 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); case 151 /* TypeReference */: @@ -28512,14 +28883,14 @@ var ts; } function writeEntityName(entityName) { if (entityName.kind === 69 /* Identifier */) { - writeTextOfNode(currentSourceFile, entityName); + writeTextOfNode(currentText, entityName); } else { var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, right); + writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { @@ -28549,7 +28920,7 @@ var ts; } } function emitTypePredicate(type) { - writeTextOfNode(currentSourceFile, type.parameterName); + writeTextOfNode(currentText, type.parameterName); write(" is "); emitType(type.type); } @@ -28590,9 +28961,12 @@ var ts; } } function emitSourceFile(node) { - currentSourceFile = node; + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -28601,13 +28975,13 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) { + if (!ts.hasProperty(currentIdentifiers, baseName)) { return baseName; } var count = 0; while (true) { var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentSourceFile.identifiers, name_18)) { + if (!ts.hasProperty(currentIdentifiers, name_18)) { return name_18; } } @@ -28615,7 +28989,7 @@ var ts; function emitExportAssignment(node) { if (node.expression.kind === 69 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentSourceFile, node.expression); + writeTextOfNode(currentText, node.expression); } else { // Expression @@ -28653,7 +29027,7 @@ var ts; writeModuleElement(node); } else if (node.kind === 221 /* ImportEqualsDeclaration */ || - (node.parent.kind === 248 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + (node.parent.kind === 248 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible; if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot @@ -28707,7 +29081,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent === currentSourceFile) { + if (node.parent.kind === 248 /* SourceFile */) { // If the node is exported if (node.flags & 2 /* Export */) { write("export "); @@ -28715,7 +29089,7 @@ var ts; if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 215 /* InterfaceDeclaration */) { + else if (node.kind !== 215 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -28742,7 +29116,7 @@ var ts; write("export "); } write("import "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" = "); if (ts.isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); @@ -28750,7 +29124,7 @@ var ts; } else { write("require("); - writeTextOfNode(currentSourceFile, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -28785,7 +29159,7 @@ var ts; if (node.importClause) { var currentWriterPos = writer.getTextPos(); if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentSourceFile, node.importClause.name); + writeTextOfNode(currentText, node.importClause.name); } if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { if (currentWriterPos !== writer.getTextPos()) { @@ -28794,7 +29168,7 @@ var ts; } if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { write("* as "); - writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); + writeTextOfNode(currentText, node.importClause.namedBindings.name); } else { write("{ "); @@ -28804,16 +29178,28 @@ var ts; } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); write(";"); writer.writeLine(); } + function emitExternalModuleSpecifier(moduleSpecifier) { + if (moduleSpecifier.kind === 9 /* StringLiteral */ && (!root) && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + if (moduleName) { + write("\""); + write(moduleName); + write("\""); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } function emitImportOrExportSpecifier(node) { if (node.propertyName) { - writeTextOfNode(currentSourceFile, node.propertyName); + writeTextOfNode(currentText, node.propertyName); write(" as "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } function emitExportSpecifier(node) { emitImportOrExportSpecifier(node); @@ -28835,7 +29221,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); } write(";"); writer.writeLine(); @@ -28849,11 +29235,11 @@ var ts; else { write("module "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); while (node.body.kind !== 219 /* ModuleBlock */) { node = node.body; write("."); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; @@ -28872,7 +29258,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); @@ -28894,7 +29280,7 @@ var ts; write("const "); } write("enum "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" {"); writeLine(); increaseIndent(); @@ -28905,7 +29291,7 @@ var ts; } function emitEnumMemberDeclaration(node) { emitJsDocComments(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); @@ -28922,7 +29308,7 @@ var ts; increaseIndent(); emitJsDocComments(node); decreaseIndent(); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); @@ -29037,7 +29423,7 @@ var ts; write("abstract "); } write("class "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -29060,7 +29446,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("interface "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -29095,7 +29481,7 @@ var ts; // If this node is a computed name, it can only be a symbol, because we've already skipped // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If optional property emit ? if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); @@ -29177,7 +29563,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); } } @@ -29221,7 +29607,7 @@ var ts; emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (!(node.flags & 16 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); @@ -29307,13 +29693,13 @@ var ts; } if (node.kind === 213 /* FunctionDeclaration */) { write("function "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } else if (node.kind === 144 /* Constructor */) { write("constructor"); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (ts.hasQuestionToken(node)) { write("?"); } @@ -29437,7 +29823,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } if (resolver.isOptionalParameter(node)) { write("?"); @@ -29552,7 +29938,7 @@ var ts; // Example: // original: function foo({y: [a,b,c]}) {} // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; - writeTextOfNode(currentSourceFile, bindingElement.propertyName); + writeTextOfNode(currentText, bindingElement.propertyName); write(": "); } if (bindingElement.name) { @@ -29575,7 +29961,7 @@ var ts; if (bindingElement.dotDotDotToken) { write("..."); } - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); } } } @@ -29667,6 +30053,18 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || ts.isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; var Jump; (function (Jump) { Jump[Jump["Break"] = 2] = "Break"; @@ -29954,15 +30352,19 @@ var ts; var newLine = host.getNewLine(); var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; + var outFile = compilerOptions.outFile || compilerOptions.out; + var emitJavaScript = createFileEmitter(); if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); + if (outFile) { + emitFile(outFile); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); } } else { @@ -29971,8 +30373,8 @@ var ts; var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { + emitFile(outFile); } } // Sort and make the unique list of diagnostics @@ -30024,10 +30426,16 @@ var ts; } } } - function emitJavaScript(jsFilePath, root) { + function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var currentText; + var currentLineMap; + var currentFileIdentifiers; + var renamedDependencies; + var isEs6Module; + var isCurrentFileExternalModule; // name of an exporter function if file is a System external module // System.register([...], function () {...}) // exporting in System modules looks like: @@ -30035,15 +30443,15 @@ var ts; // => // var x;... exporter("x", x = 1) var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; + var generatedNameSet; + var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; var convertedLoopState; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; + var extendsEmitted; + var decorateEmitted; + var paramEmitted; + var awaiterEmitted; + var tempFlags; var tempVariables; var tempParameters; var externalImports; @@ -30075,6 +30483,8 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; + /** The root file passed to the emit function (if present) */ + var root; /** If removeComments is true, no leading-comments needed to be emitted **/ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; var moduleEmitDelegates = (_a = {}, @@ -30085,31 +30495,77 @@ var ts; _a[1 /* CommonJS */] = emitCommonJSModule, _a ); - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); + var bundleEmitDelegates = (_b = {}, + _b[5 /* ES6 */] = function () { }, + _b[2 /* AMD */] = emitAMDModule, + _b[4 /* System */] = emitSystemModule, + _b[3 /* UMD */] = function () { }, + _b[1 /* CommonJS */] = function () { }, + _b + ); + return doEmit; + function doEmit(jsFilePath, rootFile) { + // reset the state + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + generatedNameSet = {}; + nodeToGeneratedName = []; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + root = rootFile; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(jsFilePath, root); + } + if (root) { + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); + } + else { + if (modulekind) { + ts.forEach(host.getSourceFiles(), emitEmitHelpers); } - }); + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); } - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); - return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + currentText = sourceFile.text; + currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(sourceFile); emit(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(currentFileIdentifiers, name) && !ts.hasProperty(generatedNameSet, name); } // Return the next available name in the pattern _a ... _z, _0, _1, ... @@ -30192,7 +30648,7 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps() { + function initializeEmitterWithSourceMaps(jsFilePath, root) { var sourceMapDir; // The directory in which sourcemap will be // Current source map file and its index in the sources list var sourceMapSourceIndex = -1; @@ -30280,7 +30736,7 @@ var ts; } } function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); // Convert the location to be one-based. sourceLinePos.line++; sourceLinePos.character++; @@ -30314,13 +30770,13 @@ var ts; } function recordEmitNodeStartSpan(node) { // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); } function recordEmitNodeEndSpan(node) { recordSourceMapSpan(node.end); } function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + var tokenStartPos = ts.skipTrivia(currentText, startPos); recordSourceMapSpan(tokenStartPos); var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); @@ -30402,9 +30858,9 @@ var ts; sourceMapNameIndices.pop(); } ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); recordSourceMapSpan(comment.end); } function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { @@ -30434,7 +30890,7 @@ var ts; return output; } } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); @@ -30450,7 +30906,7 @@ var ts; sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); } // Initialize source map data var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); @@ -30522,7 +30978,7 @@ var ts; scopeEmitEnd = recordScopeNameEnd; writeComment = writeCommentRangeWithMap; } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } // Create a temporary variable with a unique unused name. @@ -30702,7 +31158,7 @@ var ts; // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + return ts.getTextOfNodeFromSourceText(currentText, node); } // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. @@ -30729,7 +31185,7 @@ var ts; // Find original source text, since we need to emit the raw strings of the tagged template. // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var text = ts.getTextOfNodeFromSourceText(currentText, node); // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), // thus we need to remove those characters. // First template piece starts with "`", others with "}" @@ -31146,7 +31602,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } write("\""); } @@ -31246,7 +31702,7 @@ var ts; // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); if (languageVersion === 0 /* ES3 */ && identifier === "default") { write("[\"default\"]"); } @@ -31270,7 +31726,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function isNameOfNestedRedeclaration(node) { @@ -31308,7 +31764,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function emitThis(node) { @@ -31712,7 +32168,7 @@ var ts; function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, // we emit a normal property assignment. For example: // module m { @@ -31722,7 +32178,7 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { + if (modulekind !== 5 /* ES6 */ || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -31779,11 +32235,11 @@ var ts; var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - var shouldEmitSpace; + var shouldEmitSpace = false; if (!indentedBeforeDot) { if (node.expression.kind === 8 /* NumericLiteral */) { // check if numeric literal was originally written with a dot - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; } else { @@ -32962,16 +33418,16 @@ var ts; emitToken(16 /* CloseBraceToken */, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 241 /* CaseClause */) { @@ -33077,7 +33533,7 @@ var ts; ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); // only allow export default at a source file level if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { - if (!currentSourceFile.symbol.exports["___esModule"]) { + if (!isEs6Module) { if (languageVersion === 1 /* ES5 */) { // default value of configurable, enumerable, writable are `false`. write("Object.defineProperty(exports, \"__esModule\", { value: true });"); @@ -33272,14 +33728,20 @@ var ts; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 69 /* Identifier */) { - return createElementAccessExpression(object, syntheticName); + var index; + var nameIsComputed = propName.kind === 136 /* ComputedPropertyName */; + if (nameIsComputed) { + index = ensureIdentifier(propName.expression, /* reuseIdentifierExpression */ false); } - return createPropertyAccessExpression(object, syntheticName); + else { + // We create a synthetic copy of the identifier in order to avoid the rewriting that might + // otherwise occur when the identifier is emitted. + index = ts.createSynthesizedNode(propName.kind); + index.text = propName.text; + } + return !nameIsComputed && index.kind === 69 /* Identifier */ + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { var call = ts.createSynthesizedNode(168 /* CallExpression */); @@ -33742,7 +34204,6 @@ var ts; var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); var isArrowFunction = node.kind === 174 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; - var args; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current // `this` and `arguments` objects to `__awaiter`. The generator function @@ -35197,8 +35658,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + if (renamedDependencies && ts.hasProperty(renamedDependencies, moduleName.text)) { + return "\"" + renamedDependencies[moduleName.text] + "\""; } return undefined; } @@ -35351,7 +35812,7 @@ var ts; // - current file is not external module // - import declaration is top level and target is value imported by entity name if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); // variable declaration for import-equals declaration can be hoisted in system modules @@ -35579,7 +36040,7 @@ var ts; function getLocalNameForExternalImport(node) { var namespaceDeclaration = getNamespaceDeclarationNode(node); if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); @@ -35884,7 +36345,7 @@ var ts; ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 /* System */ && ts.isExternalModule(currentSourceFile); + return modulekind === 4 /* System */ && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: @@ -36054,7 +36515,13 @@ var ts; writeLine(); write("}"); // execute } - function emitSystemModule(node) { + function writeModuleName(node, emitRelativePathAsModuleName) { + var moduleName = node.moduleName; + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { + write("\"" + moduleName + "\", "); + } + } + function emitSystemModule(node, emitRelativePathAsModuleName) { collectExternalModuleInfo(node); // System modules has the following shape // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) @@ -36069,9 +36536,7 @@ var ts; exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } + writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; @@ -36090,6 +36555,12 @@ var ts; if (i !== 0) { write(", "); } + if (emitRelativePathAsModuleName) { + var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); + if (name_29) { + text = "\"" + name_29 + "\""; + } + } write(text); } write("], function(" + exportFunctionForFile + ") {"); @@ -36103,7 +36574,7 @@ var ts; writeLine(); write("});"); } - function getAMDDependencyNames(node, includeNonAmdDependencies) { + function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { // names of modules with corresponding parameter in the factory function var aliasedModuleNames = []; // names of modules with no corresponding parameters in factory function @@ -36126,6 +36597,12 @@ var ts; var importNode = externalImports_4[_c]; // Find the name of the external module var externalModuleName = getExternalModuleNameText(importNode); + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + externalModuleName = "\"" + name_30 + "\""; + } + } // Find the name of the module alias, if there is one var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -36138,7 +36615,7 @@ var ts; } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - function emitAMDDependencies(node, includeNonAmdDependencies) { + function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // @@ -36150,7 +36627,7 @@ var ts; // To ensure this is true in cases of modules with no aliases, e.g.: // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -36177,15 +36654,13 @@ var ts; } write(") {"); } - function emitAMDModule(node) { + function emitAMDModule(node, emitRelativePathAsModuleName) { emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); @@ -36404,8 +36879,13 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; - emitModule(node); + if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + emitModule(node); + } + else { + bundleEmitDelegates[modulekind](node, /*emitRelativePathAsModuleName*/ true); + } } else { // emit prologue directives prior to __extends @@ -36666,7 +37146,7 @@ var ts; } function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -36683,10 +37163,10 @@ var ts; function isTripleSlashComment(comment) { // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + if (currentText.charCodeAt(comment.pos + 1) === 47 /* slash */ && comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + currentText.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentText.substring(comment.pos, comment.end); return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? true : false; @@ -36703,7 +37183,7 @@ var ts; } else { // get the leading comments from the node - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); } } } @@ -36712,7 +37192,7 @@ var ts; // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + return ts.getTrailingCommentRanges(currentText, node.end); } } } @@ -36746,9 +37226,9 @@ var ts; leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { @@ -36757,7 +37237,7 @@ var ts; // Emit the trailing comments only if the parent's end doesn't match var trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } /** * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: @@ -36768,9 +37248,9 @@ var ts; if (compilerOptions.removeComments) { return; } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + var trailingComments = ts.getTrailingCommentRanges(currentText, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitLeadingCommentsOfPositionWorker(pos) { if (compilerOptions.removeComments) { @@ -36783,14 +37263,14 @@ var ts; } else { // get the leading comments from the node - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + leadingComments = ts.getLeadingCommentRanges(currentText, pos); } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAndUpdateCommentsInfo(node) { - var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); if (currentDetachedCommentInfo) { if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -36801,12 +37281,12 @@ var ts; } } function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); + var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); } } - var _a; + var _a, _b; } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -36866,11 +37346,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -36880,8 +37360,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { - return ts.forEach(ts.moduleFileExtensions, tryLoad); + function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + return ts.forEach(extensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -36893,7 +37373,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -36906,7 +37386,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -36916,7 +37396,7 @@ var ts; // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -36926,11 +37406,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -36956,9 +37436,10 @@ var ts; var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { // resolve .tsx files only if jsx support is enabled // 'logical not' handles both undefined and None cases @@ -36989,10 +37470,8 @@ var ts; /* @internal */ ts.defaultInitCompilerOptions = { module: 1 /* CommonJS */, - target: 0 /* ES3 */, + target: 1 /* ES5 */, noImplicitAny: false, - outDir: "built", - rootDir: ".", sourceMap: false }; function createCompilerHost(options, setParentNodes) { @@ -37397,43 +37876,55 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, /* allowRelativeModuleNames */ true); + collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); } file.imports = imports || emptyArray; - function collect(node, allowRelativeModuleNames) { - switch (node.kind) { - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + return; + function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { + if (!collectOnlyRequireCalls) { + switch (node.kind) { + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { + case 218 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - collect(node, /* allowRelativeModuleNames */ false); - }); - } - break; + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + ts.forEachChild(node.body, function (node) { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); + }); + } + break; + } + } + if (isJavaScriptFile) { + if (ts.isRequireCall(node)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true); }); + } } } } @@ -37526,7 +38017,6 @@ var ts; // always process imported modules to record module name resolutions processImportedModules(file, basePath); if (isDefaultLib) { - file.isDefaultLib = true; files.unshift(file); } else { @@ -37604,6 +38094,9 @@ var ts; commonPathComponents.length = sourcePathComponents.length; } }); + if (!commonPathComponents) { + return currentDirectory; + } return ts.getNormalizedPathFromPathComponents(commonPathComponents); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { @@ -37689,12 +38182,15 @@ var ts; if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } + // Cannot specify module gen that isn't amd or system with --out + if (outFile && options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted if (options.outDir || options.sourceRoot || - (options.mapRoot && - (!outFile || firstExternalModuleSourceFile !== undefined))) { + options.mapRoot) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -38212,20 +38708,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_29 = sysFiles[i]; - if (ts.fileExtensionIs(name_29, ".d.ts")) { - var baseName = name_29.substr(0, name_29.length - ".d.ts".length); + var name_31 = sysFiles[i]; + if (ts.fileExtensionIs(name_31, ".d.ts")) { + var baseName = name_31.substr(0, name_31.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_29); + fileNames.push(name_31); } } - else if (ts.fileExtensionIs(name_29, ".ts")) { - if (!ts.contains(sysFiles, name_29 + "x")) { - fileNames.push(name_29); + else if (ts.fileExtensionIs(name_31, ".ts")) { + if (!ts.contains(sysFiles, name_31 + "x")) { + fileNames.push(name_31); } } else { - fileNames.push(name_29); + fileNames.push(name_31); } } } @@ -38453,12 +38949,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_30 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_30); + for (var name_32 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_32); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_30); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); if (!matches) { continue; } @@ -38471,14 +38967,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_30); + matches = patternMatcher.getMatches(containers, name_32); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_30, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -38859,9 +39355,9 @@ var ts; case 211 /* VariableDeclaration */: case 163 /* BindingElement */: var variableDeclarationNode; - var name_31; + var name_33; if (node.kind === 163 /* BindingElement */) { - name_31 = node.name; + name_33 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -38873,16 +39369,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_31 = node.name; + name_33 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); } case 144 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -39802,7 +40298,7 @@ var ts; if (!candidates.length) { // We didn't have any sig help items produced by the TS compiler. If this is a JS // file, then see if we can figure out anything better. - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; @@ -41662,9 +42158,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_32 in o) { - if (o[name_32] === rule) { - return name_32; + for (var name_34 in o) { + if (o[name_34] === rule) { + return name_34; } } throw new Error("Unknown rule"); @@ -42096,7 +42592,7 @@ var ts; function TokenRangeAccess(from, to, except) { this.tokens = []; for (var token = from; token <= to; token++) { - if (except.indexOf(token) < 0) { + if (ts.indexOf(except, token) < 0) { this.tokens.push(token); } } @@ -43709,13 +44205,18 @@ var ts; ]; var jsDocCompletionEntries; function createNode(kind, pos, end, flags, parent) { - var node = new (ts.getNodeConstructor(kind))(pos, end); + var node = new NodeObject(kind, pos, end); node.flags = flags; node.parent = parent; return node; } var NodeObject = (function () { - function NodeObject() { + function NodeObject(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0 /* None */; + this.parent = undefined; } NodeObject.prototype.getSourceFile = function () { return ts.getSourceFileOfNode(this); @@ -44198,8 +44699,8 @@ var ts; })(); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); - function SourceFileObject() { - _super.apply(this, arguments); + function SourceFileObject(kind, pos, end) { + _super.call(this, kind, pos, end); } SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); @@ -44521,6 +45022,9 @@ var ts; ClassificationTypeNames.typeAliasName = "type alias name"; ClassificationTypeNames.parameterName = "parameter name"; ClassificationTypeNames.docCommentTagName = "doc comment tag name"; + ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; + ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; + ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; @@ -44543,6 +45047,9 @@ var ts; ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; })(ts.ClassificationType || (ts.ClassificationType = {})); var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { @@ -44922,8 +45429,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -44957,9 +45465,207 @@ var ts; end: pos + importPath.length }); } - function processImport() { + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122 /* DeclareKeyword */) { + // declare module "mod" + token = scanner.scan(); + if (token === 125 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + else if (token === 24 /* CommaToken */) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + return true; + } + } + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 116 /* AsKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82 /* ExportKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17 /* OpenParenToken */) { + return true; + } + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // looks like define ("modname", ... - skip string literal and comma + token = scanner.scan(); + if (token === 24 /* CommaToken */) { + token = scanner.scan(); + } + else { + // unexpected token + return true; + } + } + // should be start of dependency list + if (token !== 19 /* OpenBracketToken */) { + return true; + } + // skip open bracket + token = scanner.scan(); + var i = 0; + // scan until ']' or EOF + while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + // record string literals as module names + if (token === 9 /* StringLiteral */) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { scanner.setText(sourceText); - var token = scanner.scan(); + scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -44971,152 +45677,26 @@ var ts; // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") - while (token !== 1 /* EndOfFileToken */) { - if (token === 122 /* DeclareKeyword */) { - // declare module "mod" - token = scanner.scan(); - if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - recordAmbientExternalModule(); - continue; - } - } + // (for JavaScript files) require("mod") + while (true) { + if (scanner.getToken() === 1 /* EndOfFileToken */) { + break; } - else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import "mod"; - recordModuleName(); - continue; - } - else { - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import d from "mod"; - recordModuleName(); - continue; - } - } - else if (token === 56 /* EqualsToken */) { - token = scanner.scan(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import i = require("mod"); - recordModuleName(); - continue; - } - } - } - } - else if (token === 24 /* CommaToken */) { - // consume comma and keep going - token = scanner.scan(); - } - else { - // unknown syntax - continue; - } - } - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 116 /* AsKeyword */) { - token = scanner.scan(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + continue; } - else if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 56 /* EqualsToken */) { - token = scanner.scan(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export import i = require("mod"); - recordModuleName(); - } - } - } - } - } - } + else { + scanner.scan(); } - token = scanner.scan(); } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -45547,7 +46127,7 @@ var ts; // For JavaScript files, we don't want to report the normal typescript semantic errors. // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. @@ -45759,7 +46339,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -46393,8 +46973,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_33 = element.propertyName || element.name; - exisingImportsOrExports[name_33.text] = true; + var name_35 = element.propertyName || element.name; + exisingImportsOrExports[name_35.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -46426,7 +47006,10 @@ var ts; } var existingName = void 0; if (m.kind === 163 /* BindingElement */ && m.propertyName) { - existingName = m.propertyName.text; + // include only identifiers in completion list + if (m.propertyName.kind === 69 /* Identifier */) { + existingName = m.propertyName.text; + } } else { // TODO(jfreeman): Account for computed property name @@ -46466,46 +47049,43 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_34 in nameTable) { - if (!allNames[name_34]) { - allNames[name_34] = name_34; - var displayName = getCompletionEntryDisplayName(name_34, target, /*performCharacterChecks:*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_36 in nameTable) { + if (!uniqueNames[name_36]) { + uniqueNames[name_36] = name_36; + var displayName = getCompletionEntryDisplayName(name_36, target, /*performCharacterChecks:*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -46543,25 +47123,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -46762,16 +47341,16 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(54 /* ColonToken */)); + displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); displayParts.push(ts.spacePart()); } - if (!(type.flags & 65536 /* Anonymous */)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); + if (!(type.flags & ts.TypeFlags.Anonymous)) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); } - addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); + addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); break; default: // Just signature @@ -48396,19 +48975,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_35 = node.text; + var name_37 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_35); + var unionProperty = contextualType.getProperty(name_37); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_35); + var symbol = t.getProperty(name_37); if (symbol) { result_4.push(symbol); } @@ -48417,7 +48996,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_35); + var symbol_1 = contextualType.getProperty(name_37); if (symbol_1) { return [symbol_1]; } @@ -48828,6 +49407,9 @@ var ts; case 16 /* typeAliasName */: return ClassificationTypeNames.typeAliasName; case 17 /* parameterName */: return ClassificationTypeNames.parameterName; case 18 /* docCommentTagName */: return ClassificationTypeNames.docCommentTagName; + case 19 /* jsxOpenTagName */: return ClassificationTypeNames.jsxOpenTagName; + case 20 /* jsxCloseTagName */: return ClassificationTypeNames.jsxCloseTagName; + case 21 /* jsxSelfClosingTagName */: return ClassificationTypeNames.jsxSelfClosingTagName; } } function convertClassifications(classifications) { @@ -49097,6 +49679,21 @@ var ts; return 17 /* parameterName */; } return; + case 235 /* JsxOpeningElement */: + if (token.parent.tagName === token) { + return 19 /* jsxOpenTagName */; + } + return; + case 237 /* JsxClosingElement */: + if (token.parent.tagName === token) { + return 20 /* jsxCloseTagName */; + } + return; + case 234 /* JsxSelfClosingElement */: + if (token.parent.tagName === token) { + return 21 /* jsxSelfClosingTagName */; + } + return; } } return 2 /* identifier */; @@ -50021,18 +50618,8 @@ var ts; ts.getDefaultLibFilePath = getDefaultLibFilePath; function initializeServices() { ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0 /* None */; - this.parent = undefined; - } - var proto = kind === 248 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); - proto.kind = kind; - Node.prototype = proto; - return Node; - }, + getNodeConstructor: function () { return NodeObject; }, + getSourceFileConstructor: function () { return SourceFileObject; }, getSymbolConstructor: function () { return SymbolObject; }, getTypeConstructor: function () { return TypeObject; }, getSignatureConstructor: function () { return SignatureObject; } @@ -51102,7 +51689,8 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + // for now treat files as JavaScript + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); var convertResult = { referencedFiles: [], importedFiles: [], @@ -51166,7 +51754,7 @@ var ts; TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { try { if (this.documentRegistry === undefined) { - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var hostAdapter = new LanguageServiceShimHostAdapter(host); var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); @@ -51199,7 +51787,7 @@ var ts; TypeScriptServicesFactory.prototype.close = function () { // Forget all the registered shims this._shims = []; - this.documentRegistry = ts.createDocumentRegistry(); + this.documentRegistry = undefined; }; TypeScriptServicesFactory.prototype.registerShim = function (shim) { this._shims.push(shim); diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index d2758e6d5e9..af9a8bffe35 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -387,6 +387,7 @@ declare namespace ts { right: Identifier; } type EntityName = Identifier | QualifiedName; + type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; @@ -425,7 +426,7 @@ declare namespace ts { initializer?: Expression; } interface BindingElement extends Declaration { - propertyName?: Identifier; + propertyName?: PropertyName; dotDotDotToken?: Node; name: Identifier | BindingPattern; initializer?: Expression; @@ -452,7 +453,7 @@ declare namespace ts { objectAssignmentInitializer?: Expression; } interface VariableLikeDeclaration extends Declaration { - propertyName?: Identifier; + propertyName?: PropertyName; dotDotDotToken?: Node; name: DeclarationName; questionToken?: Node; @@ -581,7 +582,7 @@ declare namespace ts { asteriskToken?: Node; expression?: Expression; } - interface BinaryExpression extends Expression { + interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -625,7 +626,7 @@ declare namespace ts { interface ObjectLiteralExpression extends PrimaryExpression, Declaration { properties: NodeArray; } - interface PropertyAccessExpression extends MemberExpression { + interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; dotToken: Node; name: Identifier; @@ -1220,6 +1221,7 @@ declare namespace ts { ObjectLiteral = 524288, ESSymbol = 16777216, ThisType = 33554432, + ObjectLiteralPatternWithComputedProperties = 67108864, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1537,7 +1539,6 @@ declare namespace ts { function getTypeParameterOwner(d: Declaration): Declaration; } declare namespace ts { - function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node; function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; @@ -2126,6 +2127,9 @@ declare namespace ts { static typeAliasName: string; static parameterName: string; static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; } enum ClassificationType { comment = 1, @@ -2146,6 +2150,9 @@ declare namespace ts { typeAliasName = 16, parameterName = 17, docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; @@ -2171,7 +2178,7 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; /** diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 8b0ef04f96e..498ddc37860 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -622,6 +622,7 @@ var ts; TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; + TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ @@ -1530,12 +1531,7 @@ var ts; * List of supported extensions in order of file resolution precedence. */ ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - /** - * List of extensions that will be used to look for external modules. - * This list is kept separate from supportedExtensions to for cases when we'll allow to include .js files in compilation, - * but still would like to load only TypeScript files as modules - */ - ts.moduleFileExtensions = ts.supportedExtensions; + ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); function isSupportedSourceFileName(fileName) { if (!fileName) { return false; @@ -1586,17 +1582,16 @@ var ts; } function Signature(checker) { } + function Node(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0 /* None */; + this.parent = undefined; + } ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0 /* None */; - this.parent = undefined; - } - Node.prototype = { kind: kind }; - return Node; - }, + getNodeConstructor: function () { return Node; }, + getSourceFileConstructor: function () { return Node; }, getSymbolConstructor: function () { return Symbol; }, getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } @@ -1913,7 +1908,16 @@ var ts; if (writeByteOrderMark) { data = "\uFEFF" + data; } - _fs.writeFileSync(fileName, data, "utf8"); + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync(fd, data, undefined, "utf8"); + } + finally { + if (fd !== undefined) { + _fs.closeSync(fd); + } + } } function getCanonicalPath(path) { return useCaseSensitiveFileNames ? path.toLowerCase() : path; @@ -2614,6 +2618,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, + Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3173,7 +3178,7 @@ var ts; function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; - while (true) { + while (pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: @@ -3242,6 +3247,7 @@ var ts; } return result; } + return result; } function getLeadingCommentRanges(text, pos) { return getCommentRanges(text, pos, /*trailing*/ false); @@ -3343,7 +3349,7 @@ var ts; error(ts.Diagnostics.Digit_expected); } } - return +(text.substring(start, end)); + return "" + +(text.substring(start, end)); } function scanOctalDigits() { var start = pos; @@ -3770,7 +3776,7 @@ var ts; return pos++, token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { @@ -3873,7 +3879,7 @@ var ts; case 55 /* _7 */: case 56 /* _8 */: case 57 /* _9 */: - tokenValue = "" + scanNumber(); + tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: return pos++, token = 54 /* ColonToken */; @@ -4177,1321 +4183,6 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); -/// -/* @internal */ -var ts; -(function (ts) { - ts.bindTime = 0; - (function (ModuleInstanceState) { - ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; - ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; - ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; - })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); - var ModuleInstanceState = ts.ModuleInstanceState; - var Reachability; - (function (Reachability) { - Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; - Reachability[Reachability["Reachable"] = 2] = "Reachable"; - Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; - Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; - })(Reachability || (Reachability = {})); - function or(state1, state2) { - return (state1 | state2) & 2 /* Reachable */ - ? 2 /* Reachable */ - : (state1 & state2) & 8 /* ReportedUnreachable */ - ? 8 /* ReportedUnreachable */ - : 4 /* Unreachable */; - } - function getModuleInstanceState(node) { - // A module is uninstantiated if it contains only - // 1. interface declarations, type alias declarations - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { - return 0 /* NonInstantiated */; - } - else if (ts.isConstEnumDeclaration(node)) { - return 2 /* ConstEnumOnly */; - } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { - return 0 /* NonInstantiated */; - } - else if (node.kind === 219 /* ModuleBlock */) { - var state = 0 /* NonInstantiated */; - ts.forEachChild(node, function (n) { - switch (getModuleInstanceState(n)) { - case 0 /* NonInstantiated */: - // child is non-instantiated - continue searching - return false; - case 2 /* ConstEnumOnly */: - // child is const enum only - record state and continue searching - state = 2 /* ConstEnumOnly */; - return false; - case 1 /* Instantiated */: - // child is instantiated - record state and stop - state = 1 /* Instantiated */; - return true; - } - }); - return state; - } - else if (node.kind === 218 /* ModuleDeclaration */) { - return getModuleInstanceState(node.body); - } - else { - return 1 /* Instantiated */; - } - } - ts.getModuleInstanceState = getModuleInstanceState; - var ContainerFlags; - (function (ContainerFlags) { - // The current node is not a container, and no container manipulation should happen before - // recursing into it. - ContainerFlags[ContainerFlags["None"] = 0] = "None"; - // The current node is a container. It should be set as the current container (and block- - // container) before recursing into it. The current node does not have locals. Examples: - // - // Classes, ObjectLiterals, TypeLiterals, Interfaces... - ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; - // The current node is a block-scoped-container. It should be set as the current block- - // container before recursing into it. Examples: - // - // Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements... - ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; - ContainerFlags[ContainerFlags["HasLocals"] = 4] = "HasLocals"; - // If the current node is a container that also container that also contains locals. Examples: - // - // Functions, Methods, Modules, Source-files. - ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; - })(ContainerFlags || (ContainerFlags = {})); - var binder = createBinder(); - function bindSourceFile(file, options) { - var start = new Date().getTime(); - binder(file, options); - ts.bindTime += new Date().getTime() - start; - } - ts.bindSourceFile = bindSourceFile; - function createBinder() { - var file; - var options; - var parent; - var container; - var blockScopeContainer; - var lastContainer; - var seenThisKeyword; - // state used by reachability checks - var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; - // If this file is an external module, then it is automatically in strict-mode according to - // ES6. If it is not an external module, then we'll determine if it is in strict mode or - // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). - var inStrictMode; - var symbolCount = 0; - var Symbol; - var classifiableNames; - function bindSourceFile(f, opts) { - file = f; - options = opts; - inStrictMode = !!file.externalModuleIndicator; - classifiableNames = {}; - Symbol = ts.objectAllocator.getSymbolConstructor(); - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; - } - parent = undefined; - container = undefined; - blockScopeContainer = undefined; - lastContainer = undefined; - seenThisKeyword = false; - hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; - } - return bindSourceFile; - function createSymbol(flags, name) { - symbolCount++; - return new Symbol(flags, name); - } - function addDeclarationToSymbol(symbol, node, symbolFlags) { - symbol.flags |= symbolFlags; - node.symbol = symbol; - if (!symbol.declarations) { - symbol.declarations = []; - } - symbol.declarations.push(node); - if (symbolFlags & 1952 /* HasExports */ && !symbol.exports) { - symbol.exports = {}; - } - if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { - symbol.members = {}; - } - if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; - } - } - // Should not be called on a declaration with a computed property name, - // unless it is a well known Symbol. - function getDeclarationName(node) { - if (node.name) { - if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { - return "\"" + node.name.text + "\""; - } - if (node.name.kind === 136 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); - return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); - } - return node.name.text; - } - switch (node.kind) { - case 144 /* Constructor */: - return "__constructor"; - case 152 /* FunctionType */: - case 147 /* CallSignature */: - return "__call"; - case 153 /* ConstructorType */: - case 148 /* ConstructSignature */: - return "__new"; - case 149 /* IndexSignature */: - return "__index"; - case 228 /* ExportDeclaration */: - return "__export"; - case 227 /* ExportAssignment */: - return node.isExportEquals ? "export=" : "default"; - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: - return node.flags & 512 /* Default */ ? "default" : undefined; - } - } - function getDisplayName(node) { - return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); - } - /** - * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. - * @param symbolTable - The symbol table which node will be added to. - * @param parent - node's parent declaration. - * @param node - The declaration to be added to the symbol table - * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) - * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. - */ - function declareSymbol(symbolTable, parent, node, includes, excludes) { - ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 512 /* Default */; - // The exported symbol for an export default function/class node is always named "default" - var name = isDefaultExport && parent ? "default" : getDeclarationName(node); - var symbol; - if (name !== undefined) { - // Check and see if the symbol table already has a symbol with this name. If not, - // create a new symbol with this name and add it to the table. Note that we don't - // give the new symbol any flags *yet*. This ensures that it will not conflict - // with the 'excludes' flags we pass in. - // - // If we do get an existing symbol, see if it conflicts with the new symbol we're - // creating. For example, a 'var' symbol and a 'class' symbol will conflict within - // the same symbol table. If we have a conflict, report the issue on each - // declaration we have for this symbol, and then create a new symbol for this - // declaration. - // - // If we created a new symbol, either because we didn't have a symbol with this name - // in the symbol table, or we conflicted with an existing symbol, then just add this - // node as the sole declaration of the new symbol. - // - // Otherwise, we'll be merging into a compatible existing symbol (for example when - // you have multiple 'vars' with the same name in the same container). In this case - // just add this node into the declarations list of the symbol. - symbol = ts.hasProperty(symbolTable, name) - ? symbolTable[name] - : (symbolTable[name] = createSymbol(0 /* None */, name)); - if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; - } - if (symbol.flags & excludes) { - if (node.name) { - node.name.parent = node; - } - // Report errors every position with duplicate declaration - // Report errors on previous encountered declarations - var message = symbol.flags & 2 /* BlockScopedVariable */ - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; - ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 512 /* Default */) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; - } - }); - ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); - }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0 /* None */, name); - } - } - else { - symbol = createSymbol(0 /* None */, "__missing"); - } - addDeclarationToSymbol(symbol, node, includes); - symbol.parent = parent; - return symbol; - } - function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; - if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - else { - // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, - // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set - // on it. There are 2 main reasons: - // - // 1. We treat locals and exports of the same name as mutually exclusive within a container. - // That means the binder will issue a Duplicate Identifier error if you mix locals and exports - // with the same name in the same container. - // TODO: Make this a more specific error and decouple it from the exclusion logic. - // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, - // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way - // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 131072 /* ExportContext */) { - var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | - (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | - (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); - local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - node.localSymbol = local; - return local; - } - else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - } - // All container nodes are kept on a linked list in declaration order. This list is used by - // the getLocalNameOfContainer function in the type checker to validate that the local name - // used for a container is unique. - function bindChildren(node) { - // Before we recurse into a node's chilren, we first save the existing parent, container - // and block-container. Then after we pop out of processing the children, we restore - // these saved values. - var saveParent = parent; - var saveContainer = container; - var savedBlockScopeContainer = blockScopeContainer; - // This node will now be set as the parent of all of its children as we recurse into them. - parent = node; - // Depending on what kind of node this is, we may have to adjust the current container - // and block-container. If the current node is a container, then it is automatically - // considered the current block-container as well. Also, for containers that we know - // may contain locals, we proactively initialize the .locals field. We do this because - // it's highly likely that the .locals will be needed to place some child in (for example, - // a parameter, or variable declaration). - // - // However, we do not proactively create the .locals for block-containers because it's - // totally normal and common for block-containers to never actually have a block-scoped - // variable in them. We don't want to end up allocating an object for every 'block' we - // run into when most of them won't be necessary. - // - // Finally, if this is a block-container, then we clear out any existing .locals object - // it may contain within it. This happens in incremental scenarios. Because we can be - // reusing a node from a previous compilation, that node may have had 'locals' created - // for it. We must clear this so we don't accidently move any stale data forward from - // a previous compilation. - var containerFlags = getContainerFlags(node); - if (containerFlags & 1 /* IsContainer */) { - container = blockScopeContainer = node; - if (containerFlags & 4 /* HasLocals */) { - container.locals = {}; - } - addToContainerChain(container); - } - else if (containerFlags & 2 /* IsBlockScopedContainer */) { - blockScopeContainer = node; - blockScopeContainer.locals = undefined; - } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; - var savedHasExplicitReturn; - var kind = node.kind; - var flags = node.flags; - // reset all reachability check related flags on node (for incremental scenarios) - flags &= ~1572864 /* ReachabilityCheckFlags */; - if (kind === 215 /* InterfaceDeclaration */) { - seenThisKeyword = false; - } - var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); - if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; - savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2 /* Reachable */; - hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; - } - bindReachableStatement(node); - if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288 /* HasImplicitReturn */; - if (hasExplicitReturn) { - flags |= 1048576 /* HasExplicitReturn */; - } - } - if (kind === 215 /* InterfaceDeclaration */) { - flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; - } - node.flags = flags; - if (saveState) { - hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; - } - container = saveContainer; - parent = saveParent; - blockScopeContainer = savedBlockScopeContainer; - } - /** - * Returns true if node and its subnodes were successfully traversed. - * Returning false means that node was not examined and caller needs to dive into the node himself. - */ - function bindReachableStatement(node) { - if (checkUnreachable(node)) { - ts.forEachChild(node, bind); - return; - } - switch (node.kind) { - case 198 /* WhileStatement */: - bindWhileStatement(node); - break; - case 197 /* DoStatement */: - bindDoStatement(node); - break; - case 199 /* ForStatement */: - bindForStatement(node); - break; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - bindForInOrForOfStatement(node); - break; - case 196 /* IfStatement */: - bindIfStatement(node); - break; - case 204 /* ReturnStatement */: - case 208 /* ThrowStatement */: - bindReturnOrThrow(node); - break; - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - bindBreakOrContinueStatement(node); - break; - case 209 /* TryStatement */: - bindTryStatement(node); - break; - case 206 /* SwitchStatement */: - bindSwitchStatement(node); - break; - case 220 /* CaseBlock */: - bindCaseBlock(node); - break; - case 207 /* LabeledStatement */: - bindLabeledStatement(node); - break; - default: - ts.forEachChild(node, bind); - break; - } - } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // bind expressions (don't affect reachability) - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); - } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; - popImplicitLabel(postDoLabel, postDoState); - // bind expressions (don't affect reachability) - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - // for statement is considered infinite when it condition is either omitted or is true keyword - // - for(..;;..) - // - for(..;true;..) - var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); - var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - // denotes reachability state when entering 'thenStatement' part of the if statement: - // i.e. if condition is false then thenStatement is unreachable - var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // denotes reachability state when entering 'elseStatement': - // i.e. if condition is true then elseStatement is unreachable - var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - currentReachabilityState = ifTrueState; - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); - } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); - } - } - function bindReturnOrThrow(n) { - // bind expression (don't affect reachability) - bind(n.expression); - if (n.kind === 204 /* ReturnStatement */) { - hasExplicitReturn = true; - } - currentReachabilityState = 4 /* Unreachable */; - } - function bindBreakOrContinueStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); - if (isValidJump) { - currentReachabilityState = 4 /* Unreachable */; - } - } - function bindTryStatement(n) { - // catch\finally blocks has the same reachability as try block - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - // post catch/finally state is reachable if - // - post try state is reachable - control flow can fall out of try block - // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); - } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); - // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case - var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); - } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); - } - } - } - function bindLabeledStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); - } - } - function getContainerFlags(node) { - switch (node.kind) { - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - return 1 /* IsContainer */; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 218 /* ModuleDeclaration */: - case 248 /* SourceFile */: - case 216 /* TypeAliasDeclaration */: - return 5 /* IsContainerWithLocals */; - case 244 /* CatchClause */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 220 /* CaseBlock */: - return 2 /* IsBlockScopedContainer */; - case 192 /* Block */: - // do not treat blocks directly inside a function as a block-scoped-container. - // Locals that reside in this block should go to the function locals. Othewise 'x' - // would not appear to be a redeclaration of a block scoped local in the following - // example: - // - // function foo() { - // var x; - // let x; - // } - // - // If we placed 'var x' into the function locals and 'let x' into the locals of - // the block, then there would be no collision. - // - // By not creating a new block-scoped-container here, we ensure that both 'var x' - // and 'let x' go into the Function-container's locals, and we do get a collision - // conflict. - return ts.isFunctionLike(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */; - } - return 0 /* None */; - } - function addToContainerChain(next) { - if (lastContainer) { - lastContainer.nextContainer = next; - } - lastContainer = next; - } - function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { - // Just call this directly so that the return type of this function stays "void". - declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); - } - function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { - switch (container.kind) { - // Modules, source files, and classes need specialized handling for how their - // members are declared (for example, a member of a class will go into a specific - // symbol table depending on if it is static or not). We defer to specialized - // handlers to take care of declaring these child members. - case 218 /* ModuleDeclaration */: - return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248 /* SourceFile */: - return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - return declareClassMember(node, symbolFlags, symbolExcludes); - case 217 /* EnumDeclaration */: - return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - case 215 /* InterfaceDeclaration */: - // Interface/Object-types always have their children added to the 'members' of - // their container. They are only accessible through an instance of their - // container, and are never in scope otherwise (even inside the body of the - // object / type / interface declaring them). An exception is type parameters, - // which are in scope without qualification (similar to 'locals'). - return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 216 /* TypeAliasDeclaration */: - // All the children of these container types are never visible through another - // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, - // they're only accessed 'lexically' (i.e. from code that exists underneath - // their container in the tree. To accomplish this, we simply add their declared - // symbol to the 'locals' of the container. These symbols can then be found as - // the type checker walks up the containers, checking them for matching names. - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 /* Static */ - ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) - : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - } - function declareSourceFileMember(node, symbolFlags, symbolExcludes) { - return ts.isExternalModule(file) - ? declareModuleMember(node, symbolFlags, symbolExcludes) - : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); - } - function hasExportDeclarations(node) { - var body = node.kind === 248 /* SourceFile */ ? node : node.body; - if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { - var stat = _a[_i]; - if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { - return true; - } - } - } - return false; - } - function setExportContextFlag(node) { - // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular - // declarations with export modifiers) is an export context in which declarations are implicitly exported. - if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072 /* ExportContext */; - } - else { - node.flags &= ~131072 /* ExportContext */; - } - } - function bindModuleDeclaration(node) { - setExportContextFlag(node); - if (node.name.kind === 9 /* StringLiteral */) { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - } - else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { - // if module was already merged with some function, class or non-const enum - // treat is a non-const-enum-only - node.symbol.constEnumOnlyModule = false; - } - else { - var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; - if (node.symbol.constEnumOnlyModule === undefined) { - // non-merged case - use the current state - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; - } - else { - // merged case: module is const enum only if all its pieces are non-instantiated or const enum - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; - } - } - } - } - } - function bindFunctionOrConstructorType(node) { - // For a given function symbol "<...>(...) => T" we want to generate a symbol identical - // to the one we would get for: { <...>(...): T } - // - // We do that by making an anonymous type literal symbol, and then setting the function - // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable - // from an actual type literal symbol you would have gotten had you used the long form. - var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node)); - addDeclarationToSymbol(symbol, node, 131072 /* Signature */); - var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); - addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); - typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); - var _a; - } - function bindObjectLiteralExpression(node) { - var ElementKind; - (function (ElementKind) { - ElementKind[ElementKind["Property"] = 1] = "Property"; - ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; - })(ElementKind || (ElementKind = {})); - if (inStrictMode) { - var seen = {}; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - if (prop.name.kind !== 69 /* Identifier */) { - continue; - } - var identifier = prop.name; - // ECMA-262 11.1.5 Object Initialiser - // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true - // a.This production is contained in strict code and IsDataDescriptor(previous) is true and - // IsDataDescriptor(propId.descriptor) is true. - // b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true. - // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. - // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true - // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ - ? 1 /* Property */ - : 2 /* Accessor */; - var existingKind = seen[identifier.text]; - if (!existingKind) { - seen[identifier.text] = currentKind; - continue; - } - if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { - var span = ts.getErrorSpanForNode(file, identifier); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); - } - } - } - return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); - } - function bindAnonymousDeclaration(node, symbolFlags, name) { - var symbol = createSymbol(symbolFlags, name); - addDeclarationToSymbol(symbol, node, symbolFlags); - } - function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { - switch (blockScopeContainer.kind) { - case 218 /* ModuleDeclaration */: - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - case 248 /* SourceFile */: - if (ts.isExternalModule(container)) { - declareModuleMember(node, symbolFlags, symbolExcludes); - break; - } - // fall through. - default: - if (!blockScopeContainer.locals) { - blockScopeContainer.locals = {}; - addToContainerChain(blockScopeContainer); - } - declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); - } - } - function bindBlockScopedVariableDeclaration(node) { - bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); - } - // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized - // check for reserved words used as identifiers in strict mode code. - function checkStrictModeIdentifier(node) { - if (inStrictMode && - node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && - !ts.isIdentifierName(node)) { - // Report error only if there are no parse errors in file - if (!file.parseDiagnostics.length) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); - } - } - } - function getStrictModeIdentifierMessage(node) { - // Provide specialized messages to help the user understand why we think they're in - // strict mode. - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; - } - function checkStrictModeBinaryExpression(node) { - if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { - // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) - checkStrictModeEvalOrArguments(node, node.left); - } - } - function checkStrictModeCatchClause(node) { - // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the - // Catch production is eval or arguments - if (inStrictMode && node.variableDeclaration) { - checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); - } - } - function checkStrictModeDeleteExpression(node) { - // Grammar checking - if (inStrictMode && node.expression.kind === 69 /* Identifier */) { - // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its - // UnaryExpression is a direct reference to a variable, function argument, or function name - var span = ts.getErrorSpanForNode(file, node.expression); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); - } - } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 /* Identifier */ && - (node.text === "eval" || node.text === "arguments"); - } - function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 69 /* Identifier */) { - var identifier = name; - if (isEvalOrArgumentsIdentifier(identifier)) { - // We check first if the name is inside class declaration or class expression; if so give explicit message - // otherwise report generic error message. - var span = ts.getErrorSpanForNode(file, name); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); - } - } - } - function getStrictModeEvalOrArgumentsMessage(node) { - // Provide specialized messages to help the user understand why we think they're in - // strict mode. - if (ts.getContainingClass(node)) { - return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; - } - if (file.externalModuleIndicator) { - return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; - } - return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; - } - function checkStrictModeFunctionName(node) { - if (inStrictMode) { - // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) - checkStrictModeEvalOrArguments(node, node.name); - } - } - function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); - } - } - function checkStrictModePostfixUnaryExpression(node) { - // Grammar checking - // The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression - // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - function checkStrictModePrefixUnaryExpression(node) { - // Grammar checking - if (inStrictMode) { - if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { - checkStrictModeEvalOrArguments(node, node.operand); - } - } - } - function checkStrictModeWithStatement(node) { - // Grammar checking for withStatement - if (inStrictMode) { - errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); - } - } - function errorOnFirstToken(node, message, arg0, arg1, arg2) { - var span = ts.getSpanOfTokenAtPosition(file, node.pos); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); - } - function getDestructuringParameterName(node) { - return "__" + ts.indexOf(node.parent.parameters, node); - } - function bind(node) { - if (!node) { - return; - } - node.parent = parent; - var savedInStrictMode = inStrictMode; - if (!savedInStrictMode) { - updateStrictMode(node); - } - // First we bind declaration nodes to a symbol if possible. We'll both create a symbol - // and then potentially add the symbol to an appropriate symbol table. Possible - // destination symbol tables are: - // - // 1) The 'exports' table of the current container's symbol. - // 2) The 'members' table of the current container's symbol. - // 3) The 'locals' table of the current container. - // - // However, not all symbols will end up in any of these tables. 'Anonymous' symbols - // (like TypeLiterals for example) will not be put in any table. - bindWorker(node); - // Then we recurse into the children of the node to bind them as well. For certain - // symbols we do specialized work when we recurse. For example, we'll keep track of - // the current 'container' node when it changes. This helps us know which symbol table - // a local should go into for example. - bindChildren(node); - inStrictMode = savedInStrictMode; - } - function updateStrictMode(node) { - switch (node.kind) { - case 248 /* SourceFile */: - case 219 /* ModuleBlock */: - updateStrictModeStatementList(node.statements); - return; - case 192 /* Block */: - if (ts.isFunctionLike(node.parent)) { - updateStrictModeStatementList(node.statements); - } - return; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - // All classes are automatically in strict mode in ES6. - inStrictMode = true; - return; - } - } - function updateStrictModeStatementList(statements) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; - if (!ts.isPrologueDirective(statement)) { - return; - } - if (isUseStrictPrologueDirective(statement)) { - inStrictMode = true; - return; - } - } - } - /// Should be called only on prologue directives (isPrologueDirective(node) should be true) - function isUseStrictPrologueDirective(node) { - var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the - // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; - } - function bindWorker(node) { - switch (node.kind) { - case 69 /* Identifier */: - return checkStrictModeIdentifier(node); - case 181 /* BinaryExpression */: - return checkStrictModeBinaryExpression(node); - case 244 /* CatchClause */: - return checkStrictModeCatchClause(node); - case 175 /* DeleteExpression */: - return checkStrictModeDeleteExpression(node); - case 8 /* NumericLiteral */: - return checkStrictModeNumericLiteral(node); - case 180 /* PostfixUnaryExpression */: - return checkStrictModePostfixUnaryExpression(node); - case 179 /* PrefixUnaryExpression */: - return checkStrictModePrefixUnaryExpression(node); - case 205 /* WithStatement */: - return checkStrictModeWithStatement(node); - case 97 /* ThisKeyword */: - seenThisKeyword = true; - return; - case 137 /* TypeParameter */: - return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 138 /* Parameter */: - return bindParameter(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - return bindVariableDeclarationOrBindingElement(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 247 /* EnumMember */: - return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - // If this is an ObjectLiteralExpression method, then it sits in the same space - // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes - // so that it will conflict with any other object literal members with the same - // name. - return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 213 /* FunctionDeclaration */: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 144 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 145 /* GetAccessor */: - return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 146 /* SetAccessor */: - return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - return bindFunctionOrConstructorType(node); - case 155 /* TypeLiteral */: - return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 165 /* ObjectLiteralExpression */: - return bindObjectLiteralExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - return bindClassLikeDeclaration(node); - case 215 /* InterfaceDeclaration */: - return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 216 /* TypeAliasDeclaration */: - return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 217 /* EnumDeclaration */: - return bindEnumDeclaration(node); - case 218 /* ModuleDeclaration */: - return bindModuleDeclaration(node); - case 221 /* ImportEqualsDeclaration */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: - return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 223 /* ImportClause */: - return bindImportClause(node); - case 228 /* ExportDeclaration */: - return bindExportDeclaration(node); - case 227 /* ExportAssignment */: - return bindExportAssignment(node); - case 248 /* SourceFile */: - return bindSourceFileIfExternalModule(); - } - } - function bindSourceFileIfExternalModule() { - setExportContextFlag(file); - if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); - } - } - function bindExportAssignment(node) { - if (!container.symbol || !container.symbol.exports) { - // Export assignment in some sort of block construct - bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); - } - else if (node.expression.kind === 69 /* Identifier */) { - // An export default clause with an identifier exports all meanings of that identifier - declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); - } - else { - // An export default clause with an expression exports a value - declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); - } - } - function bindExportDeclaration(node) { - if (!container.symbol || !container.symbol.exports) { - // Export * in some sort of block construct - bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); - } - else if (!node.exportClause) { - // All export * declarations are collected in an __export symbol - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); - } - } - function bindImportClause(node) { - if (node.name) { - declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - } - } - function bindClassLikeDeclaration(node) { - if (node.kind === 214 /* ClassDeclaration */) { - bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); - } - else { - var bindingName = node.name ? node.name.text : "__class"; - bindAnonymousDeclaration(node, 32 /* Class */, bindingName); - // Add name of class expression into the map for semantic classifier - if (node.name) { - classifiableNames[node.name.text] = node.name.text; - } - } - var symbol = node.symbol; - // TypeScript 1.0 spec (April 2014): 8.4 - // Every class automatically contains a static property member named 'prototype', the - // type of which is an instantiation of the class type with type Any supplied as a type - // argument for each type parameter. It is an error to explicitly declare a static - // property member with the name 'prototype'. - // - // Note: we check for this here because this class may be merging into a module. The - // module might have an exported variable called 'prototype'. We can't allow that as - // that would clash with the built-in 'prototype' for the class. - var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { - if (node.name) { - node.name.parent = node; - } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); - } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; - prototypeSymbol.parent = symbol; - } - function bindEnumDeclaration(node) { - return ts.isConst(node) - ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */) - : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */); - } - function bindVariableDeclarationOrBindingElement(node) { - if (inStrictMode) { - checkStrictModeEvalOrArguments(node, node.name); - } - if (!ts.isBindingPattern(node.name)) { - if (ts.isBlockOrCatchScoped(node)) { - bindBlockScopedVariableDeclaration(node); - } - else if (ts.isParameterDeclaration(node)) { - // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration - // because its parent chain has already been set up, since parents are set before descending into children. - // - // If node is a binding element in parameter declaration, we need to use ParameterExcludes. - // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration - // For example: - // function foo([a,a]) {} // Duplicate Identifier error - // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter - // // which correctly set excluded symbols - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */); - } - } - } - function bindParameter(node) { - if (inStrictMode) { - // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a - // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - checkStrictModeEvalOrArguments(node, node.name); - } - if (ts.isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node)); - } - else { - declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); - } - // If this is a property-parameter, then also declare the property symbol into the - // containing class. - if (node.flags & 56 /* AccessibilityModifier */ && - node.parent.kind === 144 /* Constructor */ && - ts.isClassLike(node.parent.parent)) { - var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); - } - } - function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { - return ts.hasDynamicName(node) - ? bindAnonymousDeclaration(node, symbolFlags, "__computed") - : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); - } - // reachability checks - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1 /* Unintialized */) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1 /* Unintialized */) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - // reference to unknown label or - // break/continue used outside of loops - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); - return true; - } - function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4 /* Unreachable */: - var reportError = - // report error on all statements - ts.isStatement(node) || - // report error on class declarations - node.kind === 214 /* ClassDeclaration */ || - // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || - // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8 /* ReportedUnreachable */; - // unreachable code is reported if - // - user has explicitly asked about it AND - // - statement is in not ambient context (statements in ambient context is already an error - // so we should not report extras) AND - // - node is not variable statement OR - // - node is block scoped variable statement OR - // - node is not block scoped variable statement and at least one variable declaration has initializer - // Rationale: we don't want to report errors on non-initialized var's since they are hoisted - // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 /* VariableStatement */ || - ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } - } - case 8 /* ReportedUnreachable */: - return true; - default: - return false; - } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2 /* Reachable */; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; - } - } -})(ts || (ts = {})); -/// /// /* @internal */ var ts; @@ -5812,6 +4503,10 @@ var ts; return file.externalModuleIndicator !== undefined; } ts.isExternalModule = isExternalModule; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { return (file.flags & 4096 /* DeclarationFile */) !== 0; } @@ -5865,19 +4560,27 @@ var ts; return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJsDocComments(node, sourceFileOfNode) { + return getJsDocCommentsFromText(node, sourceFileOfNode.text); + } + ts.getJsDocComments = getJsDocComments; + function getJsDocCommentsFromText(node, text) { var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? - ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : - getLeadingCommentRangesOfNode(node, sourceFileOfNode); + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47 /* slash */; + return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 3) !== 47 /* slash */; } } - ts.getJsDocComments = getJsDocComments; + ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { @@ -6464,6 +5167,57 @@ var ts; return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + /** + * Returns true if the node is a CallExpression to the identifier 'require' with + * exactly one string literal argument. + * This function does not test if the node is in a JavaScript file or not. + */ + function isRequireCall(expression) { + // of the form 'require("name")' + return expression.kind === 168 /* CallExpression */ && + expression.expression.kind === 69 /* Identifier */ && + expression.expression.text === "require" && + expression.arguments.length === 1 && + expression.arguments[0].kind === 9 /* StringLiteral */; + } + ts.isRequireCall = isRequireCall; + /** + * Returns true if the node is an assignment to a property on the identifier 'exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isExportsPropertyAssignment(expression) { + // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "exports"); + } + ts.isExportsPropertyAssignment = isExportsPropertyAssignment; + /** + * Returns true if the node is an assignment to the property access expression 'module.exports'. + * This function does not test if the node is in a JavaScript file or not. + */ + function isModuleExportsAssignment(expression) { + // of the form 'module.exports = expr' where 'expr' is arbitrary + return isInJavaScriptFile(expression) && + (expression.kind === 181 /* BinaryExpression */) && + (expression.operatorToken.kind === 56 /* EqualsToken */) && + (expression.left.kind === 166 /* PropertyAccessExpression */) && + (expression.left.expression.kind === 69 /* Identifier */) && + ((expression.left.expression).text === "module") && + (expression.left.name.text === "exports"); + } + ts.isModuleExportsAssignment = isModuleExportsAssignment; function getExternalModuleName(node) { if (node.kind === 222 /* ImportDeclaration */) { return node.moduleSpecifier; @@ -6791,8 +5545,8 @@ var ts; function getFileReferenceFromReferencePath(comment, commentRange) { var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.exec(comment)) { - if (isNoDefaultLibRegEx.exec(comment)) { + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; @@ -6834,6 +5588,10 @@ var ts; return isFunctionLike(node) && (node.flags & 256 /* Async */) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; + function isStringOrNumericLiteral(kind) { + return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; /** * A declaration has a dynamic name if both of the following are true: * 1. The declaration has a computed property name @@ -6842,11 +5600,15 @@ var ts; * Symbol. */ function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 136 /* ComputedPropertyName */ && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && isDynamicName(declaration.name); } ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 136 /* ComputedPropertyName */ && + !isStringOrNumericLiteral(name.expression.kind) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; /** * Checks if the expression is of the form: * Symbol.name @@ -7087,11 +5849,11 @@ var ts; } ts.getIndentSize = getIndentSize; function createTextWriter(newLine) { - var output = ""; - var indent = 0; - var lineStart = true; - var lineCount = 0; - var linePos = 0; + var output; + var indent; + var lineStart; + var lineCount; + var linePos; function write(s) { if (s && s.length) { if (lineStart) { @@ -7101,6 +5863,13 @@ var ts; output += s; } } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } function rawWrite(s) { if (s !== undefined) { if (lineStart) { @@ -7127,9 +5896,10 @@ var ts; lineStart = true; } } - function writeTextOfNode(sourceFile, node) { - write(getSourceTextOfNodeFromSourceFile(sourceFile, node)); + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); } + reset(); return { write: write, rawWrite: rawWrite, @@ -7142,10 +5912,20 @@ var ts; getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + getText: function () { return output; }, + reset: reset }; } ts.createTextWriter = createTextWriter; + /** + * Resolves a local path to a path which is absolute to the base of the emit + */ + function getExternalModuleNameFromPath(host, fileName) { + var dir = host.getCurrentDirectory(); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, /*isAbsolutePathAnUrl*/ false); + return ts.removeFileExtension(relativePath); + } + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); var emitOutputFilePathWithoutExtension; @@ -7174,6 +5954,10 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + } + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { @@ -7246,22 +6030,22 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { var emitLeadingSpace = !trailingSeparator; ts.forEach(comments, function (comment) { if (emitLeadingSpace) { writer.write(" "); emitLeadingSpace = false; } - writeComment(currentSourceFile, writer, comment, newLine); + writeComment(text, lineMap, writer, comment, newLine); if (comment.hasTrailingNewLine) { writer.writeLine(); } @@ -7279,7 +6063,7 @@ var ts; * Detached comment is a comment at the top of file or function body that is separated from * the next statement by space. */ - function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { var leadingComments; var currentDetachedCommentInfo; if (removeComments) { @@ -7289,12 +6073,12 @@ var ts; // // var x = 10; if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); } } else { // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + leadingComments = ts.getLeadingCommentRanges(text, node.pos); } if (leadingComments) { var detachedComments = []; @@ -7302,8 +6086,8 @@ var ts; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This // comment is not part of the copyright comments. Return what we have so @@ -7318,36 +6102,36 @@ var ts; // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; } } } return currentDetachedCommentInfo; function isPinnedComment(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; } } ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(currentSourceFile, writer, comment, newLine) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lineCount = ts.getLineStarts(currentSourceFile).length; + function writeCommentRange(text, lineMap, writer, comment, newLine) { + if (text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + var lineCount = lineMap.length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : getStartPositionOfLine(currentLine + 1, currentSourceFile); + ? text.length + 1 + : lineMap[currentLine + 1]; if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); } // These are number of spaces writer is going to write at current indent var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); @@ -7365,7 +6149,7 @@ var ts; // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); @@ -7383,45 +6167,45 @@ var ts; } } // Write the comment line text - writeTrimmedCurrentLine(pos, nextLineStart); + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { // Single line comment of style //.... - writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); - } - function writeTrimmedCurrentLine(pos, nextLineStart) { - var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - // trimmed forward and ending spaces text - writer.write(currentLineText); - if (end !== comment.end) { - writer.writeLine(); - } - } - else { - // Empty string - make sure we write empty line - writer.writeLiteral(newLine); - } - } - function calculateIndent(pos, end) { - var currentLineIndent = 0; - for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === 9 /* tab */) { - // Tabs = TabSize = indent size and go to next tabStop - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - // Single space - currentLineIndent++; - } - } - return currentLineIndent; + writer.write(text.substring(comment.pos, comment.end)); } } ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + // trimmed forward and ending spaces text + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + // Empty string - make sure we write empty line + writer.writeLiteral(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9 /* tab */) { + // Tabs = TabSize = indent size and go to next tabStop + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + // Single space + currentLineIndent++; + } + } + return currentLineIndent; + } function modifierToFlag(token) { switch (token) { case 113 /* StaticKeyword */: return 64 /* Static */; @@ -7517,14 +6301,14 @@ var ts; return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function isJavaScript(fileName) { - return ts.fileExtensionIs(fileName, ".js"); + function hasJavaScriptFileExtension(fileName) { + return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isJavaScript = isJavaScript; - function isTsx(fileName) { - return ts.fileExtensionIs(fileName, ".tsx"); + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function allowsJsxExpressions(fileName) { + return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); } - ts.isTsx = isTsx; + ts.allowsJsxExpressions = allowsJsxExpressions; /** * Replace each instance of non-ascii characters by one, two, three, or four escape sequences * representing the UTF-8 encoding of the character, and return the expanded char code list. @@ -7835,18 +6619,20 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; })(ts || (ts = {})); -/// /// +/// var ts; (function (ts) { - var nodeConstructors = new Array(272 /* Count */); /* @internal */ ts.parseTime = 0; - function getNodeConstructor(kind) { - return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); - } - ts.getNodeConstructor = getNodeConstructor; + var NodeConstructor; + var SourceFileConstructor; function createNode(kind, pos, end) { - return new (getNodeConstructor(kind))(pos, end); + if (kind === 248 /* SourceFile */) { + return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end); + } } ts.createNode = createNode; function visitNode(cbNode, node) { @@ -8269,6 +7055,9 @@ var ts; // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; + // capture constructors in 'initializeState' to avoid null checks + var NodeConstructor; + var SourceFileConstructor; var sourceFile; var parseDiagnostics; var syntaxCursor; @@ -8354,13 +7143,16 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; + initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor) { + function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + NodeConstructor = ts.objectAllocator.getNodeConstructor(); + SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; @@ -8368,13 +7160,13 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = ts.isJavaScript(fileName) ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.isTsx(fileName) ? 1 /* JSX */ : 0 /* Standard */); + scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 /* JSX */ : 0 /* Standard */); } function clearState() { // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily. @@ -8389,6 +7181,9 @@ var ts; } function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); + if (contextFlags & 32 /* JavaScriptFile */) { + sourceFile.parserContextFlags = 32 /* JavaScriptFile */; + } // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -8406,7 +7201,7 @@ var ts; // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; @@ -8461,15 +7256,16 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(248 /* SourceFile */, /*pos*/ 0); - sourceFile.pos = 0; - sourceFile.end = sourceText.length; + // code from createNode is inlined here so createNode won't have to deal with special case of creating source files + // this is quite rare comparing to other nodes and createNode should be as fast as possible + var sourceFile = new SourceFileConstructor(248 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; - sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; + sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; return sourceFile; } function setContextFlag(val, flag) { @@ -8734,12 +7530,13 @@ var ts; return parseExpected(23 /* SemicolonToken */); } } + // note: this function creates only node function createNode(kind, pos) { nodeCount++; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos); + return new NodeConstructor(kind, pos, pos); } function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; @@ -8904,7 +7701,7 @@ var ts; case 12 /* ObjectLiteralMembers */: return token === 19 /* OpenBracketToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); case 9 /* ObjectBindingElements */: - return isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. @@ -9584,9 +8381,7 @@ var ts; } function parseParameterType() { if (parseOptional(54 /* ColonToken */)) { - return token === 9 /* StringLiteral */ - ? parseLiteralNode(/*internName*/ true) - : parseType(); + return parseType(); } return undefined; } @@ -9917,6 +8712,8 @@ var ts; // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); + case 9 /* StringLiteral */: + return parseLiteralNode(/*internName*/ true); case 103 /* VoidKeyword */: case 97 /* ThisKeyword */: return parseTokenNode(); @@ -9946,6 +8743,7 @@ var ts; case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: case 92 /* NewKeyword */: + case 9 /* StringLiteral */: return true; case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, @@ -10362,7 +9160,7 @@ var ts; return 1 /* True */; } // This *could* be a parenthesized arrow function. - // Return Unknown to let the caller know. + // Return Unknown to const the caller know. return 2 /* Unknown */; } else { @@ -10448,7 +9246,7 @@ var ts; // user meant to supply a block. For example, if the user wrote: // // a => - // let v = 0; + // const v = 0; // } // // they may be missing an open brace. Check to see if that's the case so we can @@ -10664,7 +9462,6 @@ var ts; var unaryOperator = token; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { - var diagnostic; var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); @@ -11868,7 +10665,6 @@ var ts; } function parseObjectBindingElement() { var node = createNode(163 /* BindingElement */); - // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -12691,7 +11487,7 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -12786,6 +11582,7 @@ var ts; case 103 /* VoidKeyword */: return parseTokenNode(); } + // TODO (drosen): Parse string literal types in JSDoc as well. return parseJSDocTypeReference(); } function parseJSDocThisType() { @@ -12957,7 +11754,7 @@ var ts; } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); @@ -13682,6 +12479,1372 @@ var ts; })(InvalidPosition || (InvalidPosition = {})); })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); +/// +/// +/* @internal */ +var ts; +(function (ts) { + ts.bindTime = 0; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + var Reachability; + (function (Reachability) { + Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; + Reachability[Reachability["Reachable"] = 2] = "Reachable"; + Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; + Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; + })(Reachability || (Reachability = {})); + function or(state1, state2) { + return (state1 | state2) & 2 /* Reachable */ + ? 2 /* Reachable */ + : (state1 & state2) & 8 /* ReportedUnreachable */ + ? 8 /* ReportedUnreachable */ + : 4 /* Unreachable */; + } + function getModuleInstanceState(node) { + // A module is uninstantiated if it contains only + // 1. interface declarations, type alias declarations + if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { + return 0 /* NonInstantiated */; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; + } + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { + return 0 /* NonInstantiated */; + } + else if (node.kind === 219 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + // child is non-instantiated - continue searching + return false; + case 2 /* ConstEnumOnly */: + // child is const enum only - record state and continue searching + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + // child is instantiated - record state and stop + state = 1 /* Instantiated */; + return true; + } + }); + return state; + } + else if (node.kind === 218 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); + } + else { + return 1 /* Instantiated */; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + var ContainerFlags; + (function (ContainerFlags) { + // The current node is not a container, and no container manipulation should happen before + // recursing into it. + ContainerFlags[ContainerFlags["None"] = 0] = "None"; + // The current node is a container. It should be set as the current container (and block- + // container) before recursing into it. The current node does not have locals. Examples: + // + // Classes, ObjectLiterals, TypeLiterals, Interfaces... + ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; + // The current node is a block-scoped-container. It should be set as the current block- + // container before recursing into it. Examples: + // + // Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements... + ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags[ContainerFlags["HasLocals"] = 4] = "HasLocals"; + // If the current node is a container that also container that also contains locals. Examples: + // + // Functions, Methods, Modules, Source-files. + ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; + })(ContainerFlags || (ContainerFlags = {})); + var binder = createBinder(); + function bindSourceFile(file, options) { + var start = new Date().getTime(); + binder(file, options); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function createBinder() { + var file; + var options; + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var seenThisKeyword; + // state used by reachability checks + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; + // If this file is an external module, then it is automatically in strict-mode according to + // ES6. If it is not an external module, then we'll determine if it is in strict mode or + // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). + var inStrictMode; + var symbolCount = 0; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; + } + return bindSourceFile; + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolFlags) { + symbol.flags |= symbolFlags; + node.symbol = symbol; + if (!symbol.declarations) { + symbol.declarations = []; + } + symbol.declarations.push(node); + if (symbolFlags & 1952 /* HasExports */ && !symbol.exports) { + symbol.exports = {}; + } + if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { + symbol.members = {}; + } + if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { + symbol.valueDeclaration = node; + } + } + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return "\"" + node.name.text + "\""; + } + if (node.name.kind === 136 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } + return node.name.text; + } + switch (node.kind) { + case 144 /* Constructor */: + return "__constructor"; + case 152 /* FunctionType */: + case 147 /* CallSignature */: + return "__call"; + case 153 /* ConstructorType */: + case 148 /* ConstructSignature */: + return "__new"; + case 149 /* IndexSignature */: + return "__index"; + case 228 /* ExportDeclaration */: + return "__export"; + case 227 /* ExportAssignment */: + return node.isExportEquals ? "export=" : "default"; + case 181 /* BinaryExpression */: + // Binary expression case is for JS module 'module.exports = expr' + return "export="; + case 213 /* FunctionDeclaration */: + case 214 /* ClassDeclaration */: + return node.flags & 512 /* Default */ ? "default" : undefined; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + /** + * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. + * @param symbolTable - The symbol table which node will be added to. + * @param parent - node's parent declaration. + * @param node - The declaration to be added to the symbol table + * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) + * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. + */ + function declareSymbol(symbolTable, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 512 /* Default */; + // The exported symbol for an export default function/class node is always named "default" + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); + var symbol; + if (name !== undefined) { + // Check and see if the symbol table already has a symbol with this name. If not, + // create a new symbol with this name and add it to the table. Note that we don't + // give the new symbol any flags *yet*. This ensures that it will not conflict + // with the 'excludes' flags we pass in. + // + // If we do get an existing symbol, see if it conflicts with the new symbol we're + // creating. For example, a 'var' symbol and a 'class' symbol will conflict within + // the same symbol table. If we have a conflict, report the issue on each + // declaration we have for this symbol, and then create a new symbol for this + // declaration. + // + // If we created a new symbol, either because we didn't have a symbol with this name + // in the symbol table, or we conflicted with an existing symbol, then just add this + // node as the sole declaration of the new symbol. + // + // Otherwise, we'll be merging into a compatible existing symbol (for example when + // you have multiple 'vars' with the same name in the same container). In this case + // just add this node into the declarations list of the symbol. + symbol = ts.hasProperty(symbolTable, name) + ? symbolTable[name] + : (symbolTable[name] = createSymbol(0 /* None */, name)); + if (name && (includes & 788448 /* Classifiable */)) { + classifiableNames[name] = name; + } + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + // Report errors every position with duplicate declaration + // Report errors on previous encountered declarations + var message = symbol.flags & 2 /* BlockScopedVariable */ + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 512 /* Default */) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); + ts.forEach(symbol.declarations, function (declaration) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + symbol = createSymbol(0 /* None */, name); + } + } + else { + symbol = createSymbol(0 /* None */, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + return symbol; + } + function declareModuleMember(node, symbolFlags, symbolExcludes) { + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; + if (symbolFlags & 8388608 /* Alias */) { + if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + else { + // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, + // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set + // on it. There are 2 main reasons: + // + // 1. We treat locals and exports of the same name as mutually exclusive within a container. + // That means the binder will issue a Duplicate Identifier error if you mix locals and exports + // with the same name in the same container. + // TODO: Make this a more specific error and decouple it from the exclusion logic. + // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, + // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way + // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. + if (hasExportModifier || container.flags & 131072 /* ExportContext */) { + var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | + (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | + (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + node.localSymbol = local; + return local; + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + } + // All container nodes are kept on a linked list in declaration order. This list is used by + // the getLocalNameOfContainer function in the type checker to validate that the local name + // used for a container is unique. + function bindChildren(node) { + // Before we recurse into a node's chilren, we first save the existing parent, container + // and block-container. Then after we pop out of processing the children, we restore + // these saved values. + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + // This node will now be set as the parent of all of its children as we recurse into them. + parent = node; + // Depending on what kind of node this is, we may have to adjust the current container + // and block-container. If the current node is a container, then it is automatically + // considered the current block-container as well. Also, for containers that we know + // may contain locals, we proactively initialize the .locals field. We do this because + // it's highly likely that the .locals will be needed to place some child in (for example, + // a parameter, or variable declaration). + // + // However, we do not proactively create the .locals for block-containers because it's + // totally normal and common for block-containers to never actually have a block-scoped + // variable in them. We don't want to end up allocating an object for every 'block' we + // run into when most of them won't be necessary. + // + // Finally, if this is a block-container, then we clear out any existing .locals object + // it may contain within it. This happens in incremental scenarios. Because we can be + // reusing a node from a previous compilation, that node may have had 'locals' created + // for it. We must clear this so we don't accidently move any stale data forward from + // a previous compilation. + var containerFlags = getContainerFlags(node); + if (containerFlags & 1 /* IsContainer */) { + container = blockScopeContainer = node; + if (containerFlags & 4 /* HasLocals */) { + container.locals = {}; + } + addToContainerChain(container); + } + else if (containerFlags & 2 /* IsBlockScopedContainer */) { + blockScopeContainer = node; + blockScopeContainer.locals = undefined; + } + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + // reset all reachability check related flags on node (for incremental scenarios) + flags &= ~1572864 /* ReachabilityCheckFlags */; + if (kind === 215 /* InterfaceDeclaration */) { + seenThisKeyword = false; + } + var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2 /* Reachable */; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288 /* HasImplicitReturn */; + if (hasExplicitReturn) { + flags |= 1048576 /* HasExplicitReturn */; + } + } + if (kind === 215 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; + } + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + /** + * Returns true if node and its subnodes were successfully traversed. + * Returning false means that node was not examined and caller needs to dive into the node himself. + */ + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198 /* WhileStatement */: + bindWhileStatement(node); + break; + case 197 /* DoStatement */: + bindDoStatement(node); + break; + case 199 /* ForStatement */: + bindForStatement(node); + break; + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + bindForInOrForOfStatement(node); + break; + case 196 /* IfStatement */: + bindIfStatement(node); + break; + case 204 /* ReturnStatement */: + case 208 /* ThrowStatement */: + bindReturnOrThrow(node); + break; + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + bindBreakOrContinueStatement(node); + break; + case 209 /* TryStatement */: + bindTryStatement(node); + break; + case 206 /* SwitchStatement */: + bindSwitchStatement(node); + break; + case 220 /* CaseBlock */: + bindCaseBlock(node); + break; + case 207 /* LabeledStatement */: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // bind expressions (don't affect reachability) + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; + popImplicitLabel(postDoLabel, postDoState); + // bind expressions (don't affect reachability) + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + // for statement is considered infinite when it condition is either omitted or is true keyword + // - for(..;;..) + // - for(..;true;..) + var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); + var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + // denotes reachability state when entering 'thenStatement' part of the if statement: + // i.e. if condition is false then thenStatement is unreachable + var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // denotes reachability state when entering 'elseStatement': + // i.e. if condition is true then elseStatement is unreachable + var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + currentReachabilityState = ifTrueState; + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + // bind expression (don't affect reachability) + bind(n.expression); + if (n.kind === 204 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentReachabilityState = 4 /* Unreachable */; + } + function bindBreakOrContinueStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + // for continue case touch label so it will be marked a used + var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + if (isValidJump) { + currentReachabilityState = 4 /* Unreachable */; + } + } + function bindTryStatement(n) { + // catch\finally blocks has the same reachability as try block + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + // post catch/finally state is reachable if + // - post try state is reachable - control flow can fall out of try block + // - post catch state is reachable - control flow can fall out of catch block + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); + // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case + var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } + function getContainerFlags(node) { + switch (node.kind) { + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + case 215 /* InterfaceDeclaration */: + case 217 /* EnumDeclaration */: + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + return 1 /* IsContainer */; + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 213 /* FunctionDeclaration */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 218 /* ModuleDeclaration */: + case 248 /* SourceFile */: + case 216 /* TypeAliasDeclaration */: + return 5 /* IsContainerWithLocals */; + case 244 /* CatchClause */: + case 199 /* ForStatement */: + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + case 220 /* CaseBlock */: + return 2 /* IsBlockScopedContainer */; + case 192 /* Block */: + // do not treat blocks directly inside a function as a block-scoped-container. + // Locals that reside in this block should go to the function locals. Othewise 'x' + // would not appear to be a redeclaration of a block scoped local in the following + // example: + // + // function foo() { + // var x; + // let x; + // } + // + // If we placed 'var x' into the function locals and 'let x' into the locals of + // the block, then there would be no collision. + // + // By not creating a new block-scoped-container here, we ensure that both 'var x' + // and 'let x' go into the Function-container's locals, and we do get a collision + // conflict. + return ts.isFunctionLike(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */; + } + return 0 /* None */; + } + function addToContainerChain(next) { + if (lastContainer) { + lastContainer.nextContainer = next; + } + lastContainer = next; + } + function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { + // Just call this directly so that the return type of this function stays "void". + declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); + } + function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { + switch (container.kind) { + // Modules, source files, and classes need specialized handling for how their + // members are declared (for example, a member of a class will go into a specific + // symbol table depending on if it is static or not). We defer to specialized + // handlers to take care of declaring these child members. + case 218 /* ModuleDeclaration */: + return declareModuleMember(node, symbolFlags, symbolExcludes); + case 248 /* SourceFile */: + return declareSourceFileMember(node, symbolFlags, symbolExcludes); + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 217 /* EnumDeclaration */: + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + case 155 /* TypeLiteral */: + case 165 /* ObjectLiteralExpression */: + case 215 /* InterfaceDeclaration */: + // Interface/Object-types always have their children added to the 'members' of + // their container. They are only accessible through an instance of their + // container, and are never in scope otherwise (even inside the body of the + // object / type / interface declaring them). An exception is type parameters, + // which are in scope without qualification (similar to 'locals'). + return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 144 /* Constructor */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 213 /* FunctionDeclaration */: + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + case 216 /* TypeAliasDeclaration */: + // All the children of these container types are never visible through another + // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, + // they're only accessed 'lexically' (i.e. from code that exists underneath + // their container in the tree. To accomplish this, we simply add their declared + // symbol to the 'locals' of the container. These symbols can then be found as + // the type checker walks up the containers, checking them for matching names. + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function declareClassMember(node, symbolFlags, symbolExcludes) { + return node.flags & 64 /* Static */ + ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) + : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + } + function declareSourceFileMember(node, symbolFlags, symbolExcludes) { + return ts.isExternalModule(file) + ? declareModuleMember(node, symbolFlags, symbolExcludes) + : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + } + function hasExportDeclarations(node) { + var body = node.kind === 248 /* SourceFile */ ? node : node.body; + if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var stat = _a[_i]; + if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { + return true; + } + } + } + return false; + } + function setExportContextFlag(node) { + // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular + // declarations with export modifiers) is an export context in which declarations are implicitly exported. + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072 /* ExportContext */; + } + else { + node.flags &= ~131072 /* ExportContext */; + } + } + function bindModuleDeclaration(node) { + setExportContextFlag(node); + if (node.name.kind === 9 /* StringLiteral */) { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } + else { + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { + // if module was already merged with some function, class or non-const enum + // treat is a non-const-enum-only + node.symbol.constEnumOnlyModule = false; + } + else { + var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; + if (node.symbol.constEnumOnlyModule === undefined) { + // non-merged case - use the current state + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + // merged case: module is const enum only if all its pieces are non-instantiated or const enum + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } + } + } + } + } + function bindFunctionOrConstructorType(node) { + // For a given function symbol "<...>(...) => T" we want to generate a symbol identical + // to the one we would get for: { <...>(...): T } + // + // We do that by making an anonymous type literal symbol, and then setting the function + // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable + // from an actual type literal symbol you would have gotten had you used the long form. + var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072 /* Signature */); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); + var _a; + } + function bindObjectLiteralExpression(node) { + var ElementKind; + (function (ElementKind) { + ElementKind[ElementKind["Property"] = 1] = "Property"; + ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; + })(ElementKind || (ElementKind = {})); + if (inStrictMode) { + var seen = {}; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.name.kind !== 69 /* Identifier */) { + continue; + } + var identifier = prop.name; + // ECMA-262 11.1.5 Object Initialiser + // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true + // a.This production is contained in strict code and IsDataDescriptor(previous) is true and + // IsDataDescriptor(propId.descriptor) is true. + // b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true. + // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. + // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true + // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields + var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ + ? 1 /* Property */ + : 2 /* Accessor */; + var existingKind = seen[identifier.text]; + if (!existingKind) { + seen[identifier.text] = currentKind; + continue; + } + if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { + var span = ts.getErrorSpanForNode(file, identifier); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); + } + } + } + return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); + } + function bindAnonymousDeclaration(node, symbolFlags, name) { + var symbol = createSymbol(symbolFlags, name); + addDeclarationToSymbol(symbol, node, symbolFlags); + } + function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { + switch (blockScopeContainer.kind) { + case 218 /* ModuleDeclaration */: + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + case 248 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + } + // fall through. + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + addToContainerChain(blockScopeContainer); + } + declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function bindBlockScopedVariableDeclaration(node) { + bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + } + // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized + // check for reserved words used as identifiers in strict mode code. + function checkStrictModeIdentifier(node) { + if (inStrictMode && + node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && + !ts.isIdentifierName(node)) { + // Report error only if there are no parse errors in file + if (!file.parseDiagnostics.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); + } + } + } + function getStrictModeIdentifierMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; + } + function checkStrictModeBinaryExpression(node) { + if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + checkStrictModeEvalOrArguments(node, node.left); + } + } + function checkStrictModeCatchClause(node) { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + if (inStrictMode && node.variableDeclaration) { + checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); + } + } + function checkStrictModeDeleteExpression(node) { + // Grammar checking + if (inStrictMode && node.expression.kind === 69 /* Identifier */) { + // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its + // UnaryExpression is a direct reference to a variable, function argument, or function name + var span = ts.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + } + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 69 /* Identifier */ && + (node.text === "eval" || node.text === "arguments"); + } + function checkStrictModeEvalOrArguments(contextNode, name) { + if (name && name.kind === 69 /* Identifier */) { + var identifier = name; + if (isEvalOrArgumentsIdentifier(identifier)) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + var span = ts.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + } + } + } + function getStrictModeEvalOrArgumentsMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; + } + function checkStrictModeFunctionName(node) { + if (inStrictMode) { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) + checkStrictModeEvalOrArguments(node, node.name); + } + } + function checkStrictModeNumericLiteral(node) { + if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); + } + } + function checkStrictModePostfixUnaryExpression(node) { + // Grammar checking + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + function checkStrictModePrefixUnaryExpression(node) { + // Grammar checking + if (inStrictMode) { + if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + } + function checkStrictModeWithStatement(node) { + // Grammar checking for withStatement + if (inStrictMode) { + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function errorOnFirstToken(node, message, arg0, arg1, arg2) { + var span = ts.getSpanOfTokenAtPosition(file, node.pos); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + if (!node) { + return; + } + node.parent = parent; + var savedInStrictMode = inStrictMode; + if (!savedInStrictMode) { + updateStrictMode(node); + } + // First we bind declaration nodes to a symbol if possible. We'll both create a symbol + // and then potentially add the symbol to an appropriate symbol table. Possible + // destination symbol tables are: + // + // 1) The 'exports' table of the current container's symbol. + // 2) The 'members' table of the current container's symbol. + // 3) The 'locals' table of the current container. + // + // However, not all symbols will end up in any of these tables. 'Anonymous' symbols + // (like TypeLiterals for example) will not be put in any table. + bindWorker(node); + // Then we recurse into the children of the node to bind them as well. For certain + // symbols we do specialized work when we recurse. For example, we'll keep track of + // the current 'container' node when it changes. This helps us know which symbol table + // a local should go into for example. + bindChildren(node); + inStrictMode = savedInStrictMode; + } + function updateStrictMode(node) { + switch (node.kind) { + case 248 /* SourceFile */: + case 219 /* ModuleBlock */: + updateStrictModeStatementList(node.statements); + return; + case 192 /* Block */: + if (ts.isFunctionLike(node.parent)) { + updateStrictModeStatementList(node.statements); + } + return; + case 214 /* ClassDeclaration */: + case 186 /* ClassExpression */: + // All classes are automatically in strict mode in ES6. + inStrictMode = true; + return; + } + } + function updateStrictModeStatementList(statements) { + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; + if (!ts.isPrologueDirective(statement)) { + return; + } + if (isUseStrictPrologueDirective(statement)) { + inStrictMode = true; + return; + } + } + } + /// Should be called only on prologue directives (isPrologueDirective(node) should be true) + function isUseStrictPrologueDirective(node) { + var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); + // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the + // string to contain unicode escapes (as per ES5). + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + } + function bindWorker(node) { + switch (node.kind) { + /* Strict mode checks */ + case 69 /* Identifier */: + return checkStrictModeIdentifier(node); + case 181 /* BinaryExpression */: + if (ts.isInJavaScriptFile(node)) { + if (ts.isExportsPropertyAssignment(node)) { + bindExportsPropertyAssignment(node); + } + else if (ts.isModuleExportsAssignment(node)) { + bindModuleExportsAssignment(node); + } + } + return checkStrictModeBinaryExpression(node); + case 244 /* CatchClause */: + return checkStrictModeCatchClause(node); + case 175 /* DeleteExpression */: + return checkStrictModeDeleteExpression(node); + case 8 /* NumericLiteral */: + return checkStrictModeNumericLiteral(node); + case 180 /* PostfixUnaryExpression */: + return checkStrictModePostfixUnaryExpression(node); + case 179 /* PrefixUnaryExpression */: + return checkStrictModePrefixUnaryExpression(node); + case 205 /* WithStatement */: + return checkStrictModeWithStatement(node); + case 97 /* ThisKeyword */: + seenThisKeyword = true; + return; + case 137 /* TypeParameter */: + return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); + case 138 /* Parameter */: + return bindParameter(node); + case 211 /* VariableDeclaration */: + case 163 /* BindingElement */: + return bindVariableDeclarationOrBindingElement(node); + case 141 /* PropertyDeclaration */: + case 140 /* PropertySignature */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); + case 245 /* PropertyAssignment */: + case 246 /* ShorthandPropertyAssignment */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); + case 247 /* EnumMember */: + return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + // If this is an ObjectLiteralExpression method, then it sits in the same space + // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes + // so that it will conflict with any other object literal members with the same + // name. + return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); + case 213 /* FunctionDeclaration */: + checkStrictModeFunctionName(node); + return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); + case 144 /* Constructor */: + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); + case 145 /* GetAccessor */: + return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); + case 146 /* SetAccessor */: + return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + return bindFunctionOrConstructorType(node); + case 155 /* TypeLiteral */: + return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); + case 165 /* ObjectLiteralExpression */: + return bindObjectLiteralExpression(node); + case 173 /* FunctionExpression */: + case 174 /* ArrowFunction */: + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); + case 168 /* CallExpression */: + if (ts.isInJavaScriptFile(node)) { + bindCallExpression(node); + } + break; + // Members of classes, interfaces, and modules + case 186 /* ClassExpression */: + case 214 /* ClassDeclaration */: + return bindClassLikeDeclaration(node); + case 215 /* InterfaceDeclaration */: + return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); + case 216 /* TypeAliasDeclaration */: + return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); + case 217 /* EnumDeclaration */: + return bindEnumDeclaration(node); + case 218 /* ModuleDeclaration */: + return bindModuleDeclaration(node); + // Imports and exports + case 221 /* ImportEqualsDeclaration */: + case 224 /* NamespaceImport */: + case 226 /* ImportSpecifier */: + case 230 /* ExportSpecifier */: + return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + case 223 /* ImportClause */: + return bindImportClause(node); + case 228 /* ExportDeclaration */: + return bindExportDeclaration(node); + case 227 /* ExportAssignment */: + return bindExportAssignment(node); + case 248 /* SourceFile */: + return bindSourceFileIfExternalModule(); + } + } + function bindSourceFileIfExternalModule() { + setExportContextFlag(file); + if (ts.isExternalModule(file)) { + bindSourceFileAsExternalModule(); + } + } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } + function bindExportAssignment(node) { + var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; + if (!container.symbol || !container.symbol.exports) { + // Export assignment in some sort of block construct + bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); + } + else if (boundExpression.kind === 69 /* Identifier */) { + // An export default clause with an identifier exports all meanings of that identifier + declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); + } + else { + // An export default clause with an expression exports a value + declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); + } + } + function bindExportDeclaration(node) { + if (!container.symbol || !container.symbol.exports) { + // Export * in some sort of block construct + bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); + } + else if (!node.exportClause) { + // All export * declarations are collected in an __export symbol + declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); + } + } + function bindImportClause(node) { + if (node.name) { + declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } + } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + // When we create a property via 'exports.foo = bar', the 'exports.foo' property access + // expression is the declaration + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); + } + function bindModuleExportsAssignment(node) { + // 'module.exports = expr' assignment + setCommonJsModuleIndicator(node); + bindExportAssignment(node); + } + function bindCallExpression(node) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node) { + if (node.kind === 214 /* ClassDeclaration */) { + bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); + } + else { + var bindingName = node.name ? node.name.text : "__class"; + bindAnonymousDeclaration(node, 32 /* Class */, bindingName); + // Add name of class expression into the map for semantic classifier + if (node.name) { + classifiableNames[node.name.text] = node.name.text; + } + } + var symbol = node.symbol; + // TypeScript 1.0 spec (April 2014): 8.4 + // Every class automatically contains a static property member named 'prototype', the + // type of which is an instantiation of the class type with type Any supplied as a type + // argument for each type parameter. It is an error to explicitly declare a static + // property member with the name 'prototype'. + // + // Note: we check for this here because this class may be merging into a module. The + // module might have an exported variable called 'prototype'. We can't allow that as + // that would clash with the built-in 'prototype' for the class. + var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + function bindEnumDeclaration(node) { + return ts.isConst(node) + ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */) + : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */); + } + function bindVariableDeclarationOrBindingElement(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (!ts.isBindingPattern(node.name)) { + if (ts.isBlockOrCatchScoped(node)) { + bindBlockScopedVariableDeclaration(node); + } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */); + } + } + } + function bindParameter(node) { + if (inStrictMode) { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) + checkStrictModeEvalOrArguments(node, node.name); + } + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node)); + } + else { + declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */); + } + // If this is a property-parameter, then also declare the property symbol into the + // containing class. + if (node.flags & 56 /* AccessibilityModifier */ && + node.parent.kind === 144 /* Constructor */ && + ts.isClassLike(node.parent.parent)) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); + } + } + function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + return ts.hasDynamicName(node) + ? bindAnonymousDeclaration(node, symbolFlags, "__computed") + : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + // reachability checks + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1 /* Unintialized */) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1 /* Unintialized */) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + // reference to unknown label or + // break/continue used outside of loops + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4 /* Unreachable */: + var reportError = + // report error on all statements except empty ones + (ts.isStatement(node) && node.kind !== 194 /* EmptyStatement */) || + // report error on class declarations + node.kind === 214 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8 /* ReportedUnreachable */; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8 /* ReportedUnreachable */: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2 /* Reachable */; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } + } +})(ts || (ts = {})); /// /* @internal */ var ts; @@ -13755,7 +13918,7 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: getApparentTypeOfContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -14025,7 +14188,7 @@ var ts; return ts.getAncestor(node, 248 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 248 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -14127,15 +14290,24 @@ var ts; } switch (location.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location)) + if (!ts.isExternalOrCommonJsModule(location)) break; case 218 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; if (location.kind === 248 /* SourceFile */ || (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { - // It's an external module. Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope. Therefore, - // if the name we find is purely an export specifier, it is not actually considered in scope. + // It's an external module. First see if the module has an export default and if the local + // name of that export default matches. + if (result = moduleExports["default"]) { + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } + // Because of module/namespace merging, a module's exports are in scope, + // yet we never want to treat an export specifier as putting a member in scope. + // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol // on an export specifier is that it might find the export specifier itself, and try to @@ -14149,12 +14321,6 @@ var ts; ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { break; } - result = moduleExports["default"]; - var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { - break loop; - } - result = undefined; } if (result = getSymbol(moduleExports, name, meaning & 8914931 /* ModuleMember */)) { break loop; @@ -14297,7 +14463,7 @@ var ts; // declare module foo { // interface bar {} // } - // let foo/*1*/: foo/*2*/.bar; + // const foo/*1*/: foo/*2*/.bar; // The foo at /*1*/ and /*2*/ will share same symbol with two meaning // block - scope variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, @@ -14601,6 +14767,9 @@ var ts; if (moduleName === undefined) { return; } + if (moduleName.indexOf("!") >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf("!")); + } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); @@ -14788,7 +14957,7 @@ var ts; } switch (location_1.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location_1)) { + if (!ts.isExternalOrCommonJsModule(location_1)) { break; } case 218 /* ModuleDeclaration */: @@ -14910,7 +15079,7 @@ var ts; // export class c { // } // } - // let x: typeof m.c + // const x: typeof m.c // In the above example when we start with checking if typeof m.c symbol is accessible, // we are going to see if c can be accessed in scope directly. // But it can't, hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible @@ -14949,7 +15118,7 @@ var ts; } function hasExternalModuleSymbol(declaration) { return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 248 /* SourceFile */ && ts.isExternalModule(declaration)); + (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -15100,7 +15269,7 @@ var ts; parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); } - // Let the writer know we just wrote out a symbol. The declaration emitter writer uses + // const the writer know we just wrote out a symbol. The declaration emitter writer uses // this to determine if an import it has previously seen (and not written out) needs // to be written to the file once the walk of the tree is complete. // @@ -15181,7 +15350,7 @@ var ts; writeAnonymousType(type, flags); } else if (type.flags & 256 /* StringLiteral */) { - writer.writeStringLiteral(type.text); + writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); } else { // Should never get here @@ -15568,7 +15737,7 @@ var ts; } } else if (node.kind === 248 /* SourceFile */) { - return ts.isExternalModule(node) ? node : undefined; + return ts.isExternalOrCommonJsModule(node) ? node : undefined; } } ts.Debug.fail("getContainingModule cant reach here"); @@ -15650,7 +15819,7 @@ var ts; // Private/protected properties/methods are not visible return false; } - // Public properties/methods are visible if its parents are visible, so let it fall into next case statement + // Public properties/methods are visible if its parents are visible, so const it fall into next case statement case 144 /* Constructor */: case 148 /* ConstructSignature */: case 147 /* CallSignature */: @@ -15678,7 +15847,7 @@ var ts; // Source file is always visible case 248 /* SourceFile */: return true; - // Export assignements do not create name bindings outside the module + // Export assignments do not create name bindings outside the module case 227 /* ExportAssignment */: return false; default: @@ -15814,6 +15983,23 @@ var ts; var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); } + function getTextOfPropertyName(name) { + switch (name.kind) { + case 69 /* Identifier */: + return name.text; + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + return name.text; + case 136 /* ComputedPropertyName */: + if (ts.isStringOrNumericLiteral(name.expression.kind)) { + return name.expression.text; + } + } + return undefined; + } + function isComputedNonLiteralName(name) { + return name.kind === 136 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + } // Return the inferred type for a binding element function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -15835,10 +16021,15 @@ var ts; if (pattern.kind === 161 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_10)) { + // computed properties with non-literal names are treated as 'any' + return anyType; + } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - type = getTypeOfPropertyOfType(parentType, name_10.text) || - isNumericLiteralName(name_10.text) && getIndexTypeOfType(parentType, 1 /* Number */) || + var text = getTextOfPropertyName(name_10); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { error(name_10, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_10)); @@ -15938,10 +16129,17 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; + var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { - var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type + hasComputedProperties = true; + return; + } + var text = getTextOfPropertyName(name); + var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); + var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType); symbol.bindingElement = e; members[symbol.name] = symbol; @@ -15950,6 +16148,9 @@ var ts; if (includePatternInType) { result.pattern = pattern; } + if (hasComputedProperties) { + result.flags |= 67108864 /* ObjectLiteralPatternWithComputedProperties */; + } return result; } // Return the type implied by an array binding pattern @@ -16026,6 +16227,14 @@ var ts; if (declaration.kind === 227 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } + // Handle module.exports = expr + if (declaration.kind === 181 /* BinaryExpression */) { + return links.type = checkExpression(declaration.right); + } + // Handle exports.p = expr + if (declaration.kind === 166 /* PropertyAccessExpression */) { + return checkExpressionCached(declaration.parent.right); + } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; @@ -16304,23 +16513,25 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseContructorType = getBaseConstructorTypeOfClass(type); - if (!(baseContructorType.flags & 80896 /* ObjectType */)) { + var baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & 80896 /* ObjectType */)) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); var baseType; - if (baseContructorType.symbol && baseContructorType.symbol.flags & 32 /* Class */) { - // When base constructor type is a class we know that the constructors all have the same type parameters as the + var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 /* Class */ && + areAllOuterTypeParametersApplied(originalBaseType)) { + // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the // class and all return the instance type of the class. There is no need for further checks and we can apply the // type arguments in the same manner as a type reference to get the same error reporting experience. - baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseContructorType.symbol); + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } else { // The class derives from a "class-like" constructor function, check that we have at least one construct signature // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere // we check that all instantiated signatures return the same type. - var constructors = getInstantiatedConstructorsForTypeArguments(baseContructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -16345,6 +16556,17 @@ var ts; type.resolvedBaseTypes.push(baseType); } } + function areAllOuterTypeParametersApplied(type) { + // An unapplied type parameter has its symbol still the same as the matching argument symbol. + // Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked. + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last = outerTypeParameters.length - 1; + var typeArguments = type.typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; + } + return true; + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { @@ -16424,7 +16646,7 @@ var ts; type.typeArguments = type.typeParameters; type.thisType = createType(512 /* TypeParameter */ | 33554432 /* ThisType */); type.thisType.symbol = symbol; - type.thisType.constraint = getTypeWithThisArgument(type); + type.thisType.constraint = type; } } return links.declaredType; @@ -16939,6 +17161,20 @@ var ts; type = getApparentType(type); return type.flags & 49152 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + /** + * The apparent type of a type parameter is the base constraint instantiated with the type parameter + * as the type argument for the 'this' type. + */ + function getApparentTypeOfTypeParameter(type) { + if (!type.resolvedApparentType) { + var constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & 512 /* TypeParameter */) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the @@ -16946,12 +17182,7 @@ var ts; */ function getApparentType(type) { if (type.flags & 512 /* TypeParameter */) { - do { - type = getConstraintOfTypeParameter(type); - } while (type && type.flags & 512 /* TypeParameter */); - if (!type) { - type = emptyObjectType; - } + type = getApparentTypeOfTypeParameter(type); } if (type.flags & 258 /* StringLike */) { type = globalStringType; @@ -17116,7 +17347,7 @@ var ts; if (node.initializer) { var signatureDeclaration = node.parent; var signature = getSignatureFromDeclaration(signatureDeclaration); - var parameterIndex = signatureDeclaration.parameters.indexOf(node); + var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } @@ -17217,6 +17448,16 @@ var ts; } return result; } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { @@ -17740,11 +17981,12 @@ var ts; return links.resolvedType; } function getStringLiteralType(node) { - if (ts.hasProperty(stringLiteralTypes, node.text)) { - return stringLiteralTypes[node.text]; + var text = node.text; + if (ts.hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; } - var type = stringLiteralTypes[node.text] = createType(256 /* StringLiteral */); - type.text = ts.getTextOfNode(node); + var type = stringLiteralTypes[text] = createType(256 /* StringLiteral */); + type.text = text; return type; } function getTypeFromStringLiteral(node) { @@ -18265,7 +18507,7 @@ var ts; return false; } function hasExcessProperties(source, target, reportErrors) { - if (someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { + if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -18358,9 +18600,6 @@ var ts; return result; } function typeParameterIdenticalTo(source, target) { - if (source.symbol.name !== target.symbol.name) { - return 0 /* False */; - } // covers case when both type parameters does not have constraint (both equal to noConstraintType) if (source.constraint === target.constraint) { return -1 /* True */; @@ -18852,18 +19091,29 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } + function isMatchingSignature(source, target, partialMatch) { + // A source signature matches a target signature if the two signatures have the same number of required, + // optional, and rest parameters. + if (source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter) { + return true; + } + // A source signature partially matches a target signature if the target signature has no fewer required + // parameters and no more overall parameters than the source signature (where a signature with a rest + // parameter is always considered to have more overall parameters than one without). + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; + } function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1 /* True */; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { - if (!partialMatch || - source.parameters.length < target.parameters.length && !source.hasRestParameter || - source.minArgumentCount > target.minArgumentCount) { - return 0 /* False */; - } + if (!(isMatchingSignature(source, target, partialMatch))) { + return 0 /* False */; } var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { @@ -18957,6 +19207,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isStringLiteralType(type) { + return type.flags & 256 /* StringLiteral */; + } /** * Check if a Type was written as a tuple type literal. * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. @@ -19629,7 +19882,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -19660,6 +19913,12 @@ var ts; } } if (targetType) { + if (!assumeTrue) { + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); + } + return type; + } return getNarrowedType(type, targetType); } return type; @@ -20129,6 +20388,9 @@ var ts; function getIndexTypeOfContextualType(type, kind) { return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } + function contextualTypeIsStringLiteralType(type) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isStringLiteralType) : isStringLiteralType(type)); + } // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); @@ -20150,7 +20412,7 @@ var ts; } function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; - var type = getContextualType(objectLiteral); + var type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!ts.hasDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name @@ -20173,7 +20435,7 @@ var ts; // type of T. function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; - var type = getContextualType(arrayLiteral); + var type = getApparentTypeOfContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) @@ -20206,11 +20468,28 @@ var ts; } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. - function getContextualType(node) { - var type = getContextualTypeWorker(node); + function getApparentTypeOfContextualType(node) { + var type = getContextualType(node); return type && getApparentType(type); } - function getContextualTypeWorker(node) { + /** + * Woah! Do you really want to use this function? + * + * Unless you're trying to get the *non-apparent* type for a + * value-literal type or you're authoring relevant portions of this algorithm, + * you probably meant to use 'getApparentTypeOfContextualType'. + * Otherwise this may not be very useful. + * + * In cases where you *are* working on this function, you should understand + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * + * - Use 'getContextualType' when you are simply going to propagate the result to the expression. + * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. + * + * @param node the expression whose contextual type will be returned. + * @returns the contextual type of an expression. + */ + function getContextualType(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -20285,7 +20564,7 @@ var ts; ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + : getApparentTypeOfContextualType(node); if (!type) { return undefined; } @@ -20411,7 +20690,7 @@ var ts; type.pattern = node; return type; } - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting @@ -20494,10 +20773,11 @@ var ts; checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); var typeFlags = 0; + var patternWithComputedProperties = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -20525,8 +20805,11 @@ var ts; if (isOptional) { prop.flags |= 536870912 /* Optional */; } + if (ts.hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } } - else if (contextualTypeHasPattern) { + else if (contextualTypeHasPattern && !(contextualType.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */)) { // If object literal is contextually typed by the implied type of a binding pattern, and if the // binding pattern specifies a default value for the property, make the property optional. var impliedProp = getPropertyOfType(contextualType, member.name); @@ -20578,7 +20861,7 @@ var ts; var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; - result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); + result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */) | (patternWithComputedProperties ? 67108864 /* ObjectLiteralPatternWithComputedProperties */ : 0); if (inDestructuringPattern) { result.pattern = node; } @@ -21289,7 +21572,7 @@ var ts; // so order how inherited signatures are processed is still preserved. // interface A { (x: string): void } // interface B extends A { (x: 'foo'): string } - // let b: B; + // const b: B; // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void] function reorderCandidates(signatures, result) { var lastParent; @@ -22247,6 +22530,10 @@ var ts; return anyType; } } + // In JavaScript files, calls to any identifier 'require' are treated as external module imports + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { @@ -22257,7 +22544,10 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - if (!(isTypeAssignableTo(targetType, widenedType))) { + // Permit 'number[] | "foo"' to be asserted to 'string'. + var bothAreStringLike = someConstituentTypeHasKind(targetType, 258 /* StringLike */) && + someConstituentTypeHasKind(widenedType, 258 /* StringLike */); + if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } } @@ -22801,19 +23091,26 @@ var ts; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { - // TODO(andersh): Computed property support var name_13 = p.name; + if (name_13.kind === 136 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + continue; + } + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType - : getTypeOfPropertyOfType(sourceType, name_13.text) || - isNumericLiteralName(name_13.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || + : getTypeOfPropertyOfType(sourceType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { if (p.kind === 246 /* ShorthandPropertyAssignment */) { checkDestructuringAssignment(p, type); } else { - checkDestructuringAssignment(p.initializer || name_13, type); + // non-shorthand property assignments should always have initializers + checkDestructuringAssignment(p.initializer, type); } } else { @@ -23014,6 +23311,10 @@ var ts; case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (someConstituentTypeHasKind(leftType, 258 /* StringLike */) && someConstituentTypeHasKind(rightType, 258 /* StringLike */)) { + return booleanType; + } if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -23137,6 +23438,13 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkStringLiteralExpression(node) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralType(node); + } + return stringType; + } function checkTemplateExpression(node) { // We just want to check each expressions, but we are unconcerned with // the type of each expression, as any value may be coerced into a string. @@ -23187,7 +23495,7 @@ var ts; if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - var contextualType = getContextualType(node); + var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { @@ -23251,6 +23559,7 @@ var ts; case 183 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: + return checkStringLiteralExpression(node); case 11 /* NoSubstitutionTemplateLiteral */: return stringType; case 10 /* RegularExpressionLiteral */: @@ -24580,7 +24889,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 248 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -24598,15 +24907,15 @@ var ts; // A non-initialized declaration is a no-op as the block declaration will resolve before the var // declaration. the problem is if the declaration has an initializer. this will act as a write to the // block declared value. this is fine for let, but not const. - // Only consider declarations with initializers, uninitialized let declarations will not + // Only consider declarations with initializers, uninitialized const declarations will not // step on a let/const variable. - // Do not consider let and const declarations, as duplicate block-scoped declarations + // Do not consider const and const declarations, as duplicate block-scoped declarations // are handled by the binder. - // We are only looking for let declarations that step on let\const declarations from a + // We are only looking for const declarations that step on let\const declarations from a // different scope. e.g.: // { // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration - // let x = 0; // symbol for this declaration will be 'symbol' + // const x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { @@ -24693,6 +25002,12 @@ var ts; checkExpressionCached(node.initializer); } } + if (node.kind === 163 /* BindingElement */) { + // check computed properties inside property names of binding elements + if (node.propertyName && node.propertyName.kind === 136 /* ComputedPropertyName */) { + checkComputedPropertyName(node.propertyName); + } + } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); @@ -25176,6 +25491,7 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); + var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { @@ -25195,6 +25511,10 @@ var ts; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); + // Permit 'number[] | "foo"' to be asserted to 'string'. + if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258 /* StringLike */)) { + return; + } if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); @@ -25659,11 +25979,14 @@ var ts; var enumIsConst = ts.isConst(node); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.name.kind === 136 /* ComputedPropertyName */) { + if (isComputedNonLiteralName(member.name)) { error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } - else if (isNumericLiteralName(member.name.text)) { - error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + else { + var text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } } var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; @@ -26305,8 +26628,8 @@ var ts; } // Function and class expression bodies are checked after all statements in the enclosing body. This is // to ensure constructs like the following are permitted: - // let foo = function () { - // let s = foo(); + // const foo = function () { + // const s = foo(); // return "hello"; // } // Here, performing a full type check of the body of the function expression whilst in the process of @@ -26421,8 +26744,12 @@ var ts; if (!(links.flags & 1 /* TypeChecked */)) { // Check whether the file has declared it is the default lib, // and whether the user has specifically chosen to avoid checking it. - if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) { - return; + if (compilerOptions.skipDefaultLibCheck) { + // If the user specified '--noLib' and a file has a '/// ', + // then we should treat that file as a default lib. + if (node.hasNoDefaultLib) { + return; + } } // Grammar checking checkGrammarSourceFile(node); @@ -26432,7 +26759,7 @@ var ts; potentialThisCollisions.length = 0; ts.forEach(node.statements, checkSourceElement); checkFunctionAndClassExpressionBodies(node); - if (ts.isExternalModule(node)) { + if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } if (potentialThisCollisions.length) { @@ -26515,7 +26842,7 @@ var ts; } switch (location.kind) { case 248 /* SourceFile */: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalOrCommonJsModule(location)) { break; } case 218 /* ModuleDeclaration */: @@ -27153,9 +27480,18 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, - isArgumentsLocalBinding: isArgumentsLocalBinding + isArgumentsLocalBinding: isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration }; } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = ts.getExternalModuleName(declaration); + var moduleSymbol = getSymbolAtLocation(specifier); + if (!moduleSymbol) { + return undefined; + } + return ts.getDeclarationOfKind(moduleSymbol, 248 /* SourceFile */); + } function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { @@ -27163,11 +27499,10 @@ var ts; }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { - if (!ts.isExternalModule(file)) { + if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } }); - // Initialize special symbols getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; @@ -27866,7 +28201,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 136 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); } } @@ -28225,11 +28560,15 @@ var ts; var writeTextOfNode; var writer = createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; - var currentSourceFile; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; var reportedDeclarationError = false; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare = !root; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; // Contains the reference paths that needs to go in the declaration file. @@ -28272,23 +28611,56 @@ var ts; else { // Emit references corresponding to this file var emittedReferencedFiles = []; + var prevModuleElementDeclarationEmitInfo = []; ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + if (!ts.isDeclarationFile(sourceFile)) { // Check what references need to be added if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - // If the reference file is a declaration file or an external module, emit that reference - if (referencedFile && (ts.isExternalModuleOrDeclarationFile(referencedFile) && + // If the reference file is a declaration file, emit that reference + if (referencedFile && (ts.isDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } }); } + } + if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + noDeclare = false; emitSourceFile(sourceFile); } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + // create asynchronous output for the importDeclarations + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 1); + increaseIndent(); + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + decreaseIndent(); + } + }); + setWriter(oldWriter); + } + prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } }); + moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); } return { reportedDeclarationError: reportedDeclarationError, @@ -28297,13 +28669,12 @@ var ts; referencePathsOutput: referencePathsOutput }; function hasInternalAnnotation(range) { - var text = currentSourceFile.text; - var comment = text.substring(range.pos, range.end); + var comment = currentText.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node) { if (node) { - var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -28395,7 +28766,7 @@ var ts; var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } else { diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); @@ -28461,10 +28832,10 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); + ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -28481,7 +28852,7 @@ var ts; case 103 /* VoidKeyword */: case 97 /* ThisKeyword */: case 9 /* StringLiteral */: - return writeTextOfNode(currentSourceFile, type); + return writeTextOfNode(currentText, type); case 188 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); case 151 /* TypeReference */: @@ -28512,14 +28883,14 @@ var ts; } function writeEntityName(entityName) { if (entityName.kind === 69 /* Identifier */) { - writeTextOfNode(currentSourceFile, entityName); + writeTextOfNode(currentText, entityName); } else { var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); - writeTextOfNode(currentSourceFile, right); + writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { @@ -28549,7 +28920,7 @@ var ts; } } function emitTypePredicate(type) { - writeTextOfNode(currentSourceFile, type.parameterName); + writeTextOfNode(currentText, type.parameterName); write(" is "); emitType(type.type); } @@ -28590,9 +28961,12 @@ var ts; } } function emitSourceFile(node) { - currentSourceFile = node; + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -28601,13 +28975,13 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) { + if (!ts.hasProperty(currentIdentifiers, baseName)) { return baseName; } var count = 0; while (true) { var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentSourceFile.identifiers, name_18)) { + if (!ts.hasProperty(currentIdentifiers, name_18)) { return name_18; } } @@ -28615,7 +28989,7 @@ var ts; function emitExportAssignment(node) { if (node.expression.kind === 69 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentSourceFile, node.expression); + writeTextOfNode(currentText, node.expression); } else { // Expression @@ -28653,7 +29027,7 @@ var ts; writeModuleElement(node); } else if (node.kind === 221 /* ImportEqualsDeclaration */ || - (node.parent.kind === 248 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + (node.parent.kind === 248 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible; if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot @@ -28707,7 +29081,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent === currentSourceFile) { + if (node.parent.kind === 248 /* SourceFile */) { // If the node is exported if (node.flags & 2 /* Export */) { write("export "); @@ -28715,7 +29089,7 @@ var ts; if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 215 /* InterfaceDeclaration */) { + else if (node.kind !== 215 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -28742,7 +29116,7 @@ var ts; write("export "); } write("import "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" = "); if (ts.isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); @@ -28750,7 +29124,7 @@ var ts; } else { write("require("); - writeTextOfNode(currentSourceFile, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -28785,7 +29159,7 @@ var ts; if (node.importClause) { var currentWriterPos = writer.getTextPos(); if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentSourceFile, node.importClause.name); + writeTextOfNode(currentText, node.importClause.name); } if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { if (currentWriterPos !== writer.getTextPos()) { @@ -28794,7 +29168,7 @@ var ts; } if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { write("* as "); - writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); + writeTextOfNode(currentText, node.importClause.namedBindings.name); } else { write("{ "); @@ -28804,16 +29178,28 @@ var ts; } write(" from "); } - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); write(";"); writer.writeLine(); } + function emitExternalModuleSpecifier(moduleSpecifier) { + if (moduleSpecifier.kind === 9 /* StringLiteral */ && (!root) && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + if (moduleName) { + write("\""); + write(moduleName); + write("\""); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } function emitImportOrExportSpecifier(node) { if (node.propertyName) { - writeTextOfNode(currentSourceFile, node.propertyName); + writeTextOfNode(currentText, node.propertyName); write(" as "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } function emitExportSpecifier(node) { emitImportOrExportSpecifier(node); @@ -28835,7 +29221,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - writeTextOfNode(currentSourceFile, node.moduleSpecifier); + emitExternalModuleSpecifier(node.moduleSpecifier); } write(";"); writer.writeLine(); @@ -28849,11 +29235,11 @@ var ts; else { write("module "); } - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); while (node.body.kind !== 219 /* ModuleBlock */) { node = node.body; write("."); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; @@ -28872,7 +29258,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); @@ -28894,7 +29280,7 @@ var ts; write("const "); } write("enum "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); write(" {"); writeLine(); increaseIndent(); @@ -28905,7 +29291,7 @@ var ts; } function emitEnumMemberDeclaration(node) { emitJsDocComments(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); @@ -28922,7 +29308,7 @@ var ts; increaseIndent(); emitJsDocComments(node); decreaseIndent(); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); @@ -29037,7 +29423,7 @@ var ts; write("abstract "); } write("class "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -29060,7 +29446,7 @@ var ts; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("interface "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); @@ -29095,7 +29481,7 @@ var ts; // If this node is a computed name, it can only be a symbol, because we've already skipped // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If optional property emit ? if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); @@ -29177,7 +29563,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); } } @@ -29221,7 +29607,7 @@ var ts; emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (!(node.flags & 16 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); @@ -29307,13 +29693,13 @@ var ts; } if (node.kind === 213 /* FunctionDeclaration */) { write("function "); - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } else if (node.kind === 144 /* Constructor */) { write("constructor"); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); if (ts.hasQuestionToken(node)) { write("?"); } @@ -29437,7 +29823,7 @@ var ts; emitBindingPattern(node.name); } else { - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); } if (resolver.isOptionalParameter(node)) { write("?"); @@ -29552,7 +29938,7 @@ var ts; // Example: // original: function foo({y: [a,b,c]}) {} // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; - writeTextOfNode(currentSourceFile, bindingElement.propertyName); + writeTextOfNode(currentText, bindingElement.propertyName); write(": "); } if (bindingElement.name) { @@ -29575,7 +29961,7 @@ var ts; if (bindingElement.dotDotDotToken) { write("..."); } - writeTextOfNode(currentSourceFile, bindingElement.name); + writeTextOfNode(currentText, bindingElement.name); } } } @@ -29667,6 +30053,18 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || ts.isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; var Jump; (function (Jump) { Jump[Jump["Break"] = 2] = "Break"; @@ -29954,15 +30352,19 @@ var ts; var newLine = host.getNewLine(); var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; + var outFile = compilerOptions.outFile || compilerOptions.out; + var emitJavaScript = createFileEmitter(); if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); + if (outFile) { + emitFile(outFile); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); } } else { @@ -29971,8 +30373,8 @@ var ts; var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { + emitFile(outFile); } } // Sort and make the unique list of diagnostics @@ -30024,10 +30426,16 @@ var ts; } } } - function emitJavaScript(jsFilePath, root) { + function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var currentText; + var currentLineMap; + var currentFileIdentifiers; + var renamedDependencies; + var isEs6Module; + var isCurrentFileExternalModule; // name of an exporter function if file is a System external module // System.register([...], function () {...}) // exporting in System modules looks like: @@ -30035,15 +30443,15 @@ var ts; // => // var x;... exporter("x", x = 1) var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; + var generatedNameSet; + var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; var convertedLoopState; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; + var extendsEmitted; + var decorateEmitted; + var paramEmitted; + var awaiterEmitted; + var tempFlags; var tempVariables; var tempParameters; var externalImports; @@ -30075,6 +30483,8 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; + /** The root file passed to the emit function (if present) */ + var root; /** If removeComments is true, no leading-comments needed to be emitted **/ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; var moduleEmitDelegates = (_a = {}, @@ -30085,31 +30495,77 @@ var ts; _a[1 /* CommonJS */] = emitCommonJSModule, _a ); - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); + var bundleEmitDelegates = (_b = {}, + _b[5 /* ES6 */] = function () { }, + _b[2 /* AMD */] = emitAMDModule, + _b[4 /* System */] = emitSystemModule, + _b[3 /* UMD */] = function () { }, + _b[1 /* CommonJS */] = function () { }, + _b + ); + return doEmit; + function doEmit(jsFilePath, rootFile) { + // reset the state + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + generatedNameSet = {}; + nodeToGeneratedName = []; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + root = rootFile; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(jsFilePath, root); + } + if (root) { + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); + } + else { + if (modulekind) { + ts.forEach(host.getSourceFiles(), emitEmitHelpers); } - }); + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); } - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); - return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + currentText = sourceFile.text; + currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(sourceFile); emit(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(currentFileIdentifiers, name) && !ts.hasProperty(generatedNameSet, name); } // Return the next available name in the pattern _a ... _z, _0, _1, ... @@ -30192,7 +30648,7 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps() { + function initializeEmitterWithSourceMaps(jsFilePath, root) { var sourceMapDir; // The directory in which sourcemap will be // Current source map file and its index in the sources list var sourceMapSourceIndex = -1; @@ -30280,7 +30736,7 @@ var ts; } } function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); // Convert the location to be one-based. sourceLinePos.line++; sourceLinePos.character++; @@ -30314,13 +30770,13 @@ var ts; } function recordEmitNodeStartSpan(node) { // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); } function recordEmitNodeEndSpan(node) { recordSourceMapSpan(node.end); } function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + var tokenStartPos = ts.skipTrivia(currentText, startPos); recordSourceMapSpan(tokenStartPos); var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); @@ -30402,9 +30858,9 @@ var ts; sourceMapNameIndices.pop(); } ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); recordSourceMapSpan(comment.end); } function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { @@ -30434,7 +30890,7 @@ var ts; return output; } } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); @@ -30450,7 +30906,7 @@ var ts; sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); } // Initialize source map data var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); @@ -30522,7 +30978,7 @@ var ts; scopeEmitEnd = recordScopeNameEnd; writeComment = writeCommentRangeWithMap; } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } // Create a temporary variable with a unique unused name. @@ -30702,7 +31158,7 @@ var ts; // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + return ts.getTextOfNodeFromSourceText(currentText, node); } // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. @@ -30729,7 +31185,7 @@ var ts; // Find original source text, since we need to emit the raw strings of the tagged template. // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var text = ts.getTextOfNodeFromSourceText(currentText, node); // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), // thus we need to remove those characters. // First template piece starts with "`", others with "}" @@ -31146,7 +31602,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } write("\""); } @@ -31246,7 +31702,7 @@ var ts; // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23); + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); if (languageVersion === 0 /* ES3 */ && identifier === "default") { write("[\"default\"]"); } @@ -31270,7 +31726,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function isNameOfNestedRedeclaration(node) { @@ -31308,7 +31764,7 @@ var ts; write(node.text); } else { - writeTextOfNode(currentSourceFile, node); + writeTextOfNode(currentText, node); } } function emitThis(node) { @@ -31712,7 +32168,7 @@ var ts; function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentSourceFile, node.name); + writeTextOfNode(currentText, node.name); // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, // we emit a normal property assignment. For example: // module m { @@ -31722,7 +32178,7 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (languageVersion < 2 /* ES6 */ || isNamespaceExportReference(node.name)) { + if (modulekind !== 5 /* ES6 */ || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -31779,11 +32235,11 @@ var ts; var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - var shouldEmitSpace; + var shouldEmitSpace = false; if (!indentedBeforeDot) { if (node.expression.kind === 8 /* NumericLiteral */) { // check if numeric literal was originally written with a dot - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; } else { @@ -32962,16 +33418,16 @@ var ts; emitToken(16 /* CloseBraceToken */, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 241 /* CaseClause */) { @@ -33077,7 +33533,7 @@ var ts; ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); // only allow export default at a source file level if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { - if (!currentSourceFile.symbol.exports["___esModule"]) { + if (!isEs6Module) { if (languageVersion === 1 /* ES5 */) { // default value of configurable, enumerable, writable are `false`. write("Object.defineProperty(exports, \"__esModule\", { value: true });"); @@ -33272,14 +33728,20 @@ var ts; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 69 /* Identifier */) { - return createElementAccessExpression(object, syntheticName); + var index; + var nameIsComputed = propName.kind === 136 /* ComputedPropertyName */; + if (nameIsComputed) { + index = ensureIdentifier(propName.expression, /* reuseIdentifierExpression */ false); } - return createPropertyAccessExpression(object, syntheticName); + else { + // We create a synthetic copy of the identifier in order to avoid the rewriting that might + // otherwise occur when the identifier is emitted. + index = ts.createSynthesizedNode(propName.kind); + index.text = propName.text; + } + return !nameIsComputed && index.kind === 69 /* Identifier */ + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { var call = ts.createSynthesizedNode(168 /* CallExpression */); @@ -33742,7 +34204,6 @@ var ts; var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); var isArrowFunction = node.kind === 174 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; - var args; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current // `this` and `arguments` objects to `__awaiter`. The generator function @@ -35197,8 +35658,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + if (renamedDependencies && ts.hasProperty(renamedDependencies, moduleName.text)) { + return "\"" + renamedDependencies[moduleName.text] + "\""; } return undefined; } @@ -35351,7 +35812,7 @@ var ts; // - current file is not external module // - import declaration is top level and target is value imported by entity name if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); // variable declaration for import-equals declaration can be hoisted in system modules @@ -35579,7 +36040,7 @@ var ts; function getLocalNameForExternalImport(node) { var namespaceDeclaration = getNamespaceDeclarationNode(node); if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); @@ -35884,7 +36345,7 @@ var ts; ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 /* System */ && ts.isExternalModule(currentSourceFile); + return modulekind === 4 /* System */ && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: @@ -36054,7 +36515,13 @@ var ts; writeLine(); write("}"); // execute } - function emitSystemModule(node) { + function writeModuleName(node, emitRelativePathAsModuleName) { + var moduleName = node.moduleName; + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { + write("\"" + moduleName + "\", "); + } + } + function emitSystemModule(node, emitRelativePathAsModuleName) { collectExternalModuleInfo(node); // System modules has the following shape // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) @@ -36069,9 +36536,7 @@ var ts; exportFunctionForFile = makeUniqueName("exports"); writeLine(); write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } + writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; @@ -36090,6 +36555,12 @@ var ts; if (i !== 0) { write(", "); } + if (emitRelativePathAsModuleName) { + var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); + if (name_29) { + text = "\"" + name_29 + "\""; + } + } write(text); } write("], function(" + exportFunctionForFile + ") {"); @@ -36103,7 +36574,7 @@ var ts; writeLine(); write("});"); } - function getAMDDependencyNames(node, includeNonAmdDependencies) { + function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { // names of modules with corresponding parameter in the factory function var aliasedModuleNames = []; // names of modules with no corresponding parameters in factory function @@ -36126,6 +36597,12 @@ var ts; var importNode = externalImports_4[_c]; // Find the name of the external module var externalModuleName = getExternalModuleNameText(importNode); + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + externalModuleName = "\"" + name_30 + "\""; + } + } // Find the name of the module alias, if there is one var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -36138,7 +36615,7 @@ var ts; } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - function emitAMDDependencies(node, includeNonAmdDependencies) { + function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); // @@ -36150,7 +36627,7 @@ var ts; // To ensure this is true in cases of modules with no aliases, e.g.: // `import "module"` or `` // we need to add modules without alias names to the end of the dependencies list - var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); emitAMDDependencyList(dependencyNames); write(", "); emitAMDFactoryHeader(dependencyNames); @@ -36177,15 +36654,13 @@ var ts; } write(") {"); } - function emitAMDModule(node) { + function emitAMDModule(node, emitRelativePathAsModuleName) { emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); @@ -36404,8 +36879,13 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; - emitModule(node); + if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + emitModule(node); + } + else { + bundleEmitDelegates[modulekind](node, /*emitRelativePathAsModuleName*/ true); + } } else { // emit prologue directives prior to __extends @@ -36666,7 +37146,7 @@ var ts; } function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -36683,10 +37163,10 @@ var ts; function isTripleSlashComment(comment) { // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + if (currentText.charCodeAt(comment.pos + 1) === 47 /* slash */ && comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { - var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + currentText.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentText.substring(comment.pos, comment.end); return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? true : false; @@ -36703,7 +37183,7 @@ var ts; } else { // get the leading comments from the node - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); } } } @@ -36712,7 +37192,7 @@ var ts; // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + return ts.getTrailingCommentRanges(currentText, node.end); } } } @@ -36746,9 +37226,9 @@ var ts; leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { @@ -36757,7 +37237,7 @@ var ts; // Emit the trailing comments only if the parent's end doesn't match var trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } /** * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: @@ -36768,9 +37248,9 @@ var ts; if (compilerOptions.removeComments) { return; } - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + var trailingComments = ts.getTrailingCommentRanges(currentText, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitLeadingCommentsOfPositionWorker(pos) { if (compilerOptions.removeComments) { @@ -36783,14 +37263,14 @@ var ts; } else { // get the leading comments from the node - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + leadingComments = ts.getLeadingCommentRanges(currentText, pos); } - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAndUpdateCommentsInfo(node) { - var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); if (currentDetachedCommentInfo) { if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -36801,12 +37281,12 @@ var ts; } } function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); + var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); } } - var _a; + var _a, _b; } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -36866,11 +37346,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -36880,8 +37360,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { - return ts.forEach(ts.moduleFileExtensions, tryLoad); + function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + return ts.forEach(extensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -36893,7 +37373,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -36906,7 +37386,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -36916,7 +37396,7 @@ var ts; // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -36926,11 +37406,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); + var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -36956,9 +37436,10 @@ var ts; var searchName; var failedLookupLocations = []; var referencedSourceFile; + var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; while (true) { searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + referencedSourceFile = ts.forEach(extensions, function (extension) { if (extension === ".tsx" && !compilerOptions.jsx) { // resolve .tsx files only if jsx support is enabled // 'logical not' handles both undefined and None cases @@ -36989,10 +37470,8 @@ var ts; /* @internal */ ts.defaultInitCompilerOptions = { module: 1 /* CommonJS */, - target: 0 /* ES3 */, + target: 1 /* ES5 */, noImplicitAny: false, - outDir: "built", - rootDir: ".", sourceMap: false }; function createCompilerHost(options, setParentNodes) { @@ -37397,43 +37876,55 @@ var ts; if (file.imports) { return; } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, /* allowRelativeModuleNames */ true); + collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); } file.imports = imports || emptyArray; - function collect(node, allowRelativeModuleNames) { - switch (node.kind) { - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + return; + function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { + if (!collectOnlyRequireCalls) { + switch (node.kind) { + case 222 /* ImportDeclaration */: + case 221 /* ImportEqualsDeclaration */: + case 228 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { + case 218 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - collect(node, /* allowRelativeModuleNames */ false); - }); - } - break; + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + ts.forEachChild(node.body, function (node) { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); + }); + } + break; + } + } + if (isJavaScriptFile) { + if (ts.isRequireCall(node)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true); }); + } } } } @@ -37526,7 +38017,6 @@ var ts; // always process imported modules to record module name resolutions processImportedModules(file, basePath); if (isDefaultLib) { - file.isDefaultLib = true; files.unshift(file); } else { @@ -37604,6 +38094,9 @@ var ts; commonPathComponents.length = sourcePathComponents.length; } }); + if (!commonPathComponents) { + return currentDirectory; + } return ts.getNormalizedPathFromPathComponents(commonPathComponents); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { @@ -37689,12 +38182,15 @@ var ts; if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } + // Cannot specify module gen that isn't amd or system with --out + if (outFile && options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted if (options.outDir || options.sourceRoot || - (options.mapRoot && - (!outFile || firstExternalModuleSourceFile !== undefined))) { + options.mapRoot) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -38212,20 +38708,20 @@ var ts; var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); for (var i = 0; i < sysFiles.length; i++) { - var name_29 = sysFiles[i]; - if (ts.fileExtensionIs(name_29, ".d.ts")) { - var baseName = name_29.substr(0, name_29.length - ".d.ts".length); + var name_31 = sysFiles[i]; + if (ts.fileExtensionIs(name_31, ".d.ts")) { + var baseName = name_31.substr(0, name_31.length - ".d.ts".length); if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_29); + fileNames.push(name_31); } } - else if (ts.fileExtensionIs(name_29, ".ts")) { - if (!ts.contains(sysFiles, name_29 + "x")) { - fileNames.push(name_29); + else if (ts.fileExtensionIs(name_31, ".ts")) { + if (!ts.contains(sysFiles, name_31 + "x")) { + fileNames.push(name_31); } } else { - fileNames.push(name_29); + fileNames.push(name_31); } } } @@ -38453,12 +38949,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_30 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_30); + for (var name_32 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_32); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_30); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); if (!matches) { continue; } @@ -38471,14 +38967,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_30); + matches = patternMatcher.getMatches(containers, name_32); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_30, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -38859,9 +39355,9 @@ var ts; case 211 /* VariableDeclaration */: case 163 /* BindingElement */: var variableDeclarationNode; - var name_31; + var name_33; if (node.kind === 163 /* BindingElement */) { - name_31 = node.name; + name_33 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -38873,16 +39369,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_31 = node.name; + name_33 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_31), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); } case 144 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -39802,7 +40298,7 @@ var ts; if (!candidates.length) { // We didn't have any sig help items produced by the TS compiler. If this is a JS // file, then see if we can figure out anything better. - if (ts.isJavaScript(sourceFile.fileName)) { + if (ts.isSourceFileJavaScript(sourceFile)) { return createJavaScriptSignatureHelpItems(argumentInfo); } return undefined; @@ -41662,9 +42158,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_32 in o) { - if (o[name_32] === rule) { - return name_32; + for (var name_34 in o) { + if (o[name_34] === rule) { + return name_34; } } throw new Error("Unknown rule"); @@ -42096,7 +42592,7 @@ var ts; function TokenRangeAccess(from, to, except) { this.tokens = []; for (var token = from; token <= to; token++) { - if (except.indexOf(token) < 0) { + if (ts.indexOf(except, token) < 0) { this.tokens.push(token); } } @@ -43709,13 +44205,18 @@ var ts; ]; var jsDocCompletionEntries; function createNode(kind, pos, end, flags, parent) { - var node = new (ts.getNodeConstructor(kind))(pos, end); + var node = new NodeObject(kind, pos, end); node.flags = flags; node.parent = parent; return node; } var NodeObject = (function () { - function NodeObject() { + function NodeObject(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0 /* None */; + this.parent = undefined; } NodeObject.prototype.getSourceFile = function () { return ts.getSourceFileOfNode(this); @@ -44198,8 +44699,8 @@ var ts; })(); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); - function SourceFileObject() { - _super.apply(this, arguments); + function SourceFileObject(kind, pos, end) { + _super.call(this, kind, pos, end); } SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); @@ -44521,6 +45022,9 @@ var ts; ClassificationTypeNames.typeAliasName = "type alias name"; ClassificationTypeNames.parameterName = "parameter name"; ClassificationTypeNames.docCommentTagName = "doc comment tag name"; + ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; + ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; + ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; @@ -44543,6 +45047,9 @@ var ts; ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; })(ts.ClassificationType || (ts.ClassificationType = {})); var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { @@ -44922,8 +45429,9 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; var importedFiles = []; var ambientExternalModules; @@ -44957,9 +45465,207 @@ var ts; end: pos + importPath.length }); } - function processImport() { + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122 /* DeclareKeyword */) { + // declare module "mod" + token = scanner.scan(); + if (token === 125 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + else if (token === 24 /* CommaToken */) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + return true; + } + } + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 116 /* AsKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82 /* ExportKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = scanner.scan(); + } + if (token === 16 /* CloseBraceToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 37 /* AsteriskToken */) { + token = scanner.scan(); + if (token === 133 /* FromKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === 89 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 69 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 56 /* EqualsToken */) { + if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + if (token === 127 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { + token = scanner.scan(); + if (token !== 17 /* OpenParenToken */) { + return true; + } + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // looks like define ("modname", ... - skip string literal and comma + token = scanner.scan(); + if (token === 24 /* CommaToken */) { + token = scanner.scan(); + } + else { + // unexpected token + return true; + } + } + // should be start of dependency list + if (token !== 19 /* OpenBracketToken */) { + return true; + } + // skip open bracket + token = scanner.scan(); + var i = 0; + // scan until ']' or EOF + while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + // record string literals as module names + if (token === 9 /* StringLiteral */) { + recordModuleName(); + i++; + } + token = scanner.scan(); + } + return true; + } + return false; + } + function processImports() { scanner.setText(sourceText); - var token = scanner.scan(); + scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -44971,152 +45677,26 @@ var ts; // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") - while (token !== 1 /* EndOfFileToken */) { - if (token === 122 /* DeclareKeyword */) { - // declare module "mod" - token = scanner.scan(); - if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - recordAmbientExternalModule(); - continue; - } - } + // (for JavaScript files) require("mod") + while (true) { + if (scanner.getToken() === 1 /* EndOfFileToken */) { + break; } - else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import "mod"; - recordModuleName(); - continue; - } - else { - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import d from "mod"; - recordModuleName(); - continue; - } - } - else if (token === 56 /* EqualsToken */) { - token = scanner.scan(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import i = require("mod"); - recordModuleName(); - continue; - } - } - } - } - else if (token === 24 /* CommaToken */) { - // consume comma and keep going - token = scanner.scan(); - } - else { - // unknown syntax - continue; - } - } - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 116 /* AsKeyword */) { - token = scanner.scan(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + continue; } - else if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); - if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); - // consume "{ a as B, c, d as D}" clauses - while (token !== 16 /* CloseBraceToken */) { - token = scanner.scan(); - } - if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 56 /* EqualsToken */) { - token = scanner.scan(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); - if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); - if (token === 9 /* StringLiteral */) { - // export import i = require("mod"); - recordModuleName(); - } - } - } - } - } - } + else { + scanner.scan(); } - token = scanner.scan(); } scanner.setText(undefined); } if (readImportFiles) { - processImport(); + processImports(); } processTripleSlashDirectives(); return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; @@ -45547,7 +46127,7 @@ var ts; // For JavaScript files, we don't want to report the normal typescript semantic errors. // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. - if (ts.isJavaScript(fileName)) { + if (ts.isSourceFileJavaScript(targetSourceFile)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. @@ -45759,7 +46339,7 @@ var ts; var typeChecker = program.getTypeChecker(); var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isJavaScript(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); @@ -46393,8 +46973,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_33 = element.propertyName || element.name; - exisingImportsOrExports[name_33.text] = true; + var name_35 = element.propertyName || element.name; + exisingImportsOrExports[name_35.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -46426,7 +47006,10 @@ var ts; } var existingName = void 0; if (m.kind === 163 /* BindingElement */ && m.propertyName) { - existingName = m.propertyName.text; + // include only identifiers in completion list + if (m.propertyName.kind === 69 /* Identifier */) { + existingName = m.propertyName.text; + } } else { // TODO(jfreeman): Account for computed property name @@ -46466,46 +47049,43 @@ var ts; return undefined; } var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; - var entries; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } - if (isRightOfDot && ts.isJavaScript(fileName)) { - entries = getCompletionEntriesFromSymbols(symbols); - ts.addRange(entries, getJavaScriptCompletionEntries()); + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); } else { if (!symbols || symbols.length === 0) { return undefined; } - entries = getCompletionEntriesFromSymbols(symbols); + getCompletionEntriesFromSymbols(symbols, entries); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries() { + function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { var entries = []; - var allNames = {}; var target = program.getCompilerOptions().target; - for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { - var sourceFile = _a[_i]; - var nameTable = getNameTable(sourceFile); - for (var name_34 in nameTable) { - if (!allNames[name_34]) { - allNames[name_34] = name_34; - var displayName = getCompletionEntryDisplayName(name_34, target, /*performCharacterChecks:*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var nameTable = getNameTable(sourceFile); + for (var name_36 in nameTable) { + if (!uniqueNames[name_36]) { + uniqueNames[name_36] = name_36; + var displayName = getCompletionEntryDisplayName(name_36, target, /*performCharacterChecks:*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } } } @@ -46543,25 +47123,24 @@ var ts; sortText: "0" }; } - function getCompletionEntriesFromSymbols(symbols) { + function getCompletionEntriesFromSymbols(symbols, entries) { var start = new Date().getTime(); - var entries = []; + var uniqueNames = {}; if (symbols) { - var nameToSymbol = {}; for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); - if (!ts.lookUp(nameToSymbol, id)) { + if (!ts.lookUp(uniqueNames, id)) { entries.push(entry); - nameToSymbol[id] = symbol; + uniqueNames[id] = id; } } } } log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); - return entries; + return uniqueNames; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -46762,16 +47341,16 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(54 /* ColonToken */)); + displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); displayParts.push(ts.spacePart()); } - if (!(type.flags & 65536 /* Anonymous */)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); + if (!(type.flags & ts.TypeFlags.Anonymous)) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); } - addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); + addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); break; default: // Just signature @@ -48396,19 +48975,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_35 = node.text; + var name_37 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_35); + var unionProperty = contextualType.getProperty(name_37); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_35); + var symbol = t.getProperty(name_37); if (symbol) { result_4.push(symbol); } @@ -48417,7 +48996,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_35); + var symbol_1 = contextualType.getProperty(name_37); if (symbol_1) { return [symbol_1]; } @@ -48828,6 +49407,9 @@ var ts; case 16 /* typeAliasName */: return ClassificationTypeNames.typeAliasName; case 17 /* parameterName */: return ClassificationTypeNames.parameterName; case 18 /* docCommentTagName */: return ClassificationTypeNames.docCommentTagName; + case 19 /* jsxOpenTagName */: return ClassificationTypeNames.jsxOpenTagName; + case 20 /* jsxCloseTagName */: return ClassificationTypeNames.jsxCloseTagName; + case 21 /* jsxSelfClosingTagName */: return ClassificationTypeNames.jsxSelfClosingTagName; } } function convertClassifications(classifications) { @@ -49097,6 +49679,21 @@ var ts; return 17 /* parameterName */; } return; + case 235 /* JsxOpeningElement */: + if (token.parent.tagName === token) { + return 19 /* jsxOpenTagName */; + } + return; + case 237 /* JsxClosingElement */: + if (token.parent.tagName === token) { + return 20 /* jsxCloseTagName */; + } + return; + case 234 /* JsxSelfClosingElement */: + if (token.parent.tagName === token) { + return 21 /* jsxSelfClosingTagName */; + } + return; } } return 2 /* identifier */; @@ -50021,18 +50618,8 @@ var ts; ts.getDefaultLibFilePath = getDefaultLibFilePath; function initializeServices() { ts.objectAllocator = { - getNodeConstructor: function (kind) { - function Node(pos, end) { - this.pos = pos; - this.end = end; - this.flags = 0 /* None */; - this.parent = undefined; - } - var proto = kind === 248 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); - proto.kind = kind; - Node.prototype = proto; - return Node; - }, + getNodeConstructor: function () { return NodeObject; }, + getSourceFileConstructor: function () { return SourceFileObject; }, getSymbolConstructor: function () { return SymbolObject; }, getTypeConstructor: function () { return TypeObject; }, getSignatureConstructor: function () { return SignatureObject; } @@ -51102,7 +51689,8 @@ var ts; }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + // for now treat files as JavaScript + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); var convertResult = { referencedFiles: [], importedFiles: [], @@ -51166,7 +51754,7 @@ var ts; TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { try { if (this.documentRegistry === undefined) { - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var hostAdapter = new LanguageServiceShimHostAdapter(host); var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); @@ -51199,7 +51787,7 @@ var ts; TypeScriptServicesFactory.prototype.close = function () { // Forget all the registered shims this._shims = []; - this.documentRegistry = ts.createDocumentRegistry(); + this.documentRegistry = undefined; }; TypeScriptServicesFactory.prototype.registerShim = function (shim) { this._shims.push(shim); From 4720c3592df77ac0be3cef7e427e5ea4d0804f84 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 11 Nov 2015 16:51:29 -0800 Subject: [PATCH 139/140] added missing check if file is specified --- src/services/services.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index 0e2dd513336..d1c87d17239 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2847,8 +2847,11 @@ namespace ts { } function sourceFileUpToDate(sourceFile: SourceFile): boolean { + if (!sourceFile) { + return false; + } let path = sourceFile.path || toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); - return sourceFile && sourceFile.version === hostCache.getVersion(path); + return sourceFile.version === hostCache.getVersion(path); } function programUpToDate(): boolean { From 40e0ffaff7eceb666e7b37e5198bb0acbcf16846 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Nov 2015 23:22:12 -0800 Subject: [PATCH 140/140] Update authors for release 1.7 --- AUTHORS.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 0ade4c31221..a733520ff4f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -8,6 +8,7 @@ TypeScript is authored by: * Basarat Ali Syed * Ben Duffield * Bill Ticehurst +* Brett Mayen * Bryan Forbes * Caitlin Potter * Chris Bubernak @@ -17,11 +18,14 @@ TypeScript is authored by: * Dan Quirk * Daniel Rosenwasser * David Li -* Dick van den Brink -* Dirk Bäumer +* Denis Nedelyaev +* Dick van den Brink +* Dirk Bäumer +* Eyas Sharaiha * Frank Wallis * Gabriel Isenberg * Gilad Peleg +* Graeme Wicksted * Guillaume Salles * Harald Niesche * Ingvar Stepanyan @@ -31,30 +35,39 @@ TypeScript is authored by: * Jason Ramsay * Jed Mao * Johannes Rieken +* John Vilk * Jonathan Bond-Caron * Jonathan Park * Jonathan Turner * Josh Kalderimis +* Julian Williams * Kagami Sascha Rosylight * Keith Mashinter +* Ken Howard * Kenji Imamula * Lorant Pinter +* Martin VÅ¡etiÄka * Masahiro Wakame * Max Deepfield * Micah Zoltu * Mohamed Hegazy +* Nathan Shively-Sanders * Oleg Mihailik * Oleksandr Chekhovskyi * Paul van Brenk * Pedro Maltez * Philip Bulley * piloopin +* @progre +* Punya Biswal * Ron Buckton * Ryan Cavanaugh +* Ryohei Ikegami +* Sébastien Arod * Sheetal Nandi * Shengping Zhong * Shyyko Serhiy -* Simon Hürlimann +* Simon H�rlimann * Solal Pirelli * Stan Thomas * Steve Lucco @@ -63,8 +76,10 @@ TypeScript is authored by: * togru * Tomas Grubliauskas * TruongSinh Tran-Nguyen +* Viliv Vane * Vladimir Matveev * Wesley Wigham +* York Yao * Yui Tanglertsampan * Zev Spitz * Zhengbo Li \ No newline at end of file